Equivalent for UIAccessor.GetWindowText?

Equivalent for UIAccessor.GetWindowText?

Anonymous
Not applicable
450 Views
2 Replies
Message 1 of 3

Equivalent for UIAccessor.GetWindowText?

Anonymous
Not applicable
Well, the issue I met come from string size/length limit of UIAccessor.GetWindowText function that return maximum 255 characters. I also try to get windows text with Windows Struct but hit the same limit of 255 chars.
--variant #1
wndMsg = (Windows.getChildrenHWND hwnd)

--variant #2
wndMsg = UIAccessor.GetWindowText (Windows.getChildrenHWND hwnd)

My qestion is is there equivalent for GetWindowText()
or any other workaround to get windows text?
0 Likes
451 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
fn getLongWindowText hWnd length encoding:#ansi =
(
local WM_GETTEXT = 0xD
local marshalCls = dotnetClass "System.Runtime.InteropServices.Marshal"
local buffer = marshalCls.allocHGlobal length
local bufferPtr = dotnetObject "System.IntPtr" buffer
windows.sendMessage hWnd WM_GETTEXT length buffer
local str = (if encoding == #ansi then marshalCls.PtrToStringAnsi else marshalCls.PtrToStringUni) bufferPtr
marshalCls.freeHGlobal bufferPtr
str
)
0 Likes
Message 3 of 3

Anonymous
Not applicable
looks promising, thanks in advance!

Works excellent! Many thanks!
0 Likes