I am working in a project where in a dialog is called from a cs project.
This dialog is in dll (vc project).the dialog's handle is null, due to this i am unable to launch the dialog.
Code:
AFX_MANAGE_STATE(AfxGetStaticModuleState())
CFDialog dlg;
int responce = dlg.DoModal();
the dlg handle is NULL(i debugged the Application and found) and the application crashes;
dialog window is created within the DoModal call and destroyed just before DoModal returns. So dialog handle exists only between these two "events" and you cannot access it using the code you showed.
Why do you need the dialog handle?
Where exactly and how does your application crash?
[code]
AFX_MANAGE_STATE(AfxGetStaticModuleState())
CFDialog dlg;
int responce = dlg.DoModal(); //it fails here and i am unable to launch dialog.
[\code]
The dialog seems failing to create. Which means either dialog resource is wrong/unreachable or the dialog contains common controls while common controls library appears not initialized to he moment of dialog creation. These two are the most frequent reasons of DoModal failure.
I would suggest to call the dll in debug mode from trivial C++ client and go through dialog creation step by step. Hope you have MFC sources installed along with your Visual Studio.
[code]
AFX_MANAGE_STATE(AfxGetStaticModuleState())
CFDialog dlg;
int responce = dlg.DoModal(); //it fails here and i am unable to launch dialog.
[\code]
i have attached the screen shot.
I would expect this. The dialog window is not created until you call the "DoModal" function. IIRC, nothing much happens in the CDialog constructor. Your picture shows the state of the dialog instance after the constructor has been called.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.