Click here to Skip to main content
16,015,274 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

This code fail

AfxMessageBox(_T("Test"));

Because it does not receive the focus.

I have a modal CDialog


When i press "Esc KEY" closes the modal dialog


thank you very much
Posted
Comments
Eugen Podsypalnikov 20-Aug-10 4:10am    
Are the dialog and box in the same thread (from where will AfxMessageBox(..) be called) ? :)

I solved the problem. I changed it

lr = pMsgHook->WindowProc(msg, wp, lp);

for this one

lr = CallWindowProc( pOldWndProc, hwnd, msg, wp, lp);

and it works perfectly

thx u
 
Share this answer
 
I am using

"EZSkin - A Primitive Framework for building skinnable apps" EZSkin - A Primitive Framework for building skinnable apps[^]

It seems that the problem is this code "EZSkin" declare a HookProcedure

pMsgHook->m_pOldWndProc =
(WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)HookWndProc);

I am reading this article

http://xfgr.com/?u=pz1z8ocodeprojectb0iczvKBczvcppczvdMsgBoxz6axx3nPageFlowx1wFluid[^]

to understand how it works



if you declare a class derived from CDialog AfxMessageBox not fail and it has the focus, if you declare a class derived from cezdialog AfxMessageBox fail and it hasnt the focus
 
Share this answer
 
Comments
Eugen Podsypalnikov 20-Aug-10 4:24am    
OK... :) Try to replace the AfxMessageBox(..) by a ::MessageBox(hParenWnd, ...) where the hParentWnd is handle to the "cezdialof" window :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900