Registration of .ocx
Hi all,
I have this .ocx file, which needs to be registered, there is a batch file which contains the regsvr32 to register the file, and also a batch file to un register. I can drop those files through deployment tool and run the batch file for registeration. But the client wants me to do this through MSI. I have no idea, how to do the custom actions through MSI installshield to do the registeration.
Can anyone please guide me with this.
Thanks
Answers (7)
Include the file in your MSi and create a VBS that uses regsvr32.exe to register the .ocx.
To register DLL and/or OCX during install process and unregister them during uninstall process:
- create an MSI by capturing file copy on target computer (if needed)
- edit this MSI with your favorite editor
To register:
- create a custom action (vbs stored in custom action) named "registerdll" (or anything else you like ;-)
- In custom action's properties, set "Install Exec Sequence" to "After InstallFinalize" (quotes not needed)
- In custom action's properties, set "Install Exec Condition" to "REMOVE<>"ALL"" (quotes for "ALL" needed)
- use this script to register dll or ocx:
Option explicit
Dim Wshshell
Set WshShell = CreateObject("WScript.Shell")
Wshshell.run "regsvr32.exe /S " & chr(34) & "path-to-your-file" & chr(34),1,true
... add here as many lines as files to register...
To unregister:
- create a custom action (vbs stored in custom action) named "Unregisterdll" (or anything else you like ;-)
- In custom action's properties, set "Install Exec Sequence" to "<First Action>" (files must be unregistered before to be removed)
- In custom action's properties, set "Install Exec Condition" to "REMOVE="ALL"" (quotes for "ALL" needed)
- use this script to unregister dll or ocx:
Option explicit
Dim Wshshell
Set WshShell = CreateObject("WScript.Shell")
Wshshell.run "regsvr32.exe /U /S " & chr(34) & "path-to-your-file" & chr(34),1,true
... add here as many lines as files to unregister..
Enjoy
A.Ni
>Now create a component in the MSI as <FileName> and include the File.ocx and File.reg and you are good to go.
No, do NOT include the .REG as a file in the project. Import the .REG instead so that the relevant advertising tables get populated.
Do not be tempted to execute RegSvr32 to register the OCX, either. Do the job properly and use the advertising tables.
You can perform a capture during the original .ocx installation. This will ensure that the plugin references are included in the package.
Comments:
-
I think it would not be a good idea to capture a MSI if its a vendor MSI. - akki 12 years ago
http://www.symantec.com/connect/blogs/how-manually-register-dll-msi
Here are essentially the steps, they will be almost identicall in installshield.
If you use WISE you can use WiseComCapture.exe present in Wise Install Editor folder.
Pass this command:
WiseComCapture.exe /r "path to dll" "path to reg file"
ex. WiseComCapture.exe /r "c:\File.ocx" "C:\File.reg"
Now create a component in the MSI as <FileName> and include the File.ocx and File.reg and you are good to go.
Im not aware of how to do it using InstallShield though.
Else you can find that OCX file(as a merge module) on net and include it in your package.
Hope it helps.
But if you are looking for Custom Action only, then you could include the file in your MSi and create a VBS that uses regsvr32.exe to register the .OCX. To create a custom action follow these steps:
- In an InstallShield Basic MSI project, right-click on the Custom Actions root node and choose Custom Action Wizard. The Custom Action Wizard is displayed
- Click Next. The Basic Information Panel is displayed.
- Enter the name of your custom action in the Name field. Click Next.
- The Action Type panel is displayed. Select Run VBScript code from the Type list.
- Select Stored directly in the custom action from the Location list. Click Next. The In-Sequence Scripts panel is displayed.
- Copy and paste your VBScript into the field provided.Click Next. The Additional Options panel is displayed.
- Select the Deferred execution in System context option from the In-Script Execution list. Click Next. The Insert into Sequence panel is displayed.
- Select After InstallFile from the Install UI Sequence list. Click Next. The Summary panel is displayed. Click Finish
Comments:
-
If I have to uninstall or unregister , do I have to follow the similar method.. How do I have to go about with that. - shamu99 12 years ago