Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 18.03.08 19:36 
Hallo
ich will Tasten an ein (später im Hintergrund befindliches) Programm senden
Habs erst mal mit Notepad probiert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  fHandle: HWND;
begin
  fHandle := FindWindow('notepad'nil);
  SetForeGroundWindow(fHandle);
  fHandle := FindWindowEx(fHandle, 0'Edit'nil);
  Sleep(200);
  if fHandle <> 0 then begin
    //SendMessage(fHandle, WM_CHAR, Ord('E'), 0);
    SendMessage(fHandle, WM_KEYDOWN, Ord('E'), $000000000);
    SendMessage(fHandle, WM_KEYUP,  Ord('E'), $C0000000);

    //keybd_event(Ord('E'),0,0,0);
    //keybd_event(Ord('E'),0,KEYEVENTF_KEYUP,0);
  end;


Mit keybd_event klappt es aber nicht über SendMessage (Nur über WM_CHAR und aber nicht über die anderen 2)
Er hat das Handle (<>0) und holt das Fenster auch in den Vordergrund aber sonst passiert nix

Was mach ich falsch?
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mi 19.03.08 00:49 
Es gibt für sowas eine Unit sndkey32, einfach mal im Forum (müsste eigentlich in der Library sein) suchen. Die funktioniert dann auch ;)

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Mi 19.03.08 12:31 
ok danke

hab gestern noch ewig probiert bis es mit sendmessage ging...
hab aber ka worans lag
bin dann über findwindowex bis zu dem unterfesnter durch was ich haben wollte und dann gings...