Problem/Question/Abstract:
Send a VK_BACK keystroke to a TRichEdit
Answer:
procedure SendKey(H: Hwnd; Key: char);
var
vKey, ScanCode: Word;
lParam, ConvKey: Longint;
begin
ConvKey := OemKeyScan(Ord(Key));
ScanCode := ConvKey and $000000FF or $FF00;
vKey := Ord(Key);
lParam := LongInt(ScanCode) shl 16 or 1;
SendMessage(H, WM_KEYDOWN, vKey, lParam);
SendMessage(H, WM_CHAR, vKey, lParam);
lParam := lParam or $C0000000;
SendMessage(H, WM_KEYUP, vKey, lParam);
end;
Used like this:
SendKey(Richedit1.Handle, #8);
Can I send a keystroke to another software using this?
VálaszTörlésHow to do?
I'm trying with "keybd_event" but it is not working with the target software.
Thank you.