 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Mon Mar 10, 2008 12:41 pm Post subject: PostMessage change key |
|
|
well if you check this out it wills end key "1"
but if i want to make something that allow the user to change key how should i do it ?
| Code: |
var
h:hWnd;
A:DWORD;
M:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
A:=MapVirtualKey(49,0); // Key = 1
PostMessage(h,WM_KEYDOWN,0,A);
PostMessage(h,WM_KEYUP,0,A);
end;
|
This dosent work
| Code: |
var
h:hWnd;
A,B:DWORD;
M:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
B:=cardinal(edit1.text); // this should allow me to change key to 1 if i write "49" in edit1 but it dosent
A:=MapVirtualKey(B,0); // Key = nothing -.-
PostMessage(h,WM_KEYDOWN,0,A);
PostMessage(h,WM_KEYUP,0,A);
end;
|
make it to an integer dosent work eighter
i can get it working by using a hotkey box but then i cant use "return" etc
_________________
dont complain about my english...
1*1 = 2?
Last edited by ups2000ups on Mon Mar 10, 2008 1:26 pm; edited 1 time in total |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Mar 10, 2008 1:22 pm Post subject: |
|
|
| IntToStr(Edit1.Text)?
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Mon Mar 10, 2008 2:02 pm Post subject: |
|
|
this worked to me:
| Quote: | var
h:hWnd;
A,B:DWORD;
M:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
PostMessage(h,WM_KEYDOWN,hotkey1.hotkey,0);
PostMessage(h,WM_KEYUP,hotkey1.hotkey,0);
end; |
just add an HotKey object from the Win32 tab and set ANYTHING in modyfiers to false
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue Mar 11, 2008 8:34 am Post subject: |
|
|
| ups2000ups wrote: | | Anden100 wrote: | this worked to me:
| Quote: | var
h:hWnd;
A,B:DWORD;
M:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
PostMessage(h,WM_KEYDOWN,hotkey1.hotkey,0);
PostMessage(h,WM_KEYUP,hotkey1.hotkey,0);
end; |
just add an HotKey object from the Win32 tab and set ANYTHING in modyfiers to false |
thanks  |
No problem
but if you would like to use the numbers for each button inside a text box (as you said in your main thread) it would look like this:
| Quote: | var
h:hWnd;
A,B:DWORD;
G:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
G:= StrToInt('$' + Edit1.text);
PostMessage(h,WM_KEYDOWN,G,0);
PostMessage(h,WM_KEYUP,G,0);
end; |
didnt test it, but it should work
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Tue Mar 11, 2008 11:02 am Post subject: |
|
|
| Anden100 wrote: | | ups2000ups wrote: | | Anden100 wrote: | this worked to me:
| Quote: | var
h:hWnd;
A,B:DWORD;
M:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
PostMessage(h,WM_KEYDOWN,hotkey1.hotkey,0);
PostMessage(h,WM_KEYUP,hotkey1.hotkey,0);
end; |
just add an HotKey object from the Win32 tab and set ANYTHING in modyfiers to false |
thanks  |
No problem
but if you would like to use the numbers for each button inside a text box (as you said in your main thread) it would look like this:
| Quote: | var
h:hWnd;
A,B:DWORD;
G:String;
begin
M:=PChar(ClassName.text);
h:=FindWindowA(PAnsiChar(M),nil);
G:= StrToInt('$' + Edit1.text);
PostMessage(h,WM_KEYDOWN,G,0);
PostMessage(h,WM_KEYUP,G,0);
end; |
didnt test it, but it should work  |
dosent work you have to set B into integer too
but anyway i need to use array since integer dosent allow keys like A-E
VK_RETURN 0D
for exampel cant be used else
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue Mar 11, 2008 11:33 am Post subject: |
|
|
| didnt even test it... just posted...
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|