PDA

View Full Version : win.SendMessage



cpdlink
August 11th, 2006, 08:47 AM
hello everybody,

i am trying to write a few characters into a vb texbox using the code below:


local h_parent = win.FindWindow("ThunderFormDC", "MessageReceiver");
local h_child = win.FindWindowEx(h_parent, nil,"ThunderTextBox", nil);
local msg = 'abc123'
print(h_parent .. ' - ' .. h_child);

win.SendMessage(h_child, win.WM_SETTEXT, 0, msg);
and it doesn't work - the error is:

"parameter 4 must be a number or nil, not a string"

same thing works from an other vb application:


parent = FindWindow("ThunderFormDC", "MessageReceiver")
child = FindWindowEx(h_parent, ByVal 0&, "ThunderTextBox", vbNullString)
sMsg = "abc123"
Debug.Print h_parent & " - " & h_child

SendMessage h_child, WM_SETTEXT, 0&, ByVal sMsg
can anybody tell me how to do this using sendmessage (sendkeys is not a reliable solution - sometimes it works, sometimes it doesn't)

any help would be greatly appreciated
thanks,
chris

Ron
August 11th, 2006, 02:09 PM
That will not work from Lua. Try using the keyboard actions to do this.

cpdlink
August 11th, 2006, 03:50 PM
sorry to hear that,

is this wrapper going to be developped further more, because in my opinion we are missing a big deal of the functionality of this powerful function (probably the most powerful function in windows)

are there any other ways to send a text message from girder to an application?

i am basically looking at sending the channel number from a girder variable to an epg program

for sure i can create a file in a certain folder having the channel number as name, but i thought there is something more "elegant" than that

thank you for for the answer ron,
chris.

Ron
August 11th, 2006, 04:02 PM
Try using the keyboard actions, that is what everyone uses to do those tasks.