KongMD Posted February 5, 2012 Share Posted February 5, 2012 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) Link to comment Share on other sites More sharing options...
JohnOne Posted February 5, 2012 Share Posted February 5, 2012 Is $mainWin a handle to a process or a handle to the window? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
KongMD Posted February 5, 2012 Author Share Posted February 5, 2012 (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 February 5, 2012 by KongMD Link to comment Share on other sites More sharing options...
LarsJ Posted February 5, 2012 Share Posted February 5, 2012 Look here. Post 10. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
KongMD Posted February 5, 2012 Author Share Posted February 5, 2012 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 Link to comment Share on other sites More sharing options...
JohnOne Posted February 5, 2012 Share Posted February 5, 2012 What is the code that totally works on your machine, but not on some others? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
KongMD Posted February 5, 2012 Author Share Posted February 5, 2012 (edited) EDIT: I posted that somewhat off-topic question in a new thread: Edited February 5, 2012 by KongMD Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now