hey.
ich möchte tastencodes an ein fenster senden.
ich weiss das die exe datei gestartet ist, ich kenne auch den fenster namen.
ich benutze delphi 7 und winxp.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
| var mWnd : HWND;
procedure TForm1.FormCreate(Sender: TObject); begin id1:=GlobalAddAtom('Hotkey1'); RegisterHotKey(handle,id1,0,VK_Pause); end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin UnRegisterHotKey(handle,id1); end;
procedure TForm1.FormDestroy(Sender: TObject); begin UnRegisterHotKey(handle,id1); end;
procedure TForm1.WMHotKey (var Msg : TWMHotKey); var i: byte; begin if msg.HotKey = id1 then begin if EXE_Running('notepad.exe',false) then begin mWnd := Findwindow(nil,pchar('Editor')); PostMessage(mWnd, WM_KEYDOWN, VK_NUMPAD0, 0); end else MessageDlg('notepad is not running.', mtInformation, [mbOk], 0); end; end;
end. |
problem 1:
der system weite hotkey funzt nur wenn das eigene programm aktiv ist.
wenn ich die hotkey taste drücke während ich in notepad schreibe, passiert garnichts.
problem 2:
ich kann die keys an das programm senden, also an das fenster handle, aber nicht in das feld, beispielsweise das edit feld in notepad.
any sugegstions #1?
thx