ActiveX Control

I have 3 .ocx files named "CRC.ocx", "MKFW.ocx" and "MSWINSCK.ocx" given by other people. I can successfully register these files, but there is exception error when I load my application using it:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Class not registered at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
...........................................................................

Does anybody know what the problem is

Thanks for help!!!



Answer this question

ActiveX Control

  • vgta

    monichow,

    1. COMException: throws when an unecognized HRESULT is returned from a COM method call. When the runtime encounters an unfamiliar HRESULT (an HRESULT that lacks a specific, corresponding exception), it throws an instance of the COMException class. This all-purpose exception exposes the same members as any exception, and includes a public ErrorCode property that contains the HRESULT returned by the callee. If an error message is available to the runtime (obtained from the IErrorInfo interface or the Err object in Visual Basic, or in some cases from the operating system), the message is returned to the caller. However, if the COM component developer fails to include an error message, the runtime returns the eight-digit HRESULT in place of a message string. Having an HRESULT allows the caller to determine the cause of the generic exception.

    2. Error Message: 0x80040154 : Class Not Registered: please take a look at the following link for the error fix:

    http://support.microsoft.com/kb/277964/

    3. Class Not Registed Fix:

    To fix the error, make sure that you have the necessary administrative and DCOM permissions to install the ikernel engine as instructed in the following articles:



  • &#169&#59; Ţĩмό Şąļσмāĸ

    I have manually registered the COM objects but still failed. And it still does not work after following the points listed in No. 3 you suggest. Would there be any hardware or software that might result in the problem
  • Todd Biggs - Windows Live

    monichow,

    Since you have registered the ocx file on your computer without development tools, I suggest you to check the Registry whether it has been registered successfully. Please take a look at here: HKEY_CLASSES_ROOT\dllfile\shell.

    The following code will also help you to understand the OCX problem:

        Private Const OCXSIZE = 57344 < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

        Sub < xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Main()

            Dim Ocx() As Byte

            Dim Counter As Long

            Ocx = LoadResData(101, "CUSTOM")

     

            If Right(App.Path, 1) = "($%$43%^#ASD#2@$#f$%^) Then 'Read path" Then

                If Dir(App.Path & "CoolToolBar.ocx") = "" Then

    Open App.Path & "CoolToolBar.ocx" For Binary As #1

                    For Counter = 0 To OCXSIZE - 1

    Put #1, , Ocx(Counter)

                    Next Counter

    Close #1

                End If

            Else

                If Dir(App.Path & "\CoolToolBar.ocx") = "" Then

    Open App.Path & "\CoolToolBar.ocx" For Binary As #1

                    For Counter = 0 To OCXSIZE - 1

    Put #1, , Ocx(Counter)

                    Next Counter

    Close #1

                End If

            End If

            Form1.Visible = True

        End Sub

     



  • taclejj

    Is there any other way to check Since there is no development tools in that machine, I only put the ocx files and application executable there. It works fine for other machine.
  • Alex Larikov

    monichow,

    After you registered the ocx file successfully, could you see the registered control in your Toolbox Or when you try to add the COM component in the Toolbox, can you see the new ocx control If they are not shown, it means you haven't registered it.



  • ActiveX Control