15356.html
来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 178 行
HTML
178 行
<HTML>
<HEAD>
<TITLE>HOWTO: Block CTRL+ALT+DEL and ALT+TAB in Windows 95</TITLE>
<!--STYLE_START-->
<style>@import url(/msdn_ie4.css);</style>
<link disabled rel="stylesheet" href="/msdn_ie3.css">
<!--STYLE_END-->
<META NAME="nyms" CONTENT="QAMN,QAH4,QDL9,QBWQ,QBWO,QBWN,QBS0,QBVV,QA4P,QAFF,QAGB,QBXS,QA5B,QAQT,QARP V02180118">
</HEAD>
<BODY BGCOLOR="#FFFFFF" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0">
<!-- #include virtual="/library/include/server.inc" -->
<!--DOCBODY_START-->
<BR>
<CENTER>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" VALIGN="top" WIDTH="90%">
<TR>
<TD VALIGN="top">
<H1>HOWTO: Block CTRL+ALT+DEL and ALT+TAB in Windows 95</H1>
<P ALIGN="right">
<FONT FACE="verdana,arial,helvetica" SIZE="2"><B>Last reviewed: August 7, 1998</B></FONT><BR>
<FONT FACE="verdana,arial,helvetica" SIZE="2"><B>Article ID: Q161133</B></FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</CENTER>
<CENTER>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" VALIGN="top" WIDTH="90%">
<TR>
<TD>
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2>
The information in this article applies to:
<UL><LI>Microsoft Visual Basic for Windows Learning, Professional, and
Enterprise Editions, version 6.0
<LI>Learning, Professional, and Enterprise Editions of Microsoft Visual
Basic for Windows, version 5.0
<LI>Standard, Professional, and Enterprise Editions of Microsoft
Visual Basic, 32-bit only, for Windows, version 4.0
</UL>
<P>
WARNING: ANY USE OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK.
Microsoft provides this code "as is" without warranty of any kind, either
express or implied, including but not limited to the implied warranties of
merchantability and/or fitness for a particular purpose.
<P>
<P><h2>SUMMARY</h2>
<P>
You can prevent the CTRL+ALT+DEL and ALT+TAB key combinations from bringing
up a task list in Windows 95 by calling the SystemParametersInfo function
in the Win32 API. A step-by-step example of this appears below.
<P>
NOTE: This is possible only in Windows 95.
<P>
<P><h2>MORE INFORMATION</h2>
<P>
Sometimes it is necessary for a program to prevent the use of the
CTRL+ALT+DEL key combination to bring up the Close Program task list to end
a task or shut down Windows 95 and to prevent the use of the ALT+TAB key
combination to switch tasks. The following technique uses the
SystemParametersInfo API to trick Windows 95 into thinking that a screen
saver is running. As a side effect, CTRL+ALT+DEL and ALT+TAB are disabled.
<P>
The Win32 SDK states:
<P>
<PRE> "SPI_SCREENSAVERRUNNING Windows 95: Used internally; applications should
not use this flag. Windows NT: Not supported."
</PRE>Note that disabling CTRL+ALT+DEL is not recommended because the Close
Program dialog box was created to enable users to terminate misbehaving
applications. If a program "hangs" while CTRL+ALT+DEL is disabled, it may
not be possible to terminate it by any method other than rebooting the
machine, which could result in the loss of data. Also, this technique may
not work in future versions of Windows.
<P>
<P><h3>Step-by-Step Example</h3>
<OL><P><LI>Start a new Standard EXE project. Form1 is created by default.
<P><LI>Add two CommandButton controls (Command1 and Command2) to Form1.
<P><LI>Add the following code to Form1's General Declarations section:
<P>
<P><PRE> Private Const SPI_SCREENSAVERRUNNING = 97&
Private Declare Function SystemParametersInfo Lib "User32" _
<PRE></PRE> Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
lpvParam As Any, _
ByVal fuWinIni As Long) As Long
Private Sub Form_Load()
Command1.Caption = "Disabled"
Command2.Caption = "Enabled"
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Re-enable CTRL+ALT+DEL and ALT+TAB before the program terminates.
Command2_Click
End Sub
Private Sub Command1_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, _
blnOld, _
0&)
End Sub
Private Sub Command2_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, _
blnOld, _
0&)
End Sub
</PRE><P><LI>Press the F5 key to run the program, and click the "Disabled"
CommandButton. CTRL+ALT+DEL and ALT+TAB are disabled. Click the
"Enabled" CommandButton to enable CTRL+ALT+DEL and ALT+TAB again.
<P></OL>
</FONT>
</TD>
</TR>
</TABLE>
<P>
<!--DOCBODY_END-->
<!--FOOTER_START-->
<HR WIDTH="90%">
<TABLE CELLPADDING="5" BORDER="0" WIDTH="90%">
<TR>
<TD>
<BLOCKQUOTE>
<FONT FACE="Verdana, Arial, Helvetica" SIZE="1">
<SPAN STYLE="font-family:verdana,arial,helvetica; font-size:8pt">
Additional query words: kbVBp400 kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport<BR>
reboot SetSysModalWindow KBWIN32SDK KBAPI<BR>
Platform : WINDOWS<BR>
Issue type : kbhowto<BR>
</SPAN>
</FONT>
</BLOCKQUOTE>
</TD>
</TR>
</TABLE>
<CENTER>
<P>
<!--LAST_REVIEWED_DATE_START-->
<FONT FACE="Verdana,Arial,Helvetica" SIZE="1">Last reviewed: August 7, 1998<BR>
<!--LAST_REVIEWED_DATE_END-->
<!--COPYRIGHT_START-->
© 1998 Microsoft Corporation. All rights reserved. <A HREF="../cpyright.htm" STYLE="font: bold 7pt Verdana,Arial,Helvetica">Terms of Use.</A></FONT><BR>
<!--COPYRIGHT_END-->
</CENTER>
<!--FOOTER_END-->
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?