How to create a dialog dynamicly and show it in a dll?
-
i tried some times but all failed.my codes below: ================================ CInstDllApp theApp; CWaitDlg *m_waitdlg=NULL; extern "C" __declspec(dllexport) int SDUnloadDriver() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); AfxSetResourceHandle(theApp.m_hInstance); int res; if (m_waitdlg==NULL) { m_waitdlg=new CWaitDlg; m_waitdlg->Create(IDD_DIALOG,NULL); m_waitdlg->ShowWindow(SW_SHOW); } else { m_waitdlg->ShowWindow(SW_SHOW); } AfxSetResourceHandle(AfxGetInstanceHandle()); Sleep(1000); if (m_waitdlg!=NULL) { m_waitdlg->DestroyWindow(); delete [] m_waitdlg; m_waitdlg=NULL; } return res; } in this code i can created the dialog,and show the dialog without the controls on the dialog,and can not drag the dialog,maybe without message deal,how to solve this problem? thanks
-
i tried some times but all failed.my codes below: ================================ CInstDllApp theApp; CWaitDlg *m_waitdlg=NULL; extern "C" __declspec(dllexport) int SDUnloadDriver() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); AfxSetResourceHandle(theApp.m_hInstance); int res; if (m_waitdlg==NULL) { m_waitdlg=new CWaitDlg; m_waitdlg->Create(IDD_DIALOG,NULL); m_waitdlg->ShowWindow(SW_SHOW); } else { m_waitdlg->ShowWindow(SW_SHOW); } AfxSetResourceHandle(AfxGetInstanceHandle()); Sleep(1000); if (m_waitdlg!=NULL) { m_waitdlg->DestroyWindow(); delete [] m_waitdlg; m_waitdlg=NULL; } return res; } in this code i can created the dialog,and show the dialog without the controls on the dialog,and can not drag the dialog,maybe without message deal,how to solve this problem? thanks
m_waitdlg->ShowWindow(SW_SHOW); } AfxSetResourceHandle(AfxGetInstanceHandle()); -- There is no message processing loop here at all... Sleep(1000); -- There is no message processing loop here at all... if (m_waitdlg!=NULL) { m_waitdlg->DestroyWindow(); Because the thread showing the window, presumably the only thread in program, is not processing messages.
-
m_waitdlg->ShowWindow(SW_SHOW); } AfxSetResourceHandle(AfxGetInstanceHandle()); -- There is no message processing loop here at all... Sleep(1000); -- There is no message processing loop here at all... if (m_waitdlg!=NULL) { m_waitdlg->DestroyWindow(); Because the thread showing the window, presumably the only thread in program, is not processing messages.
i know,but how to solve this problem,i do not know how to do this? thanks,can you give me some sample code or articles? best regards