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 


how to find value of key pressed in delphi
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Jun 08, 2008 7:00 am    Post subject: Reply with quote

Quote:
Code:
BYTE vk;
while(GetMessage(&msg, NULL, 0, 0) > 0) {
   if(msg.message != WM_KEYDOWN) {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
   }
   else {
      vk = msg.wParam;
   }
}
return msg.wParam;


that's all good, except im trying
Quote:
to find value of key pressed in delphi

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jun 08, 2008 7:05 am    Post subject: Reply with quote

Rot1 wrote:
HalfPrime wrote:
wParam is a DWORD, 4 bytes
The WM_KEYDOWN is broken up liek: http://msdn.microsoft.com/en-us/library/ms646280(VS.85).aspx
If you just want to get the 1 byte scancode which is 1 byte into the wParam, you could try something like:
Code:
BYTE vk = (BYTE)*(((void*)(msg.wParam))+1)


EDIT: disregard the above was thinking about lparam
wParam is a DWORD, 4 bytes, but all it contains is the scancode.
Code:
BYTE vk = msg.wParam;

should work.


wParam = WORD (2 Bytes) Parameter, lParam = LONG (LongInt) Parameter

Check this out - http://rot1blg.wordpress.com/2008/05/16/table-of-contents/


Little out of date my friend. WPARAM and LPARAM are both 32-bit now.

Snootae wrote:
Quote:
Code:
BYTE vk;
while(GetMessage(&msg, NULL, 0, 0) > 0) {
   if(msg.message != WM_KEYDOWN) {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
   }
   else {
      vk = msg.wParam;
   }
}
return msg.wParam;


that's all good, except im trying
Quote:
to find value of key pressed in delphi


Create a keyboard hook? Lol. I'm sure there are examples, just google it. I found an article on the first link of that search.

http://delphi.about.com/od/windowsshellapi/a/keyboard_hook.htm

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Jun 08, 2008 7:25 am    Post subject: Reply with quote

yeh, nothing in that code talks about vks, just got ifs
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jun 08, 2008 7:31 am    Post subject: Reply with quote

Code:

case WordParam of
  vk_Space: {erase battle ship's path}


...

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Jun 08, 2008 7:52 am    Post subject: Reply with quote

yeh, bad wording, it has absolutely no advantage over GetKeyState at this point, still requires ifs
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jun 08, 2008 7:59 am    Post subject: Reply with quote

Lol, then use GetKeyState Razz

Code:

var vk : DWORD
if(GetKeyState(VK_CONTROL) <> 1) begin
   vk := VK_CONTROL
end


There's an example. Haven't used delphi in a long time, so that may not be right syntax, but you get the idea.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Jun 08, 2008 8:28 am    Post subject: Reply with quote

do you even know what this thread is about, i need to not use a crap load of ifs, hence the whole not using GetKeyState, i know how to use it, i prefer not to
_________________
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: Sun Jun 08, 2008 8:31 am    Post subject: Reply with quote

Why don't you simply call SetWindowsHookEx?
You could also loop through 1~150 or something and RegisterHotKey, but its stupid, use SetWindowsHookEx.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jun 08, 2008 8:50 am    Post subject: Reply with quote

We already showed an example, but he doesn't want a "crap load of ifs" or cases, but in reality it's kind of the same thing.

@ Snootae

Dude, sometimes you have to do a lot of things that are very tedious, such as doing case statements for each VK, but you need to. Or you could learn C++, rewrite everything, and just do it the way we showed you before. Which one sounds easier to you?

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Jun 08, 2008 9:05 am    Post subject: Reply with quote

Edit:

What the fuck? X-Trainer help? The hell did that come from?

Ok, this is irritating. I'm going to PM Snootae my old post, then PM it to DB and ask him about it.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
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
Goto page Previous  1, 2
Page 2 of 2

 
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