MyEarth Posted April 5, 2014 Posted April 5, 2014 (edited) I have found a script ( probably C++ ) that use this function and i want to convert that to autoit Well, i can't recreate it, Windows 8 version. I have try: WinExist WinGetHandle _WinAPI_FindWindow WinGetTitle WinList Nothing, nothing work but the original C++ yes. I can't get the handle. If i use Autoti Spy tool i have the Title, the Class etc. but nothing seems work, WinList don't report that window... Class: NativeHWNDHost Position: 50, 580 Size: 432, 140 Style: 0x96000000 ExStyle: 0x00200088 Handle: 0x00000000000100FC >>>> Control <<<< Class: DirectUIHWND Instance: 0 ClassnameNN: DirectUIHWND0 Name: Advanced (Class): [CLASS:DirectUIHWND; INSTANCE:0] ID: Text: Position: 0, 0 Size: 432, 140 ControlClick Coords: 317, 71 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x00000000000100FE Suggestion? An example in C++ [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); IntPtr hWnd = FindWindowByCaption(IntPtr.Zero, "Title Here"); Edited April 5, 2014 by MyEarth
FireFox Posted April 5, 2014 Posted April 5, 2014 Really? #include <MsgBoxConstants.au3> Example() Func Example() ; Retrieve a list of window handles. Local $aList = WinList("[CLASS:NativeHWNDHost]") ; Loop through the array displaying only visable windows with a title. For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1]) WinClose($aList[$i][1]) EndIf Next EndFunc ;==>Example Br, FireFox.
MyEarth Posted April 5, 2014 Author Posted April 5, 2014 (edited) Yes, really. No MsgBox Local $aList = WinList("[CLASS:NativeHWNDHost]") For $i = 1 To $aList[0][0] MsgBox(0, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1]) Next Edited April 5, 2014 by MyEarth
Solution MyEarth Posted April 5, 2014 Author Solution Posted April 5, 2014 I have resolved with _WinAPI_FindWindow + WinGetTitle in the same line. A note, for the class in FindWindow you don't need to write [CLASS:ETC] but directly the class, that was my error. Thank you firefox for your help
FireFox Posted April 5, 2014 Posted April 5, 2014 FYI, you need to use the "[CLASS...]" syntax for native autoit funcs, that's not the case of _WinAPI_FindWindow. Br, FireFox.
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