MFC-DLL State

I created an MFC DLL which will be launched on a thread from a Driver. The Window of the DLL is made Modal by using RunModalLoop().

But the following chunk of code is giving Access Violation

CMainFrm::OnClose()
{
  //My Processing
  EndModalLoop(0);
  CFrameWnd::OnClose()
}

The access violation is due to the DestroyWindow() in       CFrameWnd::OnClose(). The function ContinueModal is failing because the MainFrame exists no more.

Can anyone help me?
ysbhushanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Andy_KeysConnect With a Mentor Commented:
I assume you tried swapping the lines of code!
i.e. CFrame::OnClose(); before EndModalLoop(0);
0
 
Andy_KeysCommented:
Sorry, Should have posted this as a comment not an answer
0
All Courses

From novice to tech pro — start learning today.