| View previous topic :: View next topic |
| Author |
Message |
colo Expert Cheater
Reputation: 1
Joined: 09 Apr 2005 Posts: 111
|
Posted: Mon Feb 16, 2009 9:30 am Post subject: [Delphi] How Send Key? |
|
|
Idk.. but i like send key (F1,F2,etc)
how can send Key?
_________________
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Mon Feb 16, 2009 9:38 am Post subject: |
|
|
Map the key.
Use PostMessage
VK_F1
|
|
| Back to top |
|
 |
colo Expert Cheater
Reputation: 1
Joined: 09 Apr 2005 Posts: 111
|
Posted: Mon Feb 16, 2009 10:03 am Post subject: |
|
|
Me use this:
| Code: | | PostMessageA(Wnd, WM_KEYDOWN, ord(VK_F1),0); |
but in process have error, Is correct?
_________________
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Mon Feb 16, 2009 10:45 am Post subject: |
|
|
| I believe you have to map the key for the last parameter.
|
|
| Back to top |
|
 |
colo Expert Cheater
Reputation: 1
Joined: 09 Apr 2005 Posts: 111
|
Posted: Mon Feb 16, 2009 11:41 am Post subject: |
|
|
| dnsi0 wrote: | | I believe you have to map the key for the last parameter. |
Please can make example.
Thanks
_________________
|
|
| Back to top |
|
 |
alexNx Master Cheater
Reputation: 0
Joined: 23 Nov 2008 Posts: 313
|
Posted: Mon Feb 16, 2009 12:17 pm Post subject: |
|
|
This is chunk of code from my bot and you can see very clear how to do so.
i hope this can help you. Also if you like my code download the thing i attached so your program can run properly .
MY CODE:
| Code: | unit botts;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Timer1: TTimer;
Timer2: TTimer;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Timer3: TTimer;
Timer4: TTimer;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Timer5: TTimer;
Timer6: TTimer;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
GroupBox2: TGroupBox;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure Timer6Timer(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function PostMessageX(
hWnd:HWND;
MSG:UINT;
WPARAM:wParam;
LPARAM:lParam):BOOL;stdcall;
external 'PMX.dll' name 'PostMessageX'
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if odd(GetAsyncKeyState(VK_F1)) then //When u press f1 it will begin
begin
label1.caption:='On';
label1.font.color:=clLime;
Timer2.Enabled:=true;
end;
if odd(GetAsyncKeyState(VK_F2)) then //when u press f2 it will stop
begin
label1.caption:='On';
label1.font.color:=clRed;
Timer2.Enabled:=false;
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
MS: HWND;
A:DWORD;
begin
A:=MapVirtualKey($5A,0);
A:=A shl 16;
MS := FindWindow('MapleStoryClass', nil);
if MS <>0 then begin
PostMessageX(MS,WM_KEYDOWN, $5A, A);
end;
end; |
_________________
[BELLOCAN]
Bellocan:
10x Priest 1month banned.
5x Sin Active.
3x Bow Active.
|
|
| Back to top |
|
 |
colo Expert Cheater
Reputation: 1
Joined: 09 Apr 2005 Posts: 111
|
Posted: Mon Feb 16, 2009 12:35 pm Post subject: |
|
|
Thanks , alexNx.
My idea is correct
_________________
|
|
| Back to top |
|
 |
|