Solved

how to disable alt+tab ,alt+f4

Posted on 2000-03-04
10
536 Views
Last Modified: 2013-11-20
how to disable alt+tab ,alt+f4
0
Comment
Question by:zhangyunchao
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2584643
SetWindowsHookEx
0
 
LVL 1

Author Comment

by:zhangyunchao
ID: 2584885
i have used setwindowshookex .it seems that can hook some other keys but alt+f4
0
 

Accepted Solution

by:
scooter1 earned 100 total points
ID: 2586108
Try this it disables several task switching keys.

SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);

Note be sure to call false before closing your App.

SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 31

Expert Comment

by:Zoppo
ID: 2587535
hi scooter1, unfortunately your solution's not working for NT, only Win9x...

hi zhangyunchao,

because it seems you have posted this question twice I post my comment here too,

you can use RegisterHotkey to do this, i.e.:

RegisterHotKey( m_hWnd, 1, MOD_ALT, VK_TAB );
RegisterHotKey( m_hWnd, 2, MOD_ALT, VK_F4 );

ZOPPO
0
 

Expert Comment

by:scooter1
ID: 2588336
oh i was not aware of that, thanks for telling me. :o)
0
 

Expert Comment

by:load_o_crap
ID: 2589731
Add a pretranslate message on your WinApp. The sample below disables the Escape key so if im guessing correctly u can always  try getting the Macro for Alt-Tab and Alt-F4 to disable those 2 keys.

BOOL CYourApp::PreTranslateMessage(MSG* pMsg)
{
      if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
            return TRUE;
    } else  
          return CWinApp::PreTranslateMessage(pMsg);
      
}

ok.
0
 

Expert Comment

by:scooter1
ID: 2590065
load o crap, this will not work of alt-tab or alt-f4 because they are system wide
0
 
LVL 1

Expert Comment

by:MFCAnswer
ID: 2638227
have a look at the following url on msdn
"http://support.microsoft.com/support/kb/articles/Q226/3/59.ASP".
Its title is
"HOWTO: Disable Task Switching on Win32 Platforms"

hope it helps
0
 
LVL 1

Expert Comment

by:MFCAnswer
ID: 2642526
did u check the link i mentioned !!
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 2643719
MFCAnswer, I think the link doesn't point to anything new. All of these three possibilities where suggested earlier: SetWindowsHookEx, SystemParametersInfo and RegisterHotKey.

Seems we'll just have to wait if zhangyunchao will respond ...

ZOPPO
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 54
WinWaitActive parameters 12 31
Problem to open Excel file 15 175
Way to decrease size of apk file 9 86
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question