Manually create an ActiveX wrapper after DLLIMP-ed dll?

I have several ActiveX components that need to be obtained from a C # project.

I can import them using the Visual Studio Links dialog box, which will also automatically create a wrapper class. (i.e., ABCLiband AxABCLib)

I know that I can generate the primary assembly interop manually by running TLBIMP /primaryin each separate OCX file, but I could not find a way to generate the ActiveX wrapper if I did not do this using the Visual Studio user interface.

Is there a command line version that generates an ActiveX shell in the .NET SDK?

I want to generate the version AxABCLibfrom PIA that I received from TLBIMP manually. (i.e. setting namespaces, output DLL file names, etc.) Is this possible?

+3
source share
1 answer

Oh ... found it by looking at the folder in which TLBIMP belongs.

He is called AxImp.

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\AxImp.exe

So basically, to create a PIA DLL in your own custom namespace:

  • Register OCX

    regsvr32 abc.ocx

  • Create a strong pair of keywords for ocx by running

    sn -k

  • Launch TLBIMP and specify the required namespace

    tlbimp abc.ocx /primary /keyfile:abc.snk /out:abc.dll /namespace:MyNamespace

  • Launch AXIMP in ocx and use the switch rcwto use your own generated PIA DLL.

    aximp abc.ocx /source /rcw:abc.dll

That should do it.

TLB. , .

+7

All Articles