|
Post by Gordon Rahman on Jun 30, 2020 17:18:52 GMT -5
I know how to place a text on a button. Can I read it too?
Gordon
|
|
|
Post by Chris Iverson on Jun 30, 2020 18:01:26 GMT -5
The GetWindowTextA() API call can do it.
button #m.b, "testing", [testing], UL, 10, 10 open "blah" for window as #m
hButton = hwnd(#m.b)
print GetWindowText$(hButton) input a close #m
[testing] wait
Function GetWindowText$(hWnd) bufLen = 256 buf$ = space$(bufLen)
CallDLL #user32, "GetWindowTextA",_ hWnd as ulong,_ buf$ as ptr,_ bufLen as long,_ ret as long
GetWindowText$ = left$(buf$, ret) End Function
|
|
|
Post by Gordon Rahman on Jul 1, 2020 6:24:41 GMT -5
Hello Chris,
Thanks for your help.
Gordon
|
|
|
Post by Rod on Jul 1, 2020 6:40:42 GMT -5
You could as well keep an array of the current button name and simply reference that. Change the button text, change the array, or more simply use the array element as the button text.
|
|