Click to See Complete Forum and Search --> : How to get a handle to a dialog


May 6th, 1999, 08:45 AM
I have a CFormView based application, and I need to get a handle to the main formview, as well as handles to regular modal dialog boxes. I've never really understood all the stuff about handles, and I can't seem to find out how to get a handle to a dialog in the help.

Thanks,
Devin

May 6th, 1999, 09:04 AM
Why do you need a handle to dialog? Do you want to access the dialog from another place?

May 6th, 1999, 09:10 AM
I'm using a third party software tool from Blue Sky Software called WinHelp Office. You can use this software to create help files for your program, or to create those nifty "What's this?" context menus when users right-click over certain areas in your program.

To use many of the functions that enable these context menus, you need a handle to the dialog box where the menus will go. I've provided the skeleton of one of the functions below:


BOOL CSHRegisterDialog(

HWND a_hDialog, // window handle of the dialog to register
long a_UniqueID, // unique ID for this dialog
);

Parameter
a_hDialog

Specifies the dialog box that is being registered.

Return Value
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. If this function fails What’s This? Help will not be enabled in the specified dialog.
Remarks
Example Call:

case WM_INITDIALOG:

// Register What's This Help for Duplicate dialog "AboutBox2"
CSHRegisterDialog(hDlg, (LONG)(55555));
return (TRUE);


The hDlg parameter is what I need to get, but I don't know how? Any ideas?

Thanks
Devin