Link to home
Start Free TrialLog in
Avatar of nixonc
nixonc

asked on

Using a ActiveX Control in a DLL

I am new for VC++. I am currently writing a DLL which will in turn invoke the function of ActiveX control.

I create a MFC AppWizard (dll) project and add the reference of the activeX Control. It compiled OK.
I write a simple console program to test it. I seem OK to load the dll. However, when I try to invoke the function of the ActiveX Control. I got error.


void CWnd::GetProperty(DISPID dwDispID, VARTYPE vtProp,
     void* pvProp) const
{
     ASSERT(m_pCtrlSite != NULL);    // not an OLE control (not yet, at least)
....
}

It got error on the first ASSERT statement of the winocc.cpp file. I don't know what is going on. I do call the AfxEnableControlContainer(); already.

Do I miss anything?

Avatar of ambience
ambience
Flag of Pakistan image

possibly a lot, how are you instantiating the control?
Avatar of jimbucci
jimbucci

An ActiveX control requires a window to draw itself - the client site.  Is your dll itself an ActiveX control?
Are you actually trying to display the wrapped control using your dll?  
The MFC ActiveX control wizard can create a container control which allows you to wrap a control into your control.  It is a pain to implement though.
I suggest creating an ATL composite control and pulling the ActiveX control into it.
I can provide code suggestions since I've done this and it works great.  There are a few caveats so the response would be lengthy.  Let me know if this would help you.
Jim
 
Avatar of nixonc

ASKER

I just declare the control inside the application object which inherite from CWinApp. My dll itself is not an ActiveX control. I not trying to display any thing. Is there a different windowed control and windowless control.

Here are the story. We are developing an application which try to control different brand of digital camera. We try to standardize the interface between the application and the digital camera. SDK from Nikon have been wrapped into a dll easily since it provide all the source code. However, the SDK from Olympus is an ActiveX control.  So I have to wrapped the ActiveX Control into DLL as well.

All I need is a DLL which can invoke the ActiveX function.
What kind of project should I create? Any suggestion?
Can ATL composite control can do?
ASKER CERTIFIED SOLUTION
Avatar of jimbucci
jimbucci

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
Dear nixonc

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "jimbucci"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner