Signature (Visual Basic / VBA)
Public Function ShellWait( _
ByVal vCommand As String _
, Optional ByVal vFocus As Variant _
, Optional ByVal vSendKeys As Variant _
, Optional ByVal vAllowDoEvents As Variant _
) As Long
Code Example
ShellWait("CharMap.Exe", vbNormalNoFocus) = 0
ShellWait("NotePad.Exe NewFile.Txt") = 0
Parameters
| Parameter | Description |
|---|---|
| vCommand | The Windows or DOS command that is to be executed. This command line must include a program name, and it can optionally include one or more command line arguments. |
| vFocus | The focus given to program's window. Should be one of the Visual Basic focus Constants like vbNormalFocus, vbNormalNoFocus, etc. vFocus defaults to vbNormalFocus if it is missing or Null or cannot be fixed-up to a number. |
| vSendKeys | String that will be sent to the program as keystrokes after it is started. vSendKeys defaults to an empty string (no keystrokes will be sent) if it is missing or Null or cannot be fixed-up to a string. |
| vAllowDoEvents | True if the use of DoEvents is permitted within this function. False if DoEvents is not allowed. Read the warnings below carefully. |
Notes & Version History
| Warning | vSendKeys is ignored if vFocus is vbHide, vbMinimizedNoFocus, or vbNormalNoFocus. |
| Warning | Uses DoEvents so that this function can detect the end of 16-bit Windows Programs within the 32-bit version of Entisoft Tools. This may possibly cause problems when this function is used within the 32-bit In-process version of Entisoft Tools, since there are restrictions on using DoEvents within In-process servers--see the Visual Basic documentation. |
| Note | When executing 16-bit Windows applications from the 32-bit version of Entisoft Tools, you must set vAllowDoEvents to True (its default) otherwise it cannot detect the end of the program. Unfortunately, the DoEvents statements are not recommended by Microsoft for use within in-process OLE Automation Servers (such as Entisoft Tools). See the Visual Basic 4.0 documentation and help file for more information. |
| v1.3 Change | Removed 16-bit support from this function. |