Главная страница | назад





Article #17102: How do I prevent task switching in my application?

 Question and Answer Database
FAQ2102C.txt How do I prevent task switching in my application?
Category :Windows API
Platform :All
Product :C++Builder 1.x
Question:
How do I prevent task switching (Alt-Tab, Ctrl-Esc,
Ctrl-Alt-Del) in my application?
Answer:
Preventing a user from switching to another application is
possible under Windows 95 and earlier versions of Windows by
tricking Windows into thinking the screen saver is running.
This method does not work under Windows NT, and is not guaranteed
to be available in future versions of Windows. Many versions of
Windows may also respond to a task switching trap installed by a
CBT (Computer Based Training) application hook. To prevent task
switching under Windows NT, you will need access to a third party
keyboard device device driver.
The following code will trick Windows 3.1/95 into believing that the screen
saver is running:
unsigned long OldValue;
//turns trap on
SystemParametersInfo(97, true, &OldValue, 0);
//turns trap off
SystemParametersInfo(97, false, &OldValue, 0);
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99