Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5849149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:57:32+00:00 2026-05-22T12:57:32+00:00

I have the very well-known WinAPI function: BOOL WINAPI RegisterHotKey( __in_opt HWND hWnd, __in

  • 0

I have the very well-known WinAPI function:

BOOL WINAPI RegisterHotKey(
  __in_opt  HWND hWnd,
  __in      int id,
  __in      UINT fsModifiers,
  __in      UINT vk
);

I see that I supposedly can only use the MOD_ALT, MOD_CONTROL, MOD_SHIFT, MOD_WIN keys, as well as MOD_NOREPEAT.

So I can use the following to create a system-wide hotkey for, say, the A key for the Shift+A combination:

RegisterHotKey(NULL,1,MOD_SHIFT,0x41);

Now the important question:

How can I use the state of either the NUM LOCK / SCROLL LOCK / CAPS LOCK (just like MOD_SHIFT and the other ones) as modifiers of a system-wide hotkey that I shall register, such that the registered key for the key combination behaves as a hotkey when any of such “LOCK” keys are turned on, and also behaves as a normal, non-trapped key when either of the “LOCK” keys are turned off?

I think that a timer and monitoring with something like GetKeyState(VK_NUMLOCK)&0xFFFF to register/unregister hotkeys would be too sloppy of a solution, maybe would slow down or interfere with the system performance, and it sounds like an incomplete way to proceed since it has to do with system-wide key behavior.

What better ways are there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:57:33+00:00Added an answer on May 22, 2026 at 12:57 pm

    Depending on the situation I would probably just check for the state of a “LOCK” key at the beginning of your event code.

    Otherwise if you really wanted to you can use SetWindowsHookEx to create a keyboard hook to do your monitoring.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following function which works very well within a $(document).ready(function(){ $('.threadWrapper >
I have been using the SeparatedListAdapter which is very well known and works perfectly,
I have a JavaScript snippet that runs very well on Firefox and Safari, but
I have implemented lucene for my application and it works very well unless you
Drupal has a very well-architected, jQuery -based autocomplete.js . Usually, you don't have to
I have a problem with debugging sessions. My program executes very well in a
I have HTML page where windows media player is embedded. It works very well
Well, I think I have a very basic doubt here: I'm developing an app
I'm very much new to programming and have been doing fairly well so far.
Gday All, I know this issue is well known, however I have searched high

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.