Thanks in advance for your time.
I've writte a DLL that "shells" an application. The DLL should "wait" for the login dialog for the shelled application to complete before continuing with the rest of VB process. I attempted to use WAITFORSINGLEOBJECT (see code below) which resulted in VB pausing until I totally exited the shelled application. This is not what I wanted. After further research I understand that WIN32 does not support what I want to do.
Any suggestions on how I can get the "wait" effect accomplished?
I've writte a DLL that "shells" an application. The DLL should "wait" for the login dialog for the shelled application to complete before continuing with the rest of VB process. I attempted to use WAITFORSINGLEOBJECT (see code below) which resulted in VB pausing until I totally exited the shelled application. This is not what I wanted. After further research I understand that WIN32 does not support what I want to do.
Any suggestions on how I can get the "wait" effect accomplished?
Code:
'get login window handle
CurrWndHndl = CheckApp(TaskName, varLogName)
...
'check results
If CurrWndHndl = 0 Then
MsgBox "Login cancelled.", vbOKOnly, ProcessName
Exit Function
End If
'get process id
lngRetVal = GetWindowThreadProcessId(CurrWndHndl, lngProcID)
'open process
LoginWndHndl = OpenProcess(SYNCHRONIZE, False, lngProcID)
'call error handler
bolErr = ErrHndlr("OpenProcess")
'now wait until user has logged in
lngRetVal = WaitForSingleObject(LoginWndHndl, INFINITE)
'now close process
lngRetVal = CloseHandle(lngProcID)
'call error handler
bolErr = ErrHndlr("CloseProcess")
'now close handle
lngRetVal = CloseHandle(LoginWndHndl)
'call error handler
bolErr = ErrHndlr("CloseHandle")
...