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 5938227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:39:18+00:00 2026-05-22T15:39:18+00:00

I am setting up global shortcut keys in Windows, using the RegisterHotKey method public

  • 0

I am setting up global shortcut keys in Windows, using the RegisterHotKey method

public static int MOD_CONTROL = 0x2;
public static int WM_HOTKEY = 0x312;

RegisterHotKey(this.Handle, 0, MOD_CONTROL | MOD_NOREPEAT, 96); 
// ctrl numpad0

The code to process this is:

[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);            

 protected override void WndProc(ref Message m)
    {

        if (m.Msg == WM_HOTKEY)         
        {
            MessageBox.Show("a hotkey is pressed"); //this also only shows in win7

            if (m.WParam.ToInt32() == 0) //ctrl numpad0
            {
                MessageBox.Show("Hotkey ctrl numpad0 pressed"); 
                // works fine in win7

            }

        }
        base.WndProc(ref m);
    }

On my windows 7 PC this works, but in XP or Windows Server 2003 it does not.
Any ideas where it goes wrong?

  • 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-22T15:39:18+00:00Added an answer on May 22, 2026 at 3:39 pm

    Looking at the documentation for RegisterHotKey it states that the MOD_NOREPEAT flag is not supported on Vista/XP/2K. I suspect that this is your problem.

    You should check the return value which would tell you immediately that something is wrong.

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

Sidebar

Related Questions

I'm using version 1.1 of the Three20 library and I'm setting a global style
In my senario, I have a global setting object, say GlobalSettings, it has a
Setting up an integration server, I’m in doubt about the best approach regarding using
Setting up a Windows based web application on Amazon's cloud has definitely been a
Setting up new git installations. On one Windows laptop, I'm running (under cygwin): git
Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
I am thinking of setting up a global, default Exception handler for my (Android)
I would like to access smtp outgoing mail server address from global setting->mail->accounts->outgoing mail
If you set something like this on Windows: git config --global core.autocrlf false Where
I find myself using a combination of global vars and nsrunloop to force synchronization

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.