views:

280

answers:

2

I need to register an ActiveX exe programmatically and Shell(SomeActiveX.Exe /regserver) is not sufficient. Is anyone aware of an API equivalent?

+1  A: 

You can use DllRegisterServer to register a COM component programatically, if it's an in-process com object. Here is a VB6 example on MSDN.

To register an out of process COM object, things get tricky. See Exposing ActiveX Objects. The Hello Sample shows some of the options. Larry Osterman blogged about this for background info.

In general, if you need to do this to an EXE, shelling out to *.EXE /regserver will be much easier.

Reed Copsey
I may be handling something incorrectly, but I thought DLLRegisterServer could only be used for DLL and OCX?
cmsjr
Wow, if that's as good as it gets, I better get my refactor hat out. Thanks for the resources.
cmsjr
A: 

You could try using regsvr32 also. This should be sufficient:

Shell(SomeActiveX.Exe /regserver)
Shell(regsvr32 SomeActiveX.Exe)
zoidbeck
Regsvr32 doesn't work with ActiveX Exe's. In this particular case I can't use Shell.
cmsjr