How to get window handle of main dialog box

How to get window handle of main dialog box

I am writing QuickWin console application and cannot figure out how to get the window handle of my main (modeless) dialog box (which I call IDD_DIALOG1).  I know how the get the handle for dialog controls (e.g. hWnd=GetWindowItem(dlg%hWnd,IDC_CONTROL)), but not for the main window.

I want this handle for when I launch a pop-up modal dialog box (from the main program - not from a callback routine), using reti=dlgmodalwithparent(dlg2,hWndParent), where hWndParent is the handle to my main dialog box.  I want to do this so my main dialog box will be disabled while the new dialog is displayed.

Any help will be appreciated.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

GETHWNDQQ (W*S)

QuickWin Function: Converts a window unit number into a Windows* handle.

Module

USE IFQWIN

result = GETHWNDQQ (unit)

unit

(Input) INTEGER(4). The window unit number. If unit is set to QWIN$FRAMEWINDOW (defined in IFQWIN.F90), the handle of the frame window is returned.

Results

The result type is INTEGER(4) on IA-32 architecture; INTEGER(8) on Intel® 64 architecture. The result is a true Windows handle to the window. If unit is not open, it returns -1 .

Thanks, App4619.

And thanks for setting me straight on getting the main dialog handle for a Console Application (the handle is simply dlg%hWnd, where dlg refers to the main dialog.  Then use reti=dlgmodalwithparent(dlg2,dlg%hWnd) when launching the child dialog).

Everything is working great, now.

Leave a Comment

Please sign in to add a comment. Not a member? Join today