-
Nov 3rd, 2000, 11:56 AM
#1
Can you help me find an API call I can use to
disable from VB the Desktop Windows Short-Cut Alt-F4 keys to prevent unauthorized users from closing Windows?
I am able to disable Ctrl-Alt-Del and Alt-Esc.
Thanks!
-
Nov 3rd, 2000, 12:10 PM
#2
You can try this to disable the CTRL-ALT-DEL keys.
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 Disable_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, _
blnOld, _
0&)
End Sub
Private Sub Enable_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo SPI_SCREENSAVERRUNNING, False, _
blnOld, _
0&)
End Sub
-
Nov 3rd, 2000, 12:14 PM
#3
Frenzied Member
Be sure to first read the whole post before answering:
I am able to disable Ctrl-Alt-Del and Alt-Esc.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 3rd, 2000, 12:19 PM
#4
-
Nov 3rd, 2000, 12:23 PM
#5
I think the API you want is 'SetSysModalWindow'
-
Nov 3rd, 2000, 01:31 PM
#6
Fanatic Member
No no, guys, this is the solution:
Code:
'
' Locates the Windows TaskBar
'
Private Function FindShellTaskBar() As Long
Dim hWnd As Long
On Error Resume Next
hWnd = FindWindowEx(0&, 0&, g_cstrShellTaskBarWnd, vbNullString)
If hWnd <> 0 Then
FindShellTaskBar = hWnd
End If
End Function
'
' Locates the shell_defview window
'
Private Function FindShellWindow() As Long
Dim hWnd As Long
On Error Resume Next
hWnd = FindWindowEx(0&, 0&, g_cstrShellViewWnd, vbNullString)
If hWnd <> 0 Then
FindShellWindow = hWnd
End If
End Function
'
' Toggles a window's visibility
'
Private Sub HideShowWindow(ByVal hWnd As Long, Optional ByVal Hide As Boolean = False)
Dim lngShowCmd As Long
On Error Resume Next
If Hide = True Then
lngShowCmd = SW_HIDE
Else
lngShowCmd = SW_SHOW
End If
Call ShowWindow(hWnd, lngShowCmd)
End Sub
Private Sub cdShowDesktop_Click()
Dim hWnd As Long
On Error Resume Next
'// Find the window we're looking for and then hide it
hWnd = FindShellWindow()
If hWnd <> 0 Then
Call HideShowWindow(hWnd)
End If
End Sub
Private Sub cmdHideDesktop_Click()
Dim hWnd As Long
On Error Resume Next
hWnd = FindShellWindow()
If hWnd <> 0 Then
Call HideShowWindow(hWnd, True)
End If
End Sub
Private Sub cmdHideTaskBar_Click()
Dim hWnd As Long
On Error Resume Next
hWnd = FindShellTaskBar()
If hWnd <> 0 Then
Call HideShowWindow(hWnd, True)
End If
End Sub
Private Sub cmdShowTaskBar_Click()
Dim hWnd As Long
On Error Resume Next
hWnd = FindShellTaskBar()
If hWnd <> 0 Then
Call HideShowWindow(hWnd)
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|