Robbles Posted March 31, 2010 Share Posted March 31, 2010 Hello folks, I have this simple script: $dialog = WinWaitActive("[CLASS:#32770]", "") ; Notepad Ctrl-O "Open" dialog ConsoleWrite('Handle: ' & $dialog & @crlf) I switch over to Notepad.exe and click Ctrl-O. My script immediately returns handle "0x00010220" every single time, which is not the right handle according to Au3Info.exe Using "Open" instead of "[CLASS:#32770]" works, and returns the proper handle. Anyone know what's going on? I'm a newbie but I'm pretty sure I'm doing everything by the book. I'm _completely_ stumped. WinXP SP3, AutoIt3 v3.3.6.0 Link to comment Share on other sites More sharing options...
Yashied Posted March 31, 2010 Share Posted March 31, 2010 (edited) Welcome Robbles. expandcollapse popup$hWnd = _WinWaitOwner('Open', '', 'Untitled - Notepad') If $hWnd Then WinMove($hWnd, '', 10, 10) EndIf Func _WinWaitOwner($sTitle, $sText = '', $sOwner = 0, $iTimeOut = 0) Local $hWnd, $List, $Ret, $Timer = TimerInit() $iTimeOut = Round($iTimeOut * 1000) While 1 $List = WinList($sTitle, $sText) If $List[0][0] Then If Not $sOwner Then $hWnd = $List[1][1] ExitLoop Else $hWnd = WinGetHandle($sOwner) If IsHWnd($hWnd) Then For $i = 1 To $List[0][0] $Ret = DllCall('user32.dll', 'hwnd', 'GetWindow', 'hwnd', $List[$i][1], 'uint', 4) If (Not @error) And ($Ret[0] = $hWnd) Then $hWnd = $List[$i][1] ExitLoop 2 EndIf Next EndIf EndIf EndIf If ($iTimeOut) And (TimerDiff($Timer) > $iTimeOut) Then Return 0 EndIf Sleep(10) WEnd Sleep(Opt('WinWaitDelay')) Return $hWnd EndFunc ;==>_WinWaitOwner Edited March 31, 2010 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Robbles Posted March 31, 2010 Author Share Posted March 31, 2010 (edited) I'm sorry, but I have no idea what the purpose of your script is (I'm a newb.)I am running a little freeware program called Pitaschio that is causing this problem. If I kill the Pitaschio.exe process, AutoIt3 can get Window handles from Class names again.Is there any way to call a Windows DLL directly to get a window handle based on a Class name? Maybe that will work. Edited March 31, 2010 by Robbles Link to comment Share on other sites More sharing options...
bo8ster Posted March 31, 2010 Share Posted March 31, 2010 Yes. In my sig there is a link ' Control Handle under mouse' which has the functions to do this. If you have any issues with it, let me know. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Robbles Posted April 1, 2010 Author Share Posted April 1, 2010 (edited) Thanks for the reply. I will dig into your code and see if I can make heads or tails of it. Edited April 1, 2010 by Robbles 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