none
An error attempting to create a reference to a COM object RRS feed

  • Question

  • Hello, All!

    I am trying to create a MFC application, which will expose some methods through COM. There is a small MFC project with an automation-enabled class and a method, which I have created for testing purpose. The project compiles fine and I can see the COM server, the class, and the method in the Object Browser. I also can add a reference to it in my VB project and see all its classes, interfaces and methods in the Class View. All this is also available at design time (IntelliSence sees it perfectly). But I get an error attempting to get a reference to its class, both by CreateObject function in VB\VBS and "New" keyword in VB. COMException 80040154. There is a lot of topics on MSDN forums with references to this error, but none of them is exactly my case. (In my case it is an .exe file and attempts to register the component with regsvr32 do not work...)

    Thanks for your help in advance!


    Shakin Alexey

    Wednesday, February 11, 2015 1:19 PM

Answers

  • On 2/11/2015 8:19 AM, "Shakin Alexey" wrote:
    (In my case it is an .exe file and attempts to register the component with regsvr32 do not work...)

    You register an EXE COM server by running it with /RegServer option.


    Igor Tandetnik
    Wednesday, February 11, 2015 1:33 PM
  • From the error, it is more likely you com dll is not registered. Please check this: COM error code list

    https://msdn.microsoft.com/en-us/library/windows/desktop/dd542643(v=vs.85).aspx

    REGDB_E_CLASSNOTREG

    0x80040154 Class not registered



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 13, 2015 11:13 AM
    Moderator

All replies

  • On 2/11/2015 8:19 AM, "Shakin Alexey" wrote:
    (In my case it is an .exe file and attempts to register the component with regsvr32 do not work...)

    You register an EXE COM server by running it with /RegServer option.


    Igor Tandetnik
    Wednesday, February 11, 2015 1:33 PM

  • You register an EXE COM server by running it with /RegServer option.


    Igor Tandetnik
    It fails with incorrect option error message (on Vista). And is not the COM server registered after it is compiled in VS? As I said, I can see it and its classes in Object Browser...

    Shakin Alexey

    Thursday, February 12, 2015 6:10 AM
  • From the error, it is more likely you com dll is not registered. Please check this: COM error code list

    https://msdn.microsoft.com/en-us/library/windows/desktop/dd542643(v=vs.85).aspx

    REGDB_E_CLASSNOTREG

    0x80040154 Class not registered



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 13, 2015 11:13 AM
    Moderator