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

Answer Summary:
Include the file in your MSi and create a VBS that uses regsvr32.exe to register the .ocx.
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

3

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 

Answered 05/23/2012 by: A.Ni
Senior Yellow Belt

Please log in to comment

Answers

1

>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.

Answered 05/13/2012 by: VBScab
Red Belt

Please log in to comment
0

You can perform a capture during the original .ocx installation. This will ensure that the plugin references are included in the package.

Answered 05/11/2012 by: adilrathore
Fourth Degree Black Belt

  • I think it would not be a good idea to capture a MSI if its a vendor MSI.
Please log in to comment
0

http://www.symantec.com/connect/blogs/how-manually-register-dll-msi

Here are essentially the steps, they will be almost identicall in installshield.

Answered 05/11/2012 by: GAKIS
Second Degree Green Belt

Please log in to comment
0

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.

Answered 05/11/2012 by: akki
Fourth Degree Black Belt

Please log in to comment
0

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:

  1. 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
  2. Click Next. The Basic Information Panel is displayed.
  3. Enter the name of your custom action in the Name field. Click Next.
  4. The Action Type panel is displayed. Select Run VBScript code from the Type list.
  5. Select Stored directly in the custom action from the Location list. Click Next. The In-Sequence Scripts panel is displayed.
  6. Copy and paste your VBScript into the field provided.Click Next. The Additional Options panel is displayed.
  7. Select the Deferred execution in System context option from the In-Script Execution list. Click Next. The Insert into Sequence panel is displayed.
  8. Select After InstallFile from the Install UI Sequence list. Click Next. The Summary panel is displayed. Click Finish
Answered 05/11/2012 by: akki
Fourth Degree Black Belt

  • If I have to uninstall or unregister , do I have to follow the similar method.. How do I have to go about with that.
Please log in to comment
0

If I have to uninstall or unregister , do I have to follow the similar method.. How do I have to go about with that.

Answered 05/15/2012 by: shamu99
Fifth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity