| |

VerySource

 Forgot password?
 Register
Search
View: 2852|Reply: 21

Strange problem with hotkeys: it is obviously set to ALT + Z, but the registered one is SHIFT + Z. If it is set to SHIFT

[Copy link]

1

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-1-19 17:40:01
| Show all posts |Read mode
Strange problem with hotkeys: It is obviously set to ALT + Z, but the registered one is SHIFT + Z. If it is set to SHIFT + Z, the registered one becomes ALT + Z.

In other words, Shift and Alt are always the other way around.

Here is my code:
wHotKey = (WORD) SendMessage (hHkHide, HKM_GETHOTKEY, 0, 0);
if (wHotKey! = 0)
RegisterHotKey (g_hWnd, 1001, HIBYTE (wHotKey), LOBYTE (wHotKey));
else
UnregisterHotKey (g_hWnd, 1001);

Searching the web for nearly 3 hours has not been resolved.
What is the reason? How to solve?
Please master instructions, anxious.
I don't understand.
In addition, after setting the hot key and writing wHotKey to ini, the next time you read it, the corresponding hot key can be displayed normally in the HotKey control. I think the problem lies in: HIBYTE (wHotKey), but the relevant information on the Internet is written like this.
Also, tried: (byte) ((wHotKey >> 8)&0xFF), same as HIBYTE macro.
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-27 13:45:01
| Show all posts
RegisterHotKey (g_hWnd, 1001, HIBYTE (wHotKey), LOBYTE (wHotKey));
Try it instead:
RegisterHotKey (g_hWnd, 1001, HIWORD (wHotKey), LOWORD (wHotKey));
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-27 14:09:02
| Show all posts
wHotKey = (WORD) SendMessage (hHkHide, HKM_GETHOTKEY, 0, 0);
To:
DOWRD wHotKey = SendMessage (hHkHide, HKM_GETHOTKEY, 0, 0);
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-27 17:09:01
| Show all posts
RegisterHotKey (g_hWnd, 1001, HIBYTE (wHotKey), LOBYTE (wHotKey));
This sentence is not modified for now, only the following:
wHotKey = (WORD) SendMessage (hHkHide, HKM_GETHOTKEY, 0, 0);
change into:
DOWRD wHotKey = SendMessage (hHkHide, HKM_GETHOTKEY, 0, 0);

-----------
According to MSDN, the low byte represents the virtual key code, and the high byte code is functional. Generally speaking, a 32-bit value is returned, with two parameters, and only 8-bit bytes are used (if the four parameters are reasonable), 16-bits can be used, but MSDN clearly says byte and Not word, you can try it out
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-27 17:18:02
| Show all posts
The2511718method does not work.

It's the landlord's method, but it's not clear why this is the case.
Reply

Use magic Report

1

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-1-27 19:00:01
| Show all posts
Thank you for your reply.
The DWORD you said, I set it like this before. Because of problems, it was changed to WORD.

The problem is the same.
RegisterHotKey (g_hWnd, 1001, HIBYTE (wHotKey), LOBYTE (wHotKey));
This cannot be changed, and it was unsuccessful at first, because the following method was used, and later, after checking the information, I knew that the above writing should be used:
isterHotKey (g_hWnd, 1001, HIWORD (wHotKey), LOWORD (wHotKey));

Note :: Strangely, all other hotkeys can be registered normally, for example, Ctrl + Shift + Z, Ctrl + Shift + Alt + Z, but there is a strange phenomenon as shown in the title.
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-2-6 23:30:01
| Show all posts
Take the high byte of the back value and compare it with the virtual key code.
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 Invalid IP Address

Post time: 2020-2-7 02:15:01
| Show all posts
If you register Alt + Z, you cannot register twice
Reply

Use magic Report

1

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-2-7 09:00:02
| Show all posts
Contrast, more or less 3, anyway, Shift and Alt are always reversed.
ALT + Z must not have registered twice.
If I register ALT + Z, the actual successful registration is SHIFT + Z,
When I registered SHIFT + Z, the actual registration was ALT + Z.
fainted!
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-2-7 23:00:01
| Show all posts
You manually register, do not use the value returned by SendMessage to register
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list