Subclassing CDialog with SetWindowLong(...) 
Author Message
 Subclassing CDialog with SetWindowLong(...)

Hi all.

I have been trying to subclass a CDialog with SetWindowLong. What I do
is the following:

oldWndProc = (WNDPROC)SetWindowLong(GetSafeHwnd(), GWL_WNDPROC, (LONG)
ModalDialogProc);

where olWndProc is declared as WNDPROC. The above line is in OnCreate
after CDialog::OnCreate but it doesn't work properly. The title bar is
messed up, no title and root menu! I can't move the dialog window.

Does anyone recognize this? Would be very grateful for any suggestions.
By the way I have to do the subclassing this way, i am trying to
integrate some old code with MFC.

--
Engin Zufer

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 07 May 2002 03:00:00 GMT  
 Subclassing CDialog with SetWindowLong(...)
Don't try to subclass using SetWindowLong() -- you're violating the MFC
architecture, and as you can see, it doesn't work.  To subclass your dialog,
derive a class from CDialog that does what you want and call
SubclassWindow() -- see the docs.


Quote:
> Hi all.

> I have been trying to subclass a CDialog with SetWindowLong. What I do
> is the following:

> oldWndProc = (WNDPROC)SetWindowLong(GetSafeHwnd(), GWL_WNDPROC, (LONG)
> ModalDialogProc);

> where olWndProc is declared as WNDPROC. The above line is in OnCreate
> after CDialog::OnCreate but it doesn't work properly. The title bar is
> messed up, no title and root menu! I can't move the dialog window.

> Does anyone recognize this? Would be very grateful for any suggestions.
> By the way I have to do the subclassing this way, i am trying to
> integrate some old code with MFC.

> --
> Engin Zufer

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Tue, 07 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Subclassing a modeless CDialog inside a CFormView

2. Subclassing CDialog with ClassWizard

3. Q: SetWindowLong/GetWindowLong calls for ActiveX IE control

4. Help with SetWindowLong

5. SetWindowLong with DWL_MSGRESULT: what for???

6. SetWindowLong

7. SetWindowLong

8. changing list control styles -- SetWindowLong???

9. SetWindowLong not working

10. SetWindowLong and ES_NOHIDESEL

11. CDialog inside CDialog

12. CDialog::DoModal(), CDialog::EndDialog() Design Flaw

 

 
Powered by phpBB® Forum Software