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

  • SEARCH
  • Home
  • 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 187443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:49:28+00:00 2026-05-11T15:49:28+00:00

I wish to write a small tool that will capture a global event when

  • 0

I wish to write a small tool that will capture a global event when the user presses the Windows button and scrolls the mousewheel up or down. When such an event is captured, I wish to redirect said output to a virtual keystroke combination of Win-+ or Win– (plus/minus). Can this be done?

If the windows key is reserved, ctrl-alt or such would do.

  • 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. 2026-05-11T15:49:29+00:00Added an answer on May 11, 2026 at 3:49 pm

    Since it uses the windows key, the key can be captured globally using a hotkey binding. RegisterHotKey at msdn.

    Edit: It seems the mousewheel events are not treated as keys as I assumed and there is no way to make a global hotkey for them.

    You will have to make a global window message hook and trap the WM_MOUSEWHEEL message. But you may have to do that in C/C++. A C dll to accomplish this is below, you can call Hook and Unhook from C# to enable and disable the function.

    WARNING: I have not tested this code and is provided as a demonstration only.

    #include <windows.h>  HINSTANCE myInstance; HHOOK thehook = 0; BOOL isWinKeyDown = FALSE;  extern 'C' LRESULT __declspec(dllexport)__stdcall CALLBACK HookHandler(int nCode, WPARAM wParam, LPARAM lParam) {     if (nCode == WM_KEYDOWN && (wParam == VK_LWIN || wParam == VK_RWIN))         isWinKeyDown = TRUE;     else if (nCode == WM_KEYUP && (wParam == VK_LWIN || wParam == VK_RWIN))         isWinKeyDown = FALSE;     else if (nCode == WM_MOUSEHWHEEL && isWinKeyDown) {         if (HIWORD(wParam) > 0) { //mousewheel up             CallNextHookEx(thehook, WM_KEYDOWN, VK_ADD, 0);             CallNextHookEx(thehook, WM_KEYUP, VK_ADD, 0);         } else { //mousewheel down             CallNextHookEx(thehook, WM_KEYDOWN, VK_SUBTRACT, 0);             CallNextHookEx(thehook, WM_KEYUP, VK_SUBTRACT, 0);         }         return 0;     }     return CallNextHookEx(thehook, nCode, wParam, lParam); } BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fwdReason, LPVOID lpvReserved) {     switch(fwdReason)     {         case DLL_PROCESS_ATTACH: {             DisableThreadLibraryCalls(hInstance);             myInstance = hInstance;              } break;         case DLL_THREAD_ATTACH:             break;         case DLL_PROCESS_DETACH:              break;         case DLL_THREAD_DETACH:             break;     }     return(TRUE);               // The initialization was successful, a FALSE will abort                                 // the DLL attach }  extern 'C' void __declspec(dllexport) Hook() {     if (!thehook)         thehook = SetWindowsHookEx(WH_CALLWNDPROC, &HookHandler, myInstance, 0); } extern 'C' void __declspec(dllexport) UnHook() {     if (thehook)         UnhookWindowsHookEx(thehook);     thehook = 0; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 349k
  • Answers 349k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You'd do another SQL query inside the while loop. I… May 14, 2026 at 6:44 am
  • Editorial Team
    Editorial Team added an answer The way I see you are setting display for these… May 14, 2026 at 6:44 am
  • Editorial Team
    Editorial Team added an answer I think you should be fine if you simply include… May 14, 2026 at 6:44 am

Related Questions

I am writing a python platform for the simulation of distributed sensor swarms. The
I have a site that has a simple API which can be used via
I am from Java Desktop Application background. May I know what is the best
I am a systems programmer, so i just know some basic css/html. I like

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.