WaitForSingleObject should not wait infinite

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I am opening a process using Openprocess and WaitForSingleObject untill the process startup. When the process is startup I should use the parent process as well. When I use WaitForSingleObject, it is waiting to close the new process. I want to use both the process

My code goes here.

Const SYNCHRONIZE = &H10000
Const INFINITE = -1

Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Lon

Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Lon

Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Lon

Dim iTask as Lon
iTask = Shell("C:\Progra~1\SAP\FrontEnd\SAPgui\\saplogon.exe", 1
pHandle = OpenProcess(SYNCHRONIZE, False, iTask
retValue = WaitForSingleObject(pHandle, INFINITE
retValue = CloseHandle(pHandle
MsgBox (CStr(iTask)

Any help appreciated

Thank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top