Sign in to follow this  
Followers 0
KongMD

_WinAPI_WaitForInputIdle Returns 4294967295

7 posts in this topic

Hi, everyone. What's the proper way to use _WinAPI_WaitForInputIdle? The msgbox below outputted the following: 4294967295, instead of 1 or 0:

;Disable Quick Scan temporarily, if not disabled already
   SetStatus("Disabling Quick Scan (temporarily)")
   WinWaitActivate("Kaspersky Anti-Virus 6.0 for Windows Workstations","")
   $mainWin = WinGetHandle("Kaspersky Anti-Virus 6.0 for Windows Workstations")
   WinActivate($mainWin)
   $settingsBtn = ControlGetHandle($mainWin, "", "AVP.Button1")
  
   $inputIdle = _WinAPI_WaitForInputIdle($mainWin)
   MsgBox(64, "inputIdle return", $inputIdle)

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Hmm, good observation, John. I thought window handles and process handles were synonymous, but I must've been mistaken. Regardless, this change results in the same output:

;Disable Quick Scan temporarily, if not disabled already
SetStatus("Disabling Quick Scan (temporarily)")
WinWaitActivate("Kaspersky Anti-Virus 6.0 for Windows Workstations","")
$mainWin = WinGetHandle("Kaspersky Anti-Virus 6.0 for Windows Workstations")
$kPID = WinGetProcess($mainWin);
WinActivate($mainWin)
$settingsBtn = ControlGetHandle($mainWin, "", "AVP.Button1")

$inputIdle = _WinAPI_WaitForInputIdle($kPID)
MsgBox(64, "inputIdle return", $inputIdle)
Edited by KongMD

Share this post


Link to post
Share on other sites

Thanks for the info! I was actually looking at that thread right as you posted, but wasn't sure which post was correct :) Sadly, my program won't respond to anything, when running in a 32-bit OS. I've tried ControlSend, controlClick, setting focus, and all that jazz (window and button handles are correct, I checked). Even the raw Send function doesn't work. I literally have no more ideas about why this is, since the script works perfectly fine on a 64-bit OS . Here's my code:

Dim $sProcess = $kPath
Dim $hProcess
Dim $tPI = DllStructCreate($tagPROCESS_INFORMATION), $pPI = DllStructGetPtr($tPI)
Dim $tSI = DllStructCreate($tagSTARTUPINFO), $pSI = DllStructGetPtr($tSI)
    DllStructSetData($tSI, 'Size', DllStructGetSize($tSI))
Dim $iSuccess = _WinAPI_CreateProcess('', $sProcess, 0, 0, False, 0, 0, 0, $pSI, $pPI)
If Not $iSuccess Then
    MsgBox(0x10, 'Error!', 'Could not create the process!!!')
Else
    _WinAPI_CloseHandle(DllStructGetData($tPI, 'hThread'))
    $hProcess = DllStructGetData($tPI, 'hProcess')
   
    _WinAPI_WaitForInputIdle($hProcess)
    ;MsgBox(0x40, 'Success!', 'process initialization has completed!!!')

If(ProcessExists("avp.exe")) Then
  ShellExecute($kPath, @SW_SHOW) ;bring program up from out of the tray
EndIf

_WinAPI_WaitForInputIdle($hProcess)
    MsgBox(0x40, 'Success!', 'process initialization has completed!!!')
$mainWin = WinGetHandle("Kaspersky Anti-Virus 6.0 for Windows Workstations")
$settingsBtn = ControlGetHandle($mainWin, "", "AVP.Button1")
ControlFocus ($mainWin, "", $settingsBtn)
MsgBox(0, "debug line " & @ScriptLineNumber, "@error = " & @error)
Send("{ENTER}")
MsgBox(0, "debug line " & @ScriptLineNumber, "@error = " & @error)
EndIf

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

EDIT: I posted that somewhat off-topic question in a new thread:

Edited by KongMD

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0