Lauching Another


‘Description: Shell Function. Runs an executable program. Wait for program to
‘             terminate. Time out after 30 seconds.

‘Declare Function GetModuleUsage Lib “Kernel” (ByVal hModule As Integer) As Integer
‘Const SW_HIDE = 0      ‘Normal Window
‘Const SW_NORMAL = 1    ‘Maximized Window
‘Const SW_MAXIMIZE = 3  ‘Minimized Window
‘Const SW_MINIMIZE = 6  ‘Hidden Window

‘Sub Command1_Click ()
On Error Resume Next
command1.Enabled = False
iInst% = Shell(“C:\TEST\DOSAPP.EXE”, SW_MINIMIZE)
startt! = Timer
timeout% = False
Do While GetModuleUsage(iInst%) > 0
DoEvents
If Abs(Timer – startt!) > 30 Then
timeout% = True
Exit Do
End If
Loop

If timeout% Then MsgBox “Timed out, 30 seconds passed!”, 0, “Warning”
command1.Enabled = True
‘End Sub

One response to “Lauching Another

  1. Pingback: Trackback

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s