how to disable alt+tab ,alt+f4

how to disable alt+tab ,alt+f4
LVL 1
zhangyunchaoAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
scooter1Connect With a Mentor Commented:
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
 
jhanceCommented:
SetWindowsHookEx
0
 
zhangyunchaoAuthor Commented:
i have used setwindowshookex .it seems that can hook some other keys but alt+f4
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
ZoppoCommented:
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
 
scooter1Commented:
oh i was not aware of that, thanks for telling me. :o)
0
 
load_o_crapCommented:
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
 
scooter1Commented:
load o crap, this will not work of alt-tab or alt-f4 because they are system wide
0
 
MFCAnswerCommented:
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
 
MFCAnswerCommented:
did u check the link i mentioned !!
0
 
ZoppoCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.