Home Articles Books Downloads FAQs Tips

Q: Disable the CTRL-ALT-DEL dialog on Windows 95/98


Answer

Call the SystemParametersInfo API function and fool the OS into thinking that the screen saver is running. When the screen saver is running, the OS does not activate the CTRL-ALT-DEL dialog.

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    // Disable CTRL-ALT-DEL construction
    SystemParametersInfo(SPI_SCREENSAVERRUNNING, TRUE , NULL,0);
}

__fastcall TForm1::~TForm1()
{
    // Enabled CTRL-ALT-DEL when we close
    SystemParametersInfo(SPI_SCREENSAVERRUNNING, FALSE , NULL,0);
}

Note: Only disable the CTRL-ALT-DEL window if it is absolutely necessary. If your program crashes, the destructor for your form may not run, which would leave the CTRL-ALT-DEL dialog disabled until your user reboots the machine.

Note: The SystemParametersInfo trick does not work on Windows NT.



Copyright © 1997-2000 by Harold Howe.
All rights reserved.