Posted: Tue Mar 18, 2003 12:56 pm
Restored from previous forum. Originally posted by lee__48.
I want to write a simple program to lock Windows, as an alternative to a screensaver. I did write a similar program from the Amiga years ago, but it had the problem that you could switch between screens using a keyboard shortcut.
I found the code below on AllAPI.net, it is VB code to disable CTRL-ALT-DEL, ALT-TAB, and CTRL-ESC by tricking Windows into thinking a screensaver is running.
Does anyone know how to do something similar in PureBasic, or perhaps, can convert the code below. I would prefer to keep CTRL-ALT-DEL. I have code to remove the program from the CTRL-ALT-DEL list. It could prove slightly safer to keep the CTRL-ALT-DEL incase the program crashes!
Cheers,
Lee.
Private Const SPI_SCREENSAVERRUNNING = 97&
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 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
I want to write a simple program to lock Windows, as an alternative to a screensaver. I did write a similar program from the Amiga years ago, but it had the problem that you could switch between screens using a keyboard shortcut.
I found the code below on AllAPI.net, it is VB code to disable CTRL-ALT-DEL, ALT-TAB, and CTRL-ESC by tricking Windows into thinking a screensaver is running.
Does anyone know how to do something similar in PureBasic, or perhaps, can convert the code below. I would prefer to keep CTRL-ALT-DEL. I have code to remove the program from the CTRL-ALT-DEL list. It could prove slightly safer to keep the CTRL-ALT-DEL incase the program crashes!
Cheers,
Lee.
Private Const SPI_SCREENSAVERRUNNING = 97&
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 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