|
'ВАРИАНТ 1
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam
As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_SCREENSAVERRUNNING = 97&
Public Sub AllowKeys(bParam As Boolean)
Dim lRetVal As Long, bOld As Boolean
lRetVal = SystemParametersInfo(SPI_SCREENSAVERRUNNING, bParam, bOld, 0&)
End Sub
Private Sub Form_Load()
Call AllowKeys(True) 'блокировка сочетаний
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call AllowKeys(False) 'разблокировка сочетаний
End Sub
'ВАРИАНТ 2
'без дополнительной подпрограммы
'Добавьте два элемента CommandButton. Первая кнопка
блокирует сочетание клавиш, вторая - разрешает.
Const SPI_SCREENSAVERRUNNING = 97
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" _
(ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As
Long) As Long
Private Sub Command1_Click()
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, "1", 0)
End Sub
Private Sub Command2_Click()
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, "1", 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, "1", 0)
End Sub
|
|