I'm trying to show a modeless dialog box containing an ActiveX control
developed in VB6 from a VC6-developed DLL export. When I call the Create
method of my CDialog-derived class, I get a "false" and the dialog box
never shows.
Here's some more information:
- The ActiveX control itself works. I tested it from a Microsoft
Access form.
- My dialog box is shown from a DLL statically linking to the MFC
DLL.
- The dialog box is created from an exported function.
- If I don't put the ActiveX control in my dialog box, the Create
call succeeds and I see my dialog box.
- If I put the ActiveX control in my dialog box (through the IDE's
dialog editor), the Create call fails and I don't get to see my dialog
box.
- I added the ActiveX control to the project and allowed the
ClassWizard to generate a wrapper class for it.
- I let ClassWizard add a data member to my dialog class of my
ActiveX wrapper class type.
What could I be doing wrong?
Thank you
Alexandre Côté
Alexandre,
You might need to call AfxOleInit().
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.
Hi David,
Where would you call this function? I tried calling it from my exported
function, before I instanciate my CDialog-derived class, and even though
AfxOleInit returned "false" (no error), my CDialog::Create returns with an
error and I still don't get to see my dialog box...
Maybe a few sniplets of code could expose what I obviously am doing wrong...
This is my exported function:
__declspec (dllexport) bool GeneratePDF (char const *MDBName, char const
*ReportName, char const *PDFName) {
AFX_MANAGE_STATE (AfxGetStaticModuleState ())
AfxOleInit ();
CDlg_AccessInterface AccessInterface (AfxGetApp ()->m_pActiveWnd);
AccessInterface.Create (AfxGetApp ()->m_pActiveWnd);
// ...
AccessInterface.DestroyWindow ();
return true;
};
As stated in the MSDN docs, I let the ClassWizard generate a CWinApp-derived
object, and I instanciate that object globally once.
Thanks
- Alex
Sorry Alex, I've given you the wrong function name - I think it should
be AfxEnableControlContainer.
- Alex