Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


PostMessage change key

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Mar 10, 2008 12:41 pm    Post subject: PostMessage change key Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Mon Mar 10, 2008 1:22 pm    Post subject: Reply with quote

IntToStr(Edit1.Text)?
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Mar 10, 2008 1:24 pm    Post subject: Reply with quote

Symbol wrote:
IntToStr(Edit1.Text)?


then it should be strtoint .. and it dosent work already tested Smile

i dont get any errors it just dosent send any key

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Mar 10, 2008 2:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Mar 10, 2008 10:17 pm    Post subject: Reply with quote

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 Wink

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Tue Mar 11, 2008 8:34 am    Post subject: Reply with quote

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 Wink


No problem Razz
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 Razz
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Tue Mar 11, 2008 11:02 am    Post subject: Reply with quote

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 Wink


No problem Razz
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 Razz


dosent work Smile you have to set B into integer too Razz
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
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Tue Mar 11, 2008 11:33 am    Post subject: Reply with quote

didnt even test it... just posted...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites