Link to home
Start Free TrialLog in
Avatar of pgiusto
pgiusto

asked on

Using an ActiveX control from a DLL

I have made an MFC DLL, using the Application Wizard.
In that DLL I inserted a dialog, with some common controls and and ActiveX control (a better grid than the one provided by Microsoft).

The problem arises when I call the function that creates the dialog. Apparently the DoModal method fails because of the ActiveX control (if the dialog doesn't have the ActiveX control there is no problem).

As when I use ActiveX control in other applications (.EXE) I inserted this line in the InitInstance member of the DLL.

AfxEnableControlContainer();

Also, I inserted this line in the exported function of the DLL that creates the dialog:

AFX_MANAGE_STATE(AfxGetStaticModuleState());

I think that there is a function call or something that is missing, but I can't find any examples about using an ActiveX control from a DLL.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pgiusto
pgiusto

ASKER

Yes, while expecting for a comment, y read in the MSDN about using AfxOleInit() in the dll, but it doesn't work.

Should I tried using AfxOleInit() in the application (.exe)
Hi!
is your control registered in the system?
Avatar of pgiusto

ASKER

OK. I tried calling the function from the exe instead from the dll and it's work.

Thanks a lot.