|
-
May 27th, 2009, 05:56 PM
#1
[RESOLVED] Unable to load dialog holding webbrowser control from MFC Dll
Hello guys;
I am having a problem trying to load a dialog (dialog was created using VC++ 6 Resource editor) that resides inside an MFC DLL. Why MFC? Well... there's the catch! Turns out I need this dialog to hold a MS WebBrowser ActiveX Control.
The second requirement is that the calling program is (and has to remain) a plain Win32 App, so, this app will call the DLL holding the dialog and will show a browser in it.
In order to make things easier, I developed a small class that encapsulates the DLL's functionallity. This part works fine, but I provide the code for it to explain myself better:
/////////////////////////////////////////////
class __declspec ( dllimport ) MyBrowser
{
public:
MyBrowser ();
virtual ~MyBrowser ();
BOOL Show ();
};
/////////////////////////////////////////////
The important part is actually the Show() method which I provide next:
//implementation of MyBrowser::Show() inside DLL
/////////////////////////////////////////////
BOOL MyBrowser::Show ()
{
AFX_MANAGE_STATE ( AfxGetStaticModuleState () );
CMyBrowserDlg dlg;
int res = dlg.DoModal ();
if ( res == IDOK )
{
}
else if ( res == IDCANCEL )
{
}
return FALSE;
}
/////////////////////////////////////////////
Nothing special but a simple call to the dialog's constructor (which is generated by the VC++ wizard) and then...dlg.DoModal() !!!!!
Turns out that the call to DoModal() fails (returns -1), but ONLY WHEN THE DIALOG HOLDS THE WEBBROWSER CONTROL!!!
When I take the control out, DoModal() doesn't fail and the dialog shows perfectly!
Please help me!
Thanks in advance!
Last edited by srmandrake; May 27th, 2009 at 06:04 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|