www.icetips.com  Icetips Utilities Documentation 11/16/2009    

Shell Class:  ITRunWait

Previous  Top  Next  


Prototype: (String pCommandLine, Long pWait=0, <String pParameters>,<String pStartupFolder>,Byte pElevate=0, Byte pShowWaitWindow=1),IT_HANDLE,PROC

 

pCommandlinePath and name of program or file to execute.  If the path is a long path (i.e. including spaces and long filename) we advise that you use double quotes around the command line.  Note that this should not contain any parameters strings, use the pParameters parameter for that.
pWaitTrue or false to indicate if the method should wait for the program to finish.  If this parameter is false the method returns a handle to the started process.  If this parameter is false, the pShowWaitWindow parameter is ignored and the wait window is not shown.  Default value is false (0)
pParametersOptional parameters to pass to the executed program.  If a parameter contains a long filename or path we advise that you use double quotes around that parameter value.
pStartupFolderOptional startup folder.  If this parameter is supplied it must point to a valid folder and the program will then behave as it if was run in the Startup Folder.
pElevateOptional parameter that is only valid under Vista, Windows Server 2008, Windows 7 or later operating systems where User Account Control is active.  If set to True it will force the called program to run elevated.
pShowWaitWindowOptional parameter to indicate if the Wait window should be shown or not:

 
ShellClass_RunWait_RunWindow
This parameter defaults to True - i.e. to show the window. 

 

ReturnsReturns the handle to the process if pWait is false.  If pWait is true it returns the exit code from the called process or if no exit code was received it returns the return value from WaitForSingleObject API.

 

The ITRunWait method is a replacement for the RUN statement in the Clarion runtime library.  The advantages of using ITRun is that it will automatically elevate a program if it needs to where as RUN() cannot do that.  You can also set the startup folder which you cannot do with RUN and you can also force elevation under Vista and newer operating systems where User Account Control (UAC) is active.

 

Example:

ITS  ITShellClass

Loc:ProgramToRun  CString(2049)

Loc:WaitForProgram Byte

Code

Loc:WaitForProgram = True

Loc:ProgramToRun   = '"C:\program files\Icetips Alta LLC\My program.exe"'

If Loc:ProgramToRun

  ITS.ITRun(Loc:ProgramToRun,Loc:WaitForProgram)

End

 

 

See also:

ITRun

ITRunFile

OpenURL

ShellExec

ShellExecEx

 



Direct link to this page: http://www.icetips.com/manuals/utilities/itrunwait_shellclass.htm