Well as long as you have the handle to the edit control:
SendText := 'This string should be sent to an edit control' +#13+#13+#13+
'Three carriage returns just took place!';
For Count := 1 to length(SendText) do
SendMessage(Wnd, WM_CHAR, Ord(SendText[Count]), 0 );
Hope that helps.
Best regards
--
L.J. - UK
ICQ: 42252330
Remove the monarchy to email me
--
Please do not request support for OP (Delphi),
Java, C++ or PHP by private email or ICQ.
Larry Adams wrote in message <8kjhu9$do...@bornews.borland.com>...
>I'm looking for a way to eneter text into another app's edit box (It's
>a logon popup box). I know the control's handle, so I tried using the
>API function SendMessage. That didn't work for me, because the message
>parameter for that function is of the cardinal type. I need to enter
procedure SendKey(hWnd: THandle; KeyStroke: Word);
begin
PostMessage(hWnd, WM_SETFOCUS, 0, 0);
PostMessage(hWnd, WM_KEYDOWN, KeyStroke, 0);
PostMessage(hWnd, WM_KEYUP, KeyStroke, 0);
end;
Now lets add a routine to send a string:
procedure SendString(hWnd: THandle; S: String);
var I: Integer;
begin
For I := 1 to Length(S) do SendKey(hWnd, S[I]);
SendKey(hWnd, VK_RETURN); // Send a Carriage Return
end;
I use postmessage, you should avoid SendMessage in this situation
because of its send and wait nature, whereas PostMessage just
posts the message in that windows processing queue.
Hope this helps.