|
-
November 19th, 2006, 01:34 AM
#1
Check if process from ShellExecute still running
Hi, I need to check if a certain process started by ShellExecute is still running or not.
Before replying, notice why I use ShellExecute:
-The Shell command doesn't work well with long path names on Win9x
-The CreateProcessA API does not allow to set process startup state (eg, minimized)
And of course, I cannot use the WaitForSingleObject API since it hangs the program in a nasty way while the process is executing.
I've tried this function but it always returns False, it seems the process ID is not the same for the one created by ShellExecute.
Code:
Function IsProcessOpen(ID_PROCc As Long) As Boolean
Dim h As Long
h = OpenProcess(&H1, True, ID_PROCc)
If h <> 0 Then
CloseHandle h
IsProcessOpen = True
Else
IsProcessOpen = False
End If
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|