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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:12:42+00:00 2026-06-10T00:12:42+00:00

I want to put inside a software the necessary codes for it to disable

  • 0

I want to put inside a software the necessary codes for it to disable Windows (Xp, Vista, specially 7 and sucessors) hotkeys that could allow the user to get away from the software.

Details:

  • The commands must be valid only while the software is running; when its not running, Windows hotkeys must be enabled (so: if the user starts the software, the hotkeys are disable; if he closes it, must be re-enabled).
  • I don’t want to disable all windows hotkeys (some key hotkeys such as ctrl+alt+del must still be operational), so solutions such as some sort of windows configuration that disable all hotkeys are useless for me. I must be capable of specifically select which hotkeys I want to continue working and which I don’t.
  • The “hotkey” nickname includes the Windows button.
  • The code must be either using C++ or Windows functions.
  • Preferetially without requiering to terminate explorer.exe.

I did look at a post here in stackoverflow that had a very similiar case as mine (Prevent users from quitting a windows application via system hotkeys), but as far as I understood nether of the solutions presented were applicable to my specific situation, and I didn’t find anything in the web as well.

  • 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-06-10T00:12:43+00:00Added an answer on June 10, 2026 at 12:12 am

    Ok, I got how to do it. The code is able to create a sistem-wide hook without DLL using a low level keyboard hook. Here is the code (better that explaining)(using Qt):

    //Installing the hook
    SWH_return = SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,GetModuleHandle(NULL),0);
    
    if (SWH_return != NULL)
        qDebug() << "Hook true";
    else
        qDebug() << "Hook false";
    
    //Uninstalling the hook
    bool teste = false;
    
    teste = UnhookWindowsHookEx(SWH_return);
    
    if (teste)
        qDebug() << "Unhook: true";
    else
        qDebug() << "Unhook: false";
    
    //The function responsible for detecting the keystrokes
    LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
    {
    if (nCode < 0)
        return CallNextHookEx(NULL, nCode, wParam, lParam);
    
    tagKBDLLHOOKSTRUCT *str = (tagKBDLLHOOKSTRUCT *)lParam;
    
    switch(str->flags)
    {
        case (LLKHF_ALTDOWN):
            qDebug() << "ALT";
            delete str;
        return 1;
    }
    
    if (wParam == WM_KEYDOWN)
    {
        switch (str->vkCode)
        {
            case VK_RWIN:
            case VK_LWIN:
            case VK_LCONTROL:
            case VK_RCONTROL:
            case VK_APPS:
            case VK_SLEEP:
            case VK_MENU:
                qDebug() << "SPECIAL PRESS";
                delete str;
            return 1;
        }
    }
    
    return CallNextHookEx(NULL, nCode, wParam, lParam);
    }
    

    This last function don’t need any declaration in the .h or in the .cpp file. It blocks inputs of Ctrl, Windows Key and Alt. The other two must be placed respectively in the functions where the user wants to begin the key disabling and when he want it to stop.

    Thanks,

    Momergil.

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

Sidebar

Related Questions

I have a series of data that I want to put inside an array
I have a few different Google Charts that i want to put inside the
I have some images that I want to put inside a bubble. The bubbles
I put a file inside my Java project file and i want to read
How to put a UITextField inside of a UITableViewCell (grouped)? I want a user
Can I put java code inside the .jrxml? For example, I want to put
I have a <p></p> and I want to put a text inside it a
I m using jquerymobile, I want to put content inside the page fetched by
I have a simple button and I want to put an image inside, so
I having a asp text box and i want to put image inside it,

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.