Difference between revisions of "Forms & Dialogs"

From Team Developer SqlWindows Wiki
Jump to: navigation, search
m (Copied FormWindow/Dialog Box tip to new merged page)
 
(Added tip for forcing window on taskbar)
Line 8: Line 8:
 
See [[Win_messages#How_to_drag_a_window_without_a_caption|Windows messages : How to drag a window without a caption]]<br>
 
See [[Win_messages#How_to_drag_a_window_without_a_caption|Windows messages : How to drag a window without a caption]]<br>
  
 +
 +
<!------------------------------------------------------------------------------------------------------------------------------>
 +
{{TipHeader|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.<br>
 +
Windows created using a parent, will not be shown.<br>
 +
<br>
 +
To be able to use a parent while creating a window AND having it placed on the taskbar, use the following:<br>
 +
On creation of the window, set the GWL_EXSTYLE to WS_EX_APPWINDOW.<br>
 +
<br>
 +
First declare these external functions and system constants:<br>
 +
<pre>
 +
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
 +
 +
 +
Constants
 +
  System
 +
      Number: GWL_EXSTYLE = -20
 +
      Number: WS_EX_APPWINDOW = 0x00040000
 +
</pre>
 +
 +
Now, set the WS_EX_APPWINDOW style to the window at creation:<br>
 +
 +
<pre>
 +
On SAM_Create
 +
  Call SetWindowLongA( hWndForm, GWL_EXSTYLE, GetWindowLongA( hWndForm, GWL_EXSTYLE ) | WS_EX_APPWINDOW )
 +
</pre>
 +
 +
The window will be shown on the taskbar.<br>
 +
<br>
 +
 +
Here you can download a sample:
 +
*[http://samples.tdcommunity.net/index.php?dir=&file=WIKI_ShowWindowOnTaskbar.zip WIKI_ShowWindowOnTaskbar.zip]<br>
 +
<br>
  
 
<!------------------------------------------------------------------------------------------------------------------------------>
 
<!------------------------------------------------------------------------------------------------------------------------------>
 
{{TipHeader|Enter new tip title here}}
 
{{TipHeader|Enter new tip title here}}
 
Enter new tip description here
 
Enter new tip description here

Revision as of 23:03, 8 May 2009

This page covers Form Window and DialogBox tips & tricks.

Contents


Pointer2.png How to drag a window without a caption Pointer.png

See Windows messages : How to drag a window without a caption


Pointer2.png How to force a window on the taskbar Pointer.png

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.

First 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


Constants
   System
      Number: GWL_EXSTYLE	= -20
      Number: WS_EX_APPWINDOW	= 0x00040000

Now, set the WS_EX_APPWINDOW style to the window at creation:

On SAM_Create
   Call SetWindowLongA( hWndForm, GWL_EXSTYLE, GetWindowLongA( hWndForm, GWL_EXSTYLE ) | WS_EX_APPWINDOW )

The window will be shown on the taskbar.

Here you can download a sample:


Pointer2.png Enter new tip title here Pointer.png

Enter new tip description here