我们在编程中,为了达到特殊的要求,有时需要屏蔽功能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)