This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: LaunchAppandWaitError
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 10, 2009
02:34 PM
LaunchAppandWaitError
I have an InstallShield 2009 InstallScript project. I have the following code to launch an external .msi program. It does not work. When I call GetLastError it returns 0.
When I run the szProgram line ( msiexe /a "c:\temp\setup.msi" )in a command window it works fine.
I've tried it with the LongPathToQuote line and without it - same result.
strDir = "C:\\temp";
szProgram = "msiexe /a \''" + strDir + "\\setup.msi\"";
LongPathToQuote(szProgram, TRUE);
if(LaunchAppAndWait(szProgram, "", LAAW_OPTION_USE_SHELLEXECUTE | nWait) < 0) then
nErrorCode = GetLastError();
NumToStr(strError, nErrorCode);
MessageBox(strError, WARNING);
else
MessageBoxs("success", OK);
endif;
Any ideas why this doesn't work from within an InstallScript project?
Thanks. :confused:
When I run the szProgram line ( msiexe /a "c:\temp\setup.msi" )in a command window it works fine.
I've tried it with the LongPathToQuote line and without it - same result.
strDir = "C:\\temp";
szProgram = "msiexe /a \''" + strDir + "\\setup.msi\"";
LongPathToQuote(szProgram, TRUE);
if(LaunchAppAndWait(szProgram, "", LAAW_OPTION_USE_SHELLEXECUTE | nWait) < 0) then
nErrorCode = GetLastError();
NumToStr(strError, nErrorCode);
MessageBox(strError, WARNING);
else
MessageBoxs("success", OK);
endif;
Any ideas why this doesn't work from within an InstallScript project?
Thanks. :confused:
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 10, 2009
06:11 PM
A couple of things: perhaps use WINSYSDIR^"msiexec.exe" as the first argument to LaunchAppAndWait, and "/i ...Productname.msi" as the second? (Was the "/a" switch---which performs an administrative installation, which isn't the same as a "real" installation---intentional?)
Otherwise, what is or isn't happening?
Otherwise, what is or isn't happening?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 11, 2009
06:59 AM
Hi - thanks for your suggestions, unfortunately they did not work (used WINSYSDIR and /i). The reason I am using "/a" as the second argurment is due to a post I found online about running an msi package on Vista. My InstallScript project runs some 3rd party self-extracting zip files and then a windows installer that someone else wrote. The windows installer throws an error when run on Vista (runs fine on XP) when the exe calls the msi. The post suggested using msiexec to run the msi and said the /a would be necessary due to UAC on Vista.
So, what is happening is, I get the MessageBox that tells me GetLastError() returned 0 and the install goes to my next line of. Maybe I am using GetLastError() incorrectly?
At the top of my setup.rul file I have
prototype number Kernel32.GetLastError()
And then just call it with nErrorCode = GetLastError().
I am testing the call on an XP machine before I move the install to the Vista machine. Typing the command in a command window works on Vista just as it does on XP.
Thanks so much.
So, what is happening is, I get the MessageBox that tells me GetLastError() returned 0 and the install goes to my next line of. Maybe I am using GetLastError() incorrectly?
At the top of my setup.rul file I have
prototype number Kernel32.GetLastError()
And then just call it with nErrorCode = GetLastError().
I am testing the call on an XP machine before I move the install to the Vista machine. Typing the command in a command window works on Vista just as it does on XP.
Thanks so much.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 11, 2009
03:01 PM
To get the launch result error code for LaunchApplication/LaunchAppAndWait, use LAAW_PARAMETERS.nLaunchResult. This should provide the error code indicating why CreateProcess failed to launch msiexec.exe. (Using GetLastError doesn't work as expected because there are other calls to Win32 after CreateProcess is called that overwrite the last error value, which is why InstallScript sets the nLaunchResult value).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 12, 2009
09:21 AM
Hello again,
I am not checking the laaw_parameters.nLaunchResult error and it is returning a 2. I've looked around and have yet to find out what the 2 indicates.
Where can I look for descriptions of the numeric error codes?
Thanks again.
I am not checking the laaw_parameters.nLaunchResult error and it is returning a 2. I've looked around and have yet to find out what the 2 indicates.
Where can I look for descriptions of the numeric error codes?
Thanks again.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 12, 2009
02:55 PM
The error codes set in the launch result are Windows system error codes. Error code 2 is "The system cannot find the file specified."
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 12, 2009
03:18 PM
OK thank you! That explains that problem.