|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ActiveX in DLLwriting. 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 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 This looks like an ActiveX control. Is that what it is -- or is it an > writing. As a first test I used the ActiveX component in a windows > form application. Adding the component created: > > Ax[ActiveXName].dll > [ActiveXName].dll ActiveX DLL? Two different things. > I can not call the functions in the ActiveX component. Can you clarify that some more? > In the next If I recall, you're going to have a difficult time using a wrapped > 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). 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. Have you registered the ActiveX object? You'll need to do so before it will
allow instantiation. -- Show quoteRegards, 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 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 > |
|||||||||||||||||||||||