| View previous topic :: View next topic |
| Author |
Message |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jun 08, 2008 7:00 am Post subject: |
|
|
| 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 |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 08, 2008 7:05 am Post subject: |
|
|
| 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 |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jun 08, 2008 7:25 am Post subject: |
|
|
yeh, nothing in that code talks about vks, just got ifs
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 08, 2008 7:31 am Post subject: |
|
|
| 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 |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jun 08, 2008 7:52 am Post subject: |
|
|
yeh, bad wording, it has absolutely no advantage over GetKeyState at this point, still requires ifs
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 08, 2008 7:59 am Post subject: |
|
|
Lol, then use GetKeyState
| 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 |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jun 08, 2008 8:28 am Post subject: |
|
|
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 |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Jun 08, 2008 8:31 am Post subject: |
|
|
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 |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 08, 2008 8:50 am Post subject: |
|
|
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 |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun Jun 08, 2008 9:05 am Post subject: |
|
|
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.
_________________
|
|
| Back to top |
|
 |
|