Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2002.09.09;
Скачать: [xml.tar.bz2];

Вниз

Отключение меню Пуск   Найти похожие ветки 

 
Данилин Руслан   (2002-07-19 14:04) [0]

Как сделать, чтобы по нажвтию Ctrl + Esc меню не всплывало.


 
Eugene Lachinov   (2002-07-19 14:29) [1]

HOWTO: Disable Task Switching on Win32 Platforms
ID: Q226359



--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft Win32 Application Programming Interface (API), included with:
Microsoft Windows versions 95, 98
Microsoft Windows 2000
Microsoft Windows NT, versions 3.51, 4.0

--------------------------------------------------------------------------------


SUMMARY
This article describes how to disable task switching and other system functions accessed through key combinations such as CTRL+ESC and ATL+TAB on Win32 Platforms.

Windows 95 and Windows 98
Applications can enable and disable ALT+TAB and CTRL+ESC, for example, by calling SystemParametersInfo (SPI_SETSCREENSAVERRUNNING). To disable ALT+TAB and CTRL+ESC, set the uiParam parameter to TRUE; to enable the key combinations, set the parameter to FALSE:

UINT nPreviousState;

// Disables task switching
SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);

// Enables task switching
SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
NOTE: Applications that use SystemParametersInfo (SPI_SETSCREENSAVERRUNNING) to disable task switching must enable task switching before exiting or task switching remains disabled after the process terminates.
Windows NT 4.0 Service Pack 3 and Later and Windows 2000
Applications can disable ALT+TAB or CTRL+ESC by installing a low-level keyboard hook. A low-level keyboard hook (WH_KEYBOARD_LL) is installed by calling SetWindowsHookEx. For more information on Window hooks see the "Hooks" overview in the Platform SDK documentation.

The following is a sample low-level keyboard hook procedure that disables CTRL+ESC, ALT+TAB, and ALT+ESC:


LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam)
{
// By returning a non-zero value from the hook procedure, the
// message does not get passed to the target window
KBDLLHOOKSTRUCT *pkbhs = (KBDLLHOOKSTRUCT *) lParam;
BOOL bControlKeyDown = 0;

switch (nCode)
{
case HC_ACTION:
{
// Check to see if the CTRL key is pressed
bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);

// Disable CTRL+ESC
if (pkbhs->vkCode == VK_ESCAPE && bControlKeyDown)
return 1;

// Disable ALT+TAB
if (pkbhs->vkCode == VK_TAB && pkbhs->flags & LLKHF_ALTDOWN)
return 1;

// Disable ALT+ESC
if (pkbhs->vkCode == VK_ESCAPE && pkbhs->flags & LLKHF_ALTDOWN)
return 1;

break;
}

default:
break;
}
return CallNextHookEx (hHook, nCode, wParam, lParam);
}
Windows NT 4.0 Service Pack 2 and Earlier, Windows NT 3.51 and Earlier
Applications can disable CTRL+ESC system-wide by replacing the Windows NT Task Manager, but this is not recommended.

Applications can disable ALT+TAB and ALT+ESC when the application is running by registering hotkeys for the ALT+TAB and ALT+ESC combinations by calling RegisterHotKey.



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2002.09.09;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.006 c
14-27211
Лысый
2002-08-11 18:56
2002.09.09
LMDTools 6.1


7-27251
Alex Krupnitskiy
2002-06-28 13:33
2002.09.09
Несовместимость Delphi 5 с Windows 95 и NT


8-27116
Di
2002-04-30 20:06
2002.09.09
Как


1-27090
Radimir
2002-08-28 17:11
2002.09.09
словарная база


1-26977
VZ-KZ
2002-08-29 15:34
2002.09.09
E-mail





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский