cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AJungen
Level 6

problems with LaunchAppAndWait

I have a basic MSI Installation and try to start a dialog, after it was installed.
But the LaunchAppAndWait has Problems to start the dialog.

The Dialog needs dll's wich are in a different directory.


szCurrent = INSTALLDIR^"dll";
szProgramm = INSTALLDIR^"exe"^"conws.exe";

LongPathToQuote(szProgramm,TRUE);
LongPathToQuote(szCurrent,TRUE);
ChangeDirectory ( szCurrent );

LAAW_PARAMETERS.lpCurrentDirectory = &szCurrent;
if (LaunchAppAndWait( szProgramm,
"",
LAAW_OPTION_WAIT |
LAAW_OPTION_NO_CHANGEDIRECTORY ) < 0) then


NumToStr( szResult, LAAW_PARAMETERS.nLaunchResult );
MessageBox ("Unable to launch configuration tool.\n" + szCurrent + "\n" + szProgramm + "\nResult: " + szResult,SEVERE);
endif;


nLaunchResult is 267

if i don't use LongPathToQuote the result is 740

Whats wrong ?


thx

Andreas
Labels (1)
0 Kudos
(2) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

A system error code of 267 is "The directory name is invalid."

Error code 740 is "The requested operation requires elevation."

If you are running on Windows Vista, have you tried using the LaunchApplication function instead (pass the LAAW_OPTION_USE_SHELLEXECUTE option and set LAAW_SHELLEXECUTEVERB="runas")?
0 Kudos
AJungen
Level 6

yes, i am running the installation on vista.

Now the installer starts the dialog, but he doesn't find the needed dll's from the working directory. (szCurrent)

I had to change the working Directory by myselft (ChangeDirectory)
Now it works.

But, is there a better solution ?




szCurrent = INSTALLDIR^"dll";
szProgram = INSTALLDIR^"exe"^"conws.exe";

if ( ChangeDirectory ( szCurrent ) < 0 ) then
MessageBox ("Unable to change directory.\n" + szCurrent ,SEVERE);
endif;

LongPathToQuote(szProgram,TRUE);
LongPathToQuote(szCurrent,TRUE);

szVerb = "runas";
LAAW_SHELLEXECUTEINFO.lpVerb = &szVerb;
LAAW_SHELLEXECUTEVERB=szVerb;


if ( LaunchApplication( szProgram,
"",
szCurrent,
SW_SHOW,
INFINITE,
LAAW_OPTION_WAIT | LAAW_OPTION_CHANGEDIRECTORY | LAAW_OPTION_USE_SHELLEXECUTE) < ISERR_SUCCESS) then
...



thx

Andreas
0 Kudos