flat assembler
Message board for the users of flat assembler.
Index
> Windows > [solved]WM_KEYDOWN VK_LCONTROL |
Author |
|
AsmGuru62 19 Mar 2017, 03:05
From MSDN it looks like you need to wait for WM_KEYDOWN with VK_CONTROL and then detect L/R with GetKeyState():
Code: if (msg == WM_KEYDOWN) { if (wParam == VK_CONTROL) { if (GetKeyState (VK_LCONTROL) & 0x8000) { // LEFT Control Key } else { // RIGHT Control Key } } } |
|||
19 Mar 2017, 03:05 |
|
sinsi 19 Mar 2017, 04:11
Maybe bit 24 of lParam?
Quote: Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. Apparently VK_LCONTROL VK_RCONTROL are only used for GetKeyState and GetAsyncKeyState. |
|||
19 Mar 2017, 04:11 |
|
guignol 19 Mar 2017, 05:32
VK_ is a key number
|
|||
19 Mar 2017, 05:32 |
|
bitRAKE 19 Mar 2017, 05:46
Have you tried any of those Message Hook/Spy tools? They are very useful for figuring out what Windows is doing.
Spy++ comes with Visual Studio, but other similar programs exist. http://mdb-blog.blogspot.com/2010/11/microsoft-spy-or-spyxx-for-download.html http://www.catch22.net/software/winspy-17 http://windowdetective.sourceforge.net/
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
||||||||||
19 Mar 2017, 05:46 |
|
vivik 19 Mar 2017, 08:38
@bitRAKE
Third link worked, thank you! First didn't show messages for my app for some reason (worked fine for others), and second only shows information about window itself. I also fixed some other bug with it (I was getting too much WM_PAINT), really usefull. So alt received not with WM_KEYDOWN, but with WM_SYSKEYDOWN. According to this link https://msdn.microsoft.com/en-us/library/windows/desktop/gg153546(v=vs.85).aspx the only SYSKEYDOWN keys are alt and f10, and I must to pass them to DefWindowProc in order to not break anything. Weird. But now I understand why walking doesn't work in half life 2 on windows 7, as a bonus. As of VK_LCONTROL VK_RCONTROL, looks like they are indeed for GetKeyState() only. Thanks, everyone! |
|||
19 Mar 2017, 08:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.