CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2000
    Location
    China
    Posts
    16

    If an ActiveX control is not registered, how to run a program with it?

    When I develop a program with an ActiveX control, I can run it in my own PC well. However, in another PC with this ActiveX control not registered, I cannot run it correctly, since I cannot see the ActiveX control where it should be.
    Would you please help me? Thanks in advance.


  2. #2
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658

    Re: If an ActiveX control is not registered, how to run a program with it?

    You can't run the program with unregistered ActiveX. Use regsvr32 myactx.ocx to register it before.

    Rating isn't important...But gurus respect it and keep high

  3. #3
    Join Date
    Aug 2000
    Location
    China
    Posts
    16

    Re: If an ActiveX control is not registered, how to run a program with it?

    Thanks. But I would like to know how my software user runs the program, because I don't expect him to register the associated ActiveX control before he begin to use the software.


  4. #4
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658

    Re: If an ActiveX control is not registered, how to run a program with it?

    It means, that you have to use your ActiveX via COM server way. CoInitialize, CoCreateInstance, etc...

    Rating isn't important...But gurus respect it and keep high

  5. #5
    Join Date
    Dec 2000
    Posts
    115

    Re: If an ActiveX control is not registered, how to run a program with it?

    Try this:


    HINSTANCE h = LoadLibrary( "xxxxxx.DLL" );
    if ( h == NULL )
    {
    AfxMessageBox( "unable to load 'xxxxxx.DLL'." );
    return;
    }

    typedef int ( *REG ) ( void );
    REG f_reg = ( REG ) GetProcAddress( h , "DllRegisterServer" );

    if ( f_reg == NULL )
    {
    FreeLibrary( h );
    AfxMessageBox( "unable to load 'DllRegisterServer' in 'xxxxxxx.DLL'." );
    return;
    }

    f_reg();

    FreeLibrary( h );


    crux

  6. #6
    Join Date
    Aug 2000
    Location
    China
    Posts
    16

    Re: If an ActiveX control is not registered, how to run a program with it?

    I think you have solved my problem. Thank you very much.


  7. #7
    Join Date
    May 2009
    Posts
    1

    Re: If an ActiveX control is not registered, how to run a program with it?

    Hello,
    i have the same problem with the activex control. In my program I used the same code for registering the control files, but the return value of LoadLibrary() was always NULL. I have administrator access on the pc. Any advices how to solve the problem?
    Thanks in advance,
    L

  8. #8
    Join Date
    Feb 2002
    Posts
    4,640

    Re: If an ActiveX control is not registered, how to run a program with it?

    Well, the MSDN says to call GetLastError to find out why the function returned NULL.

    Viggy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured