faq83.htm

来自「C++builder学习资料C++builder」· HTM 代码 · 共 52 行

HTM
52
字号
<HTML>

<HEAD>

   <TITLE>Disable the CTRL-ALT-DEL dialog on Windows 95/98</TITLE>

   <META NAME="Author" CONTENT="Harold Howe">

</HEAD>

<BODY BGCOLOR="WHITE">



<CENTER>

<TABLE  BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="640">



<TR>

<TD>









<H3>

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

</H3>

<P>

Call the <TT>SystemParametersInfo</TT> 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.

</P>

<pre>

<b>__fastcall</b> TForm1<b>:</b><b>:</b>TForm1<b>(</b>TComponent<b>*</b> Owner<b>)</b>

    <b>:</b> TForm<b>(</b>Owner<b>)</b>

<b>{</b>

    <font color="navy">// Disable CTRL-ALT-DEL construction</font>

    SystemParametersInfo<b>(</b>SPI_SCREENSAVERRUNNING<b>,</b> TRUE <b>,</b> NULL<b>,</b><font color="blue">0</font><b>)</b><b>;</b>

<b>}</b>



<b>__fastcall</b> TForm1<b>:</b><b>:</b><b>~</b>TForm1<b>(</b><b>)</b>

<b>{</b>

    <font color="navy">// Enabled CTRL-ALT-DEL when we close</font>

    SystemParametersInfo<b>(</b>SPI_SCREENSAVERRUNNING<b>,</b> FALSE <b>,</b> NULL<b>,</b><font color="blue">0</font><b>)</b><b>;</b>

<b>}</b>

</pre>

<P>

<B>Note: </B> 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.</P>

<P>

<B>Note: </B> The <TT>SystemParametersInfo</TT> trick does not work on Windows NT.

</P>





</TD> </TR>



</TABLE>

</CENTER>

</BODY>

</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?