Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WAITFORSINGLEOBJECT

Status
Not open for further replies.

OraMs

Programmer
Feb 12, 2000
40
US
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?

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")
...

 

I forgot to add that my OS is Win98 and that I also know win 2000 does have an OPENTHREAD API...

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top