locked
COM Exception thrown by an OCX control RRS feed

  • Question

  • We are porting all of our project to support 64-bit platforms. All the OCX controls are migrated to target 64-bit. However, I see this error

    ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))

    when I use an AxInterop for the OCX control and invoke EndInit() on it in the InitializeComponent() of the winForm. The same control is also utilized in many other WinForm applications where I do not see this particular issue. So, I am guessing its not an issue with the control as such.

    However, I observed a rather odd behavior with the form. There are two different OCX controls. One control is added twice(as in with two different names) and the second control is added only once. So, if I remove any one of these from the form or comment it out, I do not observe this exception anymore.

    I have tried re-registering the control, regenerating Interops, however, that hasn't helped till now.

    • Moved by CoolDadTx Friday, September 9, 2016 2:59 PM Winforms related
    Friday, September 9, 2016 11:11 AM

Answers

  • add some code to record the time before and after the creation of activex. run procmon and start debug. filter out all the noise in procmon based on the time you recorded. See what files are involved in the ActiveX's creation. 

    I suspect you are having some dll hell issue, and the version of the ActiveX registered on your system is lower than the type library referenced in your project. 



    Visual C++ MVP

    Friday, September 9, 2016 5:00 PM