Home All Groups Group Topic Archive Search About
Author
2 Feb 2007 7:51 AM
hufaunder@yahoo.com
I have an ActiveX component that I want to use in a library that I am
writing. As a first test I used the ActiveX component in a windows
form application. Adding the component created:

Ax[ActiveXName].dll
[ActiveXName].dll

I can not call the functions in the ActiveX component. In the next
step I tried to use the ActiveX component in a class library. I simply
added a reference to the corresponding COM component. This this only
[ActiveXName].dll was created. I assume this is ok because the
Ax...dll is just wrapping the component in a control (which I don't
need).

Now I have the following code:

ActiveXClassName class = new ActiveXClassName; //Note there is no Ax
in front of the class
class.DoSomething();

The second command produces and error: "COMException was unhandled.
Catastrphic failure (Exception from HRESULT:
0x8000FFFF(E_UNEXPECTED))"

I then added the following after instantiating the class:

((System.ComponentModel.ISupportInitialize)(class)).BeginInit();

This produces the error: "Unable to cast COM object of type 'xxx' to
interface type 'System.ComponentModel.ISupportInitialize'. This
operation failed because the QueryInterface call on the COM component
for the interface with IID '{CF793A55-B9DD-30C2-A484-360AF143C228}'
failed due to the following error: No such interface supported
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

So what do I need to do to use this ActiveX component in my class
library?

Thanks

Author
2 Feb 2007 2:17 PM
Patrick Steele
In article <1170402719.020557.302***@v33g2000cwv.googlegroups.com>,
hufaun***@yahoo.com says...
> I have an ActiveX component that I want to use in a library that I am
> writing. As a first test I used the ActiveX component in a windows
> form application. Adding the component created:
>
> Ax[ActiveXName].dll
> [ActiveXName].dll

This looks like an ActiveX control.  Is that what it is -- or is it an
ActiveX DLL?  Two different things.

> I can not call the functions in the ActiveX component.

Can you clarify that some more? 


> In the next
> step I tried to use the ActiveX component in a class library. I simply
> added a reference to the corresponding COM component. This this only
> [ActiveXName].dll was created. I assume this is ok because the
> Ax...dll is just wrapping the component in a control (which I don't
> need).

If I recall, you're going to have a difficult time using a wrapped
ActiveX control in a class library since an ActiveX control is usually
designed to be hosted on a windows form that has a standard windows
message pump running.  Without that message pump, the ActiveX control
will not work properly inside a class library.


Author
4 Feb 2007 3:20 PM
Alvin Bruney [MVP]
Have you registered the ActiveX object? You'll need to do so before it will
allow instantiation.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc


<hufaun***@yahoo.com> wrote in message
Show quote
news:1170402719.020557.302440@v33g2000cwv.googlegroups.com...
>I have an ActiveX component that I want to use in a library that I am
> writing. As a first test I used the ActiveX component in a windows
> form application. Adding the component created:
>
> Ax[ActiveXName].dll
> [ActiveXName].dll
>
> I can not call the functions in the ActiveX component. In the next
> step I tried to use the ActiveX component in a class library. I simply
> added a reference to the corresponding COM component. This this only
> [ActiveXName].dll was created. I assume this is ok because the
> Ax...dll is just wrapping the component in a control (which I don't
> need).
>
> Now I have the following code:
>
> ActiveXClassName class = new ActiveXClassName; //Note there is no Ax
> in front of the class
> class.DoSomething();
>
> The second command produces and error: "COMException was unhandled.
> Catastrphic failure (Exception from HRESULT:
> 0x8000FFFF(E_UNEXPECTED))"
>
> I then added the following after instantiating the class:
>
> ((System.ComponentModel.ISupportInitialize)(class)).BeginInit();
>
> This produces the error: "Unable to cast COM object of type 'xxx' to
> interface type 'System.ComponentModel.ISupportInitialize'. This
> operation failed because the QueryInterface call on the COM component
> for the interface with IID '{CF793A55-B9DD-30C2-A484-360AF143C228}'
> failed due to the following error: No such interface supported
> (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."
>
> So what do I need to do to use this ActiveX component in my class
> library?
>
> Thanks
>

AddThis Social Bookmark Button