Board index » delphi » SendKey??

SendKey??

I'm trying to write a program to help user logged in another program
by sending keys to it.

I know someone has written a SendKey shareware which is for D1 & D2.
Which is a full blown version that has the InstallSheild wrapped
around.  (But I think a DCU is what you really need)  I tried install
it once & failed.

I need a D3 version, does anyone knows how to write it??

 

Re:SendKey??


Hi,

I have found some of it out myself, but i need some help myself too.
I'll put my code below.

- What i still need to know, is how i can get a list of apps (windows) i can
hook in to.
- And i need to know how i can "listen" to keypresses and mouse moves  in to
other app.
- And.... I need to know how to send a mouseclick(x,y) event to the other
window.

I thank all for any usfull information.

Here is the code i got so far.

-----------

var
  Form1: TForm1;
  WindowHook: HWnd;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  WindowHook := FindWindow(nil, PChar(WindowCaptionEdit.Text));
  CheckBox1.Checked := IsWindow(WindowHook);
  Edit1.Text := IntToStr(WindowHook);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  i: integer;
begin
  SendMessage( WindowHook, WM_KeyDown, StrToInt(Edit2.Text), 0);

// i think here has to come
// SendMessage( WindowHook, WM_KeyUp, StrToInt(Edit2.Text), 0);

  i := StrToInt(Edit2.Text);
  inc(i);
  Edit2.Text := IntToStr(i);
end;

-----------

Quote
Anders LEE wrote in message <355ff036.2004...@news.hk.super.net>...

>I'm trying to write a program to help user logged in another program
>by sending keys to it.

>I know someone has written a SendKey shareware which is for D1 & D2.
>Which is a full blown version that has the InstallSheild wrapped
>around.  (But I think a DCU is what you really need)  I tried install
>it once & failed.

>I need a D3 version, does anyone knows how to write it??

Other Threads