c++ - NULL pointer during ATL Dialog WindowProc -



c++ - NULL pointer during ATL Dialog WindowProc -

i'm unfamiliar atl/win32 ui programming , i'm trying prepare access violation occurs when close atl dialog.

the main window has next message map:

begin_msg_map(cmywindow) message_handler(wm_close, onclose) message_handler(wm_destroy, ondestroy) command_id_handler(id_popup_exit, onexit) command_id_handler(id_popup_logon, onlogon) command_id_handler(id_popup_logoff, onlogoff) command_id_handler(id_popup_help, onhelp) command_id_handler(id_popup_about, onabout) command_id_handler(id_popup_datanetsettings, onconfigure) command_id_handler(id_popup_transferstatus, ontransferstatus) // etc...

ontransferstatus launches modal dialog:

lresult ontransferstatus(word /*wnotifycode*/, word wid, hwnd /*hwndctl*/, bool& /*bhandled*/) { hwnd hc; hc = findwindow(null, l"myapp transfer status"); if(hc) { ::showwindow(hc, sw_restore); ::setforegroundwindow(hc); } else { cstatuspopup dlg; dlg.domodal(); // <-- here

the cstatuspopup 1 of these: class cstatuspopup : public caxdialogimpl<cstatuspopup>{...}

when close statuspopup window, end in popup windows message map , function runs:

lresult onclose(uint umsg, wparam wparam, lparam lparam, bool& bhandled) { enddialog(idcancel); homecoming 0; }

enddialog should cleanly close downwards dialog window. appear getting null hwnd beingness passed dialog's windowproc. happens deep in atl/win32 code underneath blocking domodal call. can suggest how can debug message came passed null hwnd?

the crash here:

00000000`001de6f0 00000000`7741c3c1 : 00000000`00000000 00000000`00000000 00000000`0081d1d0 00000000`00000001 : myapp_tray!atl::cwindowimplbaset<wtl::ceditt<atl::cwindow>,atl::cwintraits<1442840576,0> >::windowproc+0x81 [c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlwin.h @ 3503] 00000000`001de790 00000000`7741a01b : 00000000`00000000 00000000`00330d20 00000000`00000000 00000000`00000000 : user32!usercallwinproccheckwow+0x1ad 00000000`001de850 00000000`7741a061 : 00000000`00000014 00000000`77412094 00000000`0081d1f8 0000002c`00000001 : user32!dispatchclientmessage+0xc3 00000000`001de8b0 00000000`776af5e5 : 00000000`00000000 00000000`00000000 00000000`776836a8 00000000`00000001 : user32!_fndword+0x2d 00000000`001de910 00000000`7740f5ba : 00000000`7742762b 00000000`000202cc 00000000`0081d1d0 00000000`00000001 : ntdll!kiusercallbackdispatchercontinue (trapframe @ 00000000`001de7d8) 00000000`001de998 00000000`7742762b : 00000000`000202cc 00000000`0081d1d0 00000000`00000001 00000000`00000001 : user32!zwuserdestroywindow+0xa 00000000`001de9a0 00000000`774274a5 : 00000000`000202cc 00000001`3f99b800 00000000`00000001 00000000`000202cc : user32!dialogbox2+0x2ec 00000000`001dea30 00000000`7742751a : 00000001`3fce5f00 00000000`000202cc 00000001`3f99b800 00000001`3f99b800 : user32!internaldialogbox+0x135 00000000`001dea90 00000000`77427558 : 00000000`00000000 00000001`3f980000 00000001`3fce5f00 00000000`000202cc : user32!dialogboxindirectparamaorw+0x58 00000000`001dead0 00000001`3f9a3d0b : 00000000`00000004 00000000`00000070 ffffffff`ffffffff 00000000`001dec30 : user32!dialogboxindirectparamw+0x18 00000000`001deb10 00000001`3f99aca2 : 00000000`00008026 00000000`001dec20 00000000`001dec90 00000000`00008026 : myapp_tray!atl::atlaxdialogcreatet<wchar_t const * __ptr64,atl::_atldialogboxindirectparamhelper,&dialogboxindirectparamw>+0xbb [c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlhost.h @ 2714] 00000000`001deb60 00000001`3f995b03 : 00000000`00000000 00000000`001df270 00000000`001dec90 00000000`001df270 : myapp_tray!atl::caxdialogimpl<cstatuspopup,atl::cwindow>::domodal+0x82 [c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlwin.h @ 4055] 00000000`001deb90 00000001`3f9ade73 : 00000000`00000000 00000000`001df270 00000000`001df168 000007ff`fffdd000 : myapp_tray!cdatanetwindow::processwindowmessage+0x293 [d:\buildroot\26\datanow\datanow_features_fr1\sources\orca\datanet_tray\mainwnd.h @ 40] 00000000`001df000 00000000`7741c3c1 : 00000000`00000000 00000000`00000000 00000000`001df2e0 00000000`00000001 : myapp_tray!atl::cwindowimplbaset<wtl::ceditt<atl::cwindow>,atl::cwintraits<1442840576,0> >::windowproc+0x83 [c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlwin.h @ 3508] 00000000`001df0a0 00000000`7741c60a : 00000000`001df2d0 00000000`00330fe0 00000000`01dae740 00000000`0083bf10 : user32!usercallwinproccheckwow+0x1ad 00000000`001df160 00000001`3f998236 : 00000001`3f9bada0 00000001`3f9bada0 00000000`00330fe0 00000000`00000000 : user32!dispatchmessageworker+0x3b5 00000000`001df1e0 00000001`3f9b22b6 : 00000000`00000001 00000000`00000000 00000000`00000000 00000000`776fdffa : myapp_tray!wwinmain+0x886 [d:\buildroot\26\datanow\datanow_features_fr1\sources\orca\datanet_tray\tray.cpp @ 356] 00000000`001df8b0 00000000`76f9f34d : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : myapp_tray!__tmaincrtstartup+0x166 [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c @ 547] 00000000`001df960 00000000`77692ca1 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!basethreadinitthunk+0xd 00000000`001df990 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!rtluserthreadstart+0x1d

and it's beingness caused because hwnd null in atl code:

template <class tbase, class twintraits> lresult callback cwindowimplbaset< tbase, twintraits >::windowproc( _in_ hwnd hwnd, _in_ uint umsg, _in_ wparam wparam, _in_ lparam lparam) { cwindowimplbaset< tbase, twintraits >* pthis = (cwindowimplbaset< tbase, twintraits >*)hwnd; // set ptr message , save old value _atl_msg msg(pthis->m_hwnd, umsg, wparam, lparam); const _atl_msg* poldmsg = pthis->m_pcurrentmsg; pthis->m_pcurrentmsg = &msg; // pass message map process lresult lres = 0; bool bret = pthis->processwindowmessage(pthis->m_hwnd, umsg, wparam, lparam, lres, 0);

c++ windows atl

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -