Jump to content
covaks

WM_SETTEXT how to get text?

Recommended Posts

covaks

If an external program sends a WM_SETTEXT message to my GUI, how do I get the actual text that it is trying to set?

$lparam in the code below is a hex value, I want to msgbox the actual text.

So, if an external C program has the following line:

SendMessage(hwnd, WM_SETTEXT,NULL,(LPARAM)"foo");

I want my message box to say "foo", instead of some hex value. Is that possible?

GUIRegisterMsg($WM_SETTEXT,"MyFunc")

Func MyFunc($hwndGui, $msgid, $wparam, $lparam)
    msgbox(1,"",$lparam)
    return 1
EndFunc

Share this post


Link to post
Share on other sites
piccaso

where you able to catch the WM_SETTEXT message?

if yes then lparam is a pointer you can use DllStruct stuff to read it

there is a function inside sqlite.au3 (should be in your include dir) called __SQLite_szStringRead

which shows how to read a zString


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites
covaks

Thank you very much, that worked. :-)

SendMessage(hwnd, WM_SETTEXT,NULL,(LPARAM)"Super Duper");

From a C program will now cause my AutoIT script to pop up a message box with the text "Super Duper". Now I have a way to pass messages back and forth between the two programs.

GUIRegisterMsg($WM_SETTEXT,"MyFunc")

Func MyFunc($hwndGui, $msgid, $wparam, $lparam)
    $text = DllStructCreate("ubyte[15]",$lparam)
    msgbox(1,"",DllStructGetData($text,1))
    return 1
EndFunc

Share this post


Link to post
Share on other sites
CoDEmanX

So, if an external C program has the following line:

SendMessage(hwnd, WM_SETTEXT,NULL,(LPARAM)"foo");

I want to send the WM_SETTEXT message from my autoit script to an external application's controls (ThunderRT6). How to do that?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.