Opened 12 years ago

Last modified 12 years ago

#2208 closed Feature Request

ControlGetText not working on calculator — at Initial Version

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Win7 64 bits mode (and 32 bits mode)

Unable to get text of (static) control. Reproduced with below code on calculator.
I believe this is due to changed behaviour of WM_GETTEXT in Win Vista/7 (and as such probably not a bug) but for standardcontrols would be nice if there is a workaround to get for example the text labels of the calculator buttons.

Also AU3Info x64 and x86 hoovering over the buttons give no text value and spy++ neither.

{{{;Calculator, make sure its started
;$calcHWND = WinGetHandle("[CLASS:SciCalc]")
$calcHWND = WinGetHandle("[REGEXPCLASS:.*Calc.*]")
if $calchwnd = "" Then

run("calc.exe")
sleep(2000)

; $calcHWND = WinGetHandle("[CLASS:SciCalc]")
$calcHWND = WinGetHandle("[REGEXPCLASS:.*Calc.*]")
EndIf

winactivate($calcHWND)
Local $hHandle = ControlGetHandle("", "", "[CLASS:Button; INSTANCE:8]")
Local $aPos = ControlGetPos("", "", $hHandle)
local $cText= controlgettext("","",$hHandle)
Local $wText = wingettext($hHandle)

Consolewrite("Window Stats:" & "Position: " & $aPos[0] & "," & $aPos[1] & @CRLF & "Size: " & $aPos[2] & "," & $aPos[3] & @CRLF)
ConsoleWrite("text:" & $cText & @crlf)
consolewrite("text2:" & $wText & @crlf)

}}}

Change History (0)

Note: See TracTickets for help on using tickets.