15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Deriving from a CDialog derived class (IYSWIM)

Jeff Eldridge -- jeldridge@cix.compulink.co.uk
Thursday, April 11, 1996


Environment: NT3.51 (SP4) VC4.0 MFC4.0

I'm have written a class (CStandardDialog) which derives from CDialog. 
CStandardDialog receives a couples of message (WM_CTLCOLOR and 
WM_CTLCOLORDLG) to enforce a standard look to my apps dialogs. All 
dialogs is my app derive from CStandardDialog.

I would've thought that messages are sent to CWnd which passes them onto 
CDialog. Anything that isn't processed by CDialog would goto my 
CStandardDialog and anything that doesn't process goes to the final 
dialog class. I hope thats clear.

Well, that doesn't seem to be happening. I've placed breakpoints in 
CStandardDialog's message handlers for WM_CTLCOLOR* but nothing ever gets 
there.

Is my supposition right? Have I forgotten to do anything?

Jeff




Darius Thabit -- darius@world.std.com
Sunday, April 14, 1996

[Mini-digest: 2 responses]

> I'm have written a class (CStandardDialog) which derives from CDialog. 
> CStandardDialog receives a couples of message (WM_CTLCOLOR and 
> WM_CTLCOLORDLG) to enforce a standard look to my apps dialogs. All 
> dialogs is my app derive from CStandardDialog.

   I did the same thing, it's very useful.
 
> I would've thought that messages are sent to CWnd which passes them onto 
> CDialog. Anything that isn't processed by CDialog would goto my 
> CStandardDialog and anything that doesn't process goes to the final 

   Well in effect it's the other way around: anything that isn't handled in 
_your_ dialog class gets passed down to CDialog or the next highest class 
with a handler (a more complete view would note that calls first get bounced 
up from the original receiving class to the highest class which has a 
handler).

> Well, that doesn't seem to be happening. I've placed breakpoints in 
> CStandardDialog's message handlers for WM_CTLCOLOR* but nothing ever gets

   All I can think of is that you did use ClassWizard to defined these, 
right?  There should be declarations for these inside the AFX_MSG and 
AFX_MSG_MAP macros (in the header and source file respectively).

-----From: Niels Ull Jacobsen 

>I would've thought that messages are sent to CWnd which passes them onto 
>CDialog. Anything that isn't processed by CDialog would goto my 
>CStandardDialog and anything that doesn't process goes to the final 
>dialog class. I hope thats clear.

Actually, it is the other way around. First CStandardDialog gets a crack at
them, the CDialog, then CWnd.

>
>Well, that doesn't seem to be happening. I've placed breakpoints in 
>CStandardDialog's message handlers for WM_CTLCOLOR* but nothing ever gets 
>there.

Have you used Spy++ to ensure that the messages are actually sent? 
Have you set a breakpoint "at AfxWndProc when WM_CTLCOLOR* is recieved" ?


>
>Is my supposition right? Have I forgotten to do anything?
>
>Jeff
>
Niels Ull Jacobsen, Krьger A/S (nuj@kruger.dk)
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger group
and should be taken as legally binding in every respect. Pigs will grow
wings and fly.




| Вернуться в корень Архива |