VB6.0怎么屏蔽(Ctrl+Alt+Del)?(相关说明和代码)
1个回答
2013-08-22
展开全部
我们在编程中,为了达到特殊的要求,有时需要屏蔽功能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中加入以下代码:
Dim r As Integer
Dim p As Boolean
r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, p, 0)
实现步骤:
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中加入以下代码:
Dim r As Integer
Dim p As Boolean
r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, p, 0)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询