Jump to content

WinQuerySecondaryHWND

From EDM2

This function returns a window handle to various windows created as a part of a secondary window.

Syntax

#define INCL_SECONDARYWINDOW
#include <os2.h>

HWND    hwnd;    /*  Secondary window handle. */
ULONG   ulFlag;  /*  Flags. */
HWND    hwndOut; /*  Requested window handle. */

hwndOut = WinQuerySecondaryHWND(hwnd, ulFlag);

Parameters

hwnd (HWND) - input
Secondary window handle.
ulFlag (ULONG) - input
Flags.
  • QS_FRAME: Returns the HWND for the outer standard frame window.
  • QS_DIALOG: Returns the HWND for the inner dialog frame window.

Return Value

hwndOut (HWND) - returns
Returns the requested window handle.

Remarks

This function returns the handle to the outer frame window or the inner dialog frame window of a secondary window, depending on the handle supplied as input.

Secondary windows utilize two frame windows: a standard frame and a dialog window to implement sizing and scrolling features. The window handle returned from WinLoadSecondaryWindow is the handle to the standard frame. The window handle passed to the message procedure specified in WinLoadSecondaryWindow is the dialog window handle.

  • The **standard frame window handle** must be used when associating a help instance and to do WinSetWindowPos operations.
  • The **dialog window handle** should be used as the owner for message boxes and to access the controls on the dialog with WinWindowFromID.
  • To modify the title bar or the system menu, the application must specify the standard frame window and not the dialog window.

Example Code

The following code illustrates returning a window handle to various windows created as a part of a secondary window.

  #define INCL_SECONDARYWINDOW
  #include <sw.h>

  HWND hwndFrame, hwndDialog;

  hwndFrame = WinLoadSecondaryWindow (HWND_DESKTOP, /* Parent window */
                                      HWND_DESKTOP, /* Owner window  */
                                      MyDlgProc,    /* Dialog proc   */
                                      NULL,         /* Module handle */
                                      ID_DIALOG,    /* Resource ID   */
                                      NULL);        /* Create params */

  hwndDialog = WinQuerySecondaryHWND( hwndFrame, QS_DIALOG );

Related Functions