Jump to content

WM_SETTEXT how to get text?


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 9 months later...
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...