?
Solved

How do I Shell() Windows Installer (.msi file) from Visual basic

Posted on 2003-03-09
3
Medium Priority
?
521 Views
Last Modified: 2013-11-25
I'm trying to Shell a custom MSI file from within Visual Basic but it seems to result in an error, the code I've tried includes the basic:

Shell(App.Path & "\Customer.MSI")

and the ShellExecute Function:

Public Sub RunShellExecute(sTopic As String, _
                           sFile As Variant, _
                           sParams As Variant, _
                           sDirectory As Variant, _
                           nShowCmd As Long)

   Dim hWndDesk As Long
   Dim success As Long
 
   hWndDesk = GetDesktopWindow()
 
   success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)

End Sub

Although both methods work with standard .EXE files, neither seems to work with a .MSI file.

Any thoughts would be greatly appreciated!
0
Comment
Question by:Tadis
3 Comments
 
LVL 1

Accepted Solution

by:
hj2k3 earned 300 total points
ID: 8098603
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


ShellExecute Me.hwnd, "Install", "Whatever.msi", "", "", 0

...although it might not be 'Install' on different languages... not sure how to get the default action

hope this helps
0
 

Expert Comment

by:CleanupPing
ID: 8900452
Tadis:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9074516
Moderator, my recommended disposition is:

    Accept hj2k3's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question