Microsoft KB Archive/71450

{|
 * width="100%"|

HOWTO: Use One IsDialogMessage Call for Many Modeless Dialogs

 * }

Q71450

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)
 * Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1

-

SUMMARY
In the Windows environment, an application can implement more than one modeless dialog box with a single call to the IsDialogMessage function. This can be done by using the following three-step method:

Maintain the window handle to the currently active modeless dialog box in a global variable.

Pass the global variable as the hDlg parameter to the IsDialogMessage function, which is normally called from the application's main message loop.

Update the global variable whenever a modeless dialog box's window procedure receives a WM_ACTIVATE message, as follows:


 * If the dialog is losing activation (wParam is 0), set the global variable to NULL.
 * If the dialog is becoming active (wParam is 1 or 2), set the global variable to the dialog's window handle.

MORE INFORMATION
The information below demonstrates how to implement this technique.


 * 1) Declare a global variable for the modeless dialog box's window handle as follows:
 * 2) In the application's main message loop, add a call to the IsDialogMessage function as follows:
 * 3) In the modeless dialog box's window procedure, process the WM_ACTIVATE message as follows:

For more information on the WM_ACTIVATE message, see page 6-47 in &quot;Microsoft Windows Software Development Kit Reference Volume 1&quot; for the Windows SDK version 3.0 and page 87 of &quot;Programmer's Reference, Volume 3: Messages, Structures, and Macros&quot; for the Windows SDK version 3.1.

For details on the IsDialogMessage function, see page 4-266 in &quot;Windows Software Development Kit Reference Volume 1&quot; for the Windows SDK version 3.0 and page 553 of &quot;Programmer's Reference, Volume 2: Functions&quot; for the Windows SDK version 3.1.

For details on using a modeless dialog box in an application for the Windows environment, see Chapter 10 of &quot;Programming Windows,&quot; second edition, (Microsoft Press) written by Charles Petzold.

Additional query words:

Keywords : kbDlg kbOSWinNT kbOSWin2000 kbGrpDSUser kbOSWin

Issue type : kbhowto

Technology : kbWin32SDKSearch kbAudDeveloper kbWin3xSearch kbSDKSearch kbWin32sSearch kbWinSDKSearch kbWinSDK300 kbWinSDK310