Difference between revisions of "Forms & Dialogs"
DaveRabelink (Talk | contribs) |
DaveRabelink (Talk | contribs) |
||
Line 7: | Line 7: | ||
<!------------------------------------------------------------------------------------------------------------------------------> | <!------------------------------------------------------------------------------------------------------------------------------> | ||
{{TipHeader|How to drag a window without a caption}} | {{TipHeader|How to drag a window without a caption}} | ||
− | See | + | See: |
+ | |||
+ | {{WikiLink | ||
+ | |URL=http://wiki.tdcommunity.net/index.php?title=Win_messages#How_to_drag_a_window_without_a_caption | ||
+ | |TEXT=How to drag a window without a caption | ||
+ | }} | ||
Line 74: | Line 79: | ||
</pre> | </pre> | ||
− | The window will then be shown on the taskbar. | + | The window will then be shown on the taskbar. |
− | + | ||
Here you can download a sample: | Here you can download a sample: | ||
− | + | ||
− | + | {{Download | |
+ | |URL=http://samples.tdcommunity.net/index.php?dir=&file=WIKI_ShowWindowOnTaskbarWithAccessories.zip | ||
+ | |TEXT=WIKI_ShowWindowOnTaskbarWithAccessories.zip | ||
+ | }} | ||
[[Category:Top Level Windows]] | [[Category:Top Level Windows]] |
Revision as of 11:14, 29 October 2013
Form Window & DialogBox
Contents |
How to drag a window without a caption 
See:
How to drag a window without a caption
How to force a window on the taskbar 
When a top-level window is created without a specific parent (hWndNULL) the window will be visible on the Windows taskbar.
Windows created using a parent, will not be shown.
To be able to use a parent while creating a window AND having it placed on the taskbar, use the following:
On creation of the window, set the GWL_EXSTYLE to WS_EX_APPWINDOW.
Beware, a top level window with accessories enabled has a different internal window hierarchy compared to
a window without accessories.
For top level windows having accessories, hWndForm should be changed to the parent of hWndForm.
You can not use SalParentWindow, that function will return the owner of the window.
You need to call GetParent from WinApi as declared above.
So, declare these external functions and system constants:
Library name: USER32.DLL Function: GetWindowLongA Export Ordinal: 0 Returns Number: LONG Parameters Window Handle: HWND Number: INT Function: SetWindowLongA Export Ordinal: 0 Returns Number: LONG Parameters Window Handle: HWND Number: INT Number: LONG Function: GetParent Export Ordinal: 0 Returns Window Handle: HWND Parameters Window Handle: HWND Constants System Number: GWL_EXSTYLE = -20 Number: WS_EX_APPWINDOW = 0x00040000
For top level windows without accessories enabled, do this:
set the WS_EX_APPWINDOW style to the window (hWndForm) at creation:
On SAM_Create Call SetWindowLongA( hWndForm, GWL_EXSTYLE, GetWindowLongA( hWndForm, GWL_EXSTYLE ) | WS_EX_APPWINDOW )
For top level windows WITH accessories enabled, do this:
set the WS_EX_APPWINDOW style to the parent window of hWndForm at creation:
On SAM_Create Call SetWindowLongA( GetParent( hWndForm ), GWL_EXSTYLE, GetWindowLongA( GetParent( hWndForm ), GWL_EXSTYLE ) | WS_EX_APPWINDOW )
The window will then be shown on the taskbar.
Here you can download a sample: