VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 屏蔽CTRL+ALT+DEL键
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:11657, 日期:2001-06-14
屏蔽CTRL+ALT+DEL键

  我们在编程中,为了达到特殊的要求,有时需要屏蔽功能CTRL+ALT+DLE,本示例程序将教你如何实现它。

  实现步骤:

  1.建立一个新项目,将其命名为DEMO3.vbp。

  2.在Form1窗体的声明中加入以下代码:

Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Const SPI_SCREENSAVERRUNNING = 97


  3. 在Form1窗口的Command1_Click中加入以下代码:

Private Sub Command1_Click()
Dim r As Integer
Dim p As Boolean
If Command1.Caption = "屏蔽" Then
r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, p, 0)
Command1.Caption = "有效"
Else
r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, p, 0)
Command1.Caption = "屏蔽"
End If
End Sub


  4. 在Form1窗体的Form_Unload中加入以下代码:

Form1_Unload()
Dim r As Integer
Dim p As Boolean
r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, p, 0)