FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Shellexecute(), Waitrun(), Winexec() - solved
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Shellexecute(), Waitrun(), Winexec() - solved
Posted: Wed Oct 20, 2010 02:11 PM
Hello,

I need to run a MSI-file (Microsoft Installer) from my application and I want my application to wait until the installation has been finished.

Waitrun() and Winexec() cannot be used since they don't work with a MSI-file.

So I try to use ShellExecute()

This is the code :
Code (fw): Select all Collapse
ShellExecute(,"Open","MSXML.MSI",,,3)
SYSWAIT(5)
DO WHILE .T.
   hFile := FOPEN("MSXML"+IF(IsWin7(),"6","4")+".MSI",FO_READWRITE + FO_EXCLUSIVE)
   IF FERROR() <> 0
      SYSREFRESH()
      SLEEP(1)
      LOOP
   ENDIF
   FCLOSE(hFile)
   EXIT
   SYSREFRESH()
ENDDO

Unfortunately, my application doesn't wait until the installation has been finished.

How can I solve this problem?

Thanks you.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 02:14 PM
driessen wrote:Waitrun() and Winexec() cannot be used since they don't work with a MSI-file.


Are you sure? I never tried for myself but I can't see why they shouldn't work.

EMG
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 02:18 PM
Enrico,

I'm quite sure indeed.

I tried both like this
Code (fw): Select all Collapse
WinExec("MSXML.MSI",1)

WaitRun("MSXML.MSI",2)
and nothing happens.

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 02:30 PM

Michel

You need to indicate the whole path

waitrun("c:.....\msxml.msi")

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 03:11 PM

Richard,

I tried them out with the full path, but no luck. The result is exactly the same.

But now I check which message was returned.

Waitrun() returns -1
WinExec() return 11 which means that the executable file was invalid.

But if I launch the MSI-file manually, everything goes fine.

Thanks anyway.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 76
Joined: Fri Dec 30, 2005 10:25 AM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 03:43 PM
I tryed this with no problems:

ShellExecute(,"Open","MSXML.MSI",,,3)
SYSWAIT(5)
DO WHILE .T.
hFile := FOPEN("MSXML.MSI",FO_READWRITE + FO_EXCLUSIVE) // !!!
IF FERROR() <> 0
SYSREFRESH()
SLEEP(1)
LOOP
ENDIF
FCLOSE(hFile)
EXIT
SYSREFRESH()
ENDDO
Frank-Peter
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 03:51 PM

Thanks a lot for your reply.

I know that this is working. But I need my application to wait until the installation has been finished. And that doesn't happen. My application just goes on.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Shellexecute(), Waitrun(), Winexec()
Posted: Wed Oct 20, 2010 08:35 PM

Michel,

Try this:

waitrun( "msiexec.exe c:\temp\msxml.msi /I /QN")

For more details on command line options:

http://www.appdeploy.com/articles/commandline.asp

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Shellexecute(), Waitrun(), Winexec() - Solved
Posted: Wed Oct 20, 2010 09:42 PM
James,

Thank you very much for your help.

This code did its job :
Code (fw): Select all Collapse
WaitRun("msiexec.exe /i c:\temp\msxml.msi")


Thank you so much.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion