Re: Calling Derived class OnInitDIalog
On Mon, 09 Jul 2007 03:31:03 -0700, akshay4friend@yahoo.com wrote:
My class is derived from CPrintDialog and I am passing hDlg handle to
hook function....
something like
INT CALLBACK PrintHookProc(HWND hDlg, UINT nMsg, WPARAM wParam,
LPARAM lParam)
{
//hDlg = HWND window handle of CMyPrintDialog which is CPrintDialog
Derived class
switch (nMsg)
{
case WM_INITDIALOG:
{
Now suppose here I want to call 'InitDialog of my DERIVED
CMyPrintDialog'.. How do I do that ???
You shouldn't have to, as MFC's hook will do that for you.[*] In addition,
the CPrintDialog documentation says:
http://msdn2.microsoft.com/en-us/library/sk61115a(VS.80).aspx
<q>
To customize the dialog box, derive a class from CPrintDialog, provide a
custom dialog template, and add a message map to process the notification
messages from the extended controls. Any unprocessed messages should be
passed on to the base class. Customizing the hook function is not required.
To process the same message differently depending on whether the dialog box
is Print or Print Setup, you must derive a class for each dialog box. You
must also override the Windows AttachOnSetup function, which handles the
creation of a new dialog box when the Print Setup button is selected within
a Print dialog box.
</q>
If you do "customize the hook", you will be replacing MFC's hook, which
means you either have to do everything it does or defer to it, but since
_AfxCommDlgProc is undocumented, it's hard to know what to do.
[*] Except in unpatched VC6. For more, see:
http://support.microsoft.com/kb/193272
--
Doug Harrison
Visual C++ MVP