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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:00:49+00:00 2026-05-18T20:00:49+00:00

I am writing an application which runs like a kiosk and should allow user

  • 0

I am writing an application which runs like a kiosk and should allow user to go out of the application. In Windows 7 , when he presses the Win key or CTRL + ALT+ DELETE , it comes out of program. I need to disable the Ctrl+ ALT + DELETE combination key and Win key in Windows 7 programmatically.

  • 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-18T20:00:50+00:00Added an answer on May 18, 2026 at 8:00 pm

    Pressing Alt+Tab will switch out of the application, also. Ctrl+Esc is an alternate shortcut for opening the Start menu. Alt+Esc flips between running applications. There a number of different key sequences that can do this; a natural consequence of Windows being a multitasking operating system.

    To work around this, you’re going to have to install a low-level keyboard hook that can trap these task keys. The hook will watch for any of the common key sequences used to switch tasks. Whenever it detects one of those sequences, it will ignore the input by not passing it down the hook chain. Paul DiLascia wrote an article that addresses this very question in the September 2002 edition of MSDN Magazine. The part you care about starts about halfway down the page, but I’ve reprinted it here for convenience and to get the pleasures of syntax highlighting:

    TaskKeyHook.h:

    ////////////////////////////////////////////////////////////////
    // MSDN Magazine — September 2002
    // If this code works, it was written by Paul DiLascia.
    // If not, I don't know who wrote it.
    // Compiles with Visual Studio 6.0 and Visual Studio .NET on Windows XP.
    //
    #define DLLIMPORT __declspec(dllimport)
    
    DLLIMPORT BOOL DisableTaskKeys(BOOL bEnable, BOOL bBeep);
    DLLIMPORT BOOL AreTaskKeysDisabled();
    

    TaskKeyHook.cpp

    ////////////////////////////////////////////////////////////////
    // MSDN Magazine — September 2002
    // If this code works, it was written by Paul DiLascia.
    // If not, I don't know who wrote it.
    // Compiles with Visual Studio 6.0 and Visual Studio .NET on Windows XP.
    //
    // This file implements the low-level keyboard hook that traps the task 
    // keys.
    //
    #define _WIN32_WINNT 0x0500 // for KBDLLHOOKSTRUCT
    #include <afxwin.h>         // MFC core and standard components
    
    #define DLLEXPORT __declspec(dllexport)
    
    //////////////////
    // App (DLL) object
    //
    class CTaskKeyHookDll : public CWinApp {
    public:
       CTaskKeyHookDll()  { }
       ~CTaskKeyHookDll() { }
    } MyDll;
    
    ////////////////
    // The section is SHARED among all instances of this DLL.
    // A low-level keyboard hook is always a system-wide hook.
    // 
    #pragma data_seg (".mydata")
    HHOOK g_hHookKbdLL = NULL; // hook handle
    BOOL  g_bBeep = FALSE;     // beep on illegal key
    #pragma data_seg ()
    #pragma comment(linker, "/SECTION:.mydata,RWS") // tell linker: make it 
                                                    // shared
    
    /////////////////
    // Low-level keyboard hook:
    // Trap task-switching keys by returning without passing along.
    //
    LRESULT CALLBACK MyTaskKeyHookLL(int nCode, WPARAM wp, LPARAM lp)
    {
       KBDLLHOOKSTRUCT *pkh = (KBDLLHOOKSTRUCT *) lp;
    
       if (nCode==HC_ACTION) {
          BOOL bCtrlKeyDown =
             GetAsyncKeyState(VK_CONTROL)>>((sizeof(SHORT) * 8) - 1);
    
          if ((pkh->vkCode==VK_ESCAPE && bCtrlKeyDown) || // Ctrl+Esc
              // Alt+TAB
              (pkh->vkCode==VK_TAB && pkh->flags & LLKHF_ALTDOWN) ||   
              // Alt+Esc
              (pkh->vkCode==VK_ESCAPE && pkh->flags & LLKHF_ALTDOWN)|| 
              (pkh->vkCode==VK_LWIN || pkh->vkCode==VK_RWIN)) { // Start Menu
             if (g_bBeep && (wp==WM_SYSKEYDOWN||wp==WM_KEYDOWN))
                MessageBeep(0); // only beep on downstroke if requested
             return 1; // gobble it: go directly to jail, do not pass go
          }
       }
       return CallNextHookEx(g_hHookKbdLL, nCode, wp, lp);
    }
    
    //////////////////
    // Are task keys disabled—ie, is hook installed?
    // Note: This assumes there's no other hook that does the same thing!
    //
    DLLEXPORT BOOL AreTaskKeysDisabled()
    {
       return g_hHookKbdLL != NULL;
    }
    
    //////////////////
    // Disable task keys: install low-level kbd hook.
    // Return whether currently disabled or not.
    //
    DLLEXPORT BOOL DisableTaskKeys(BOOL bDisable, BOOL bBeep)
    {
       if (bDisable) {
          if (!g_hHookKbdLL) {
             g_hHookKbdLL = SetWindowsHookEx(WH_KEYBOARD_LL,
                MyTaskKeyHookLL, MyDll.m_hInstance, 0);
          }
    
       } else if (g_hHookKbdLL != NULL) {
          UnhookWindowsHookEx(g_hHookKbdLL);
          g_hHookKbdLL = NULL;
       }
       g_bBeep = bBeep;
    
       return AreTaskKeysDisabled();
    }
    

    He also provides sample code to disable the taskbar (thus preventing the Windows key from showing the Start menu) and a complete sample application that uses these libraries.

    As far as preventing Ctrl+Alt+Del (the secure attention sequence, or SAS), the above approach is not going to work. The reason is that the OS traps the hardware interrupt generated by the SAS separately from other keys, specifically to prevent programs from hooking the sequence and spoofing a login prompt. You aren’t going to be able to disable this feature with a keyboard hook. The article I linked to above does cover this requirement in great detail at the top portion, but those strategies are only tested and more than likely will only work on Windows XP. Another approach suggested by the article is to disable the Task Manager, but note that that won’t stop the user from shutting down the system, etc. The right way to do this is to write a keyboard driver.

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

Sidebar

Related Questions

I am writing an application which runs like a kiosk and should allow user
I'm writing a java application which runs on the local machine, it needs to
I'm writing an add-in for an application which runs in 64 bit, however I
I'm writing an application in Python with Postgresql 8.3 which runs on several machines
I am writing Java application, which is totally GUI-less. It runs in terminal through
I have an application having a thread which runs continously,writing to a file.And it
I'm writing a client application which runs on a users computer and sends various
I am writing a slide-show like application for android phone which I am going
I'm writing an application which is quite graphically heavy and therefore I'm trying to
I am writing an application which is going to allows users to change the

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.