IS THERE A WAY TO STOP A USER FROM LEAVING YOUR PROGRAM UNTIL YOU EXIT?
Printable View
IS THERE A WAY TO STOP A USER FROM LEAVING YOUR PROGRAM UNTIL YOU EXIT?
You can always hide the taskbar and disable the Ctrl+Atl+Del/Ctrl+Esc key.
______________
Chris.C :)
Software Engineer
[email protected]
Actually, I dont think there is a way if you are using WinNT. If anyone knows a way, PLEASE tell all!!! I have been trying to do that for a while now.
To disable Ctl-Alt-Del and Alt-Tab in Win95, you need to trick it into thinking your program is a screen saver. Here is an example of creating your own wrapper function for the API call to turn Ctl-Alt-Del on or off:
Put this in a module:
Now, to turn off Ctl-Alt-Del in code, simply pass your new function the value 'True', and to turn it on again, pass it 'False', as in the following example:Code:Option Explicit
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
Public Sub DisableCtrlAltDel(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Again, I still can't get this to work for WinNT. If anyone knows how, please reply!!!Code:'To disable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(True)
'To enable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(False)
Now, here is how to show and hide the taskbar.
Put this in a module:
Add two command buttons to your form, one to show the taskbar, and one to hide it. (Use the default names, Command1 and Command2). The first button (Command1) will hide the taskbar, the second one will show it again.Code:Declare Function SetWindowPos Lib "user32" (ByVal hwnd _
As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal _
wFlags As Long) As Long
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40
Here's the form code:
Hope this helps,Code:Private Sub Command1_Click()
Dim TaskBarHandle As Long
TaskBarHandle = FindWindow("Shell_traywnd", "")
Call SetWindowPos(TaskBarHandle, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub
Private Sub Command2_Click()
Dim TaskBarHandle As Long
TaskBarHandle = FindWindow("Shell_traywnd", "")
Call SetWindowPos(TaskBarHandle, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub
~seaweed
Well, you could try to set the main form to system modal. I don't know how, but there should be some API call for it, since you can do it in C++ and with the MsgBox() function.
Good luck,
------------------
Doomstar
http://surf.to/Doomstar
VBModal:
Form1.show VBModal
------------------
DiGiTaIErRoR
VB, QBasic, Iptscrae, HTML
Quote: There are no stupid questions, just stupid people.
Good point, but note that you either must start your prog with a Sub Main() or must Hide the form (Form1.Hide) in the Load event and then use the code you posted.
------------------
Doomstar
http://surf.to/Doomstar
I solve the NT problem in this way:
Log in as administrator and then find the file taskmgr.exe . In the properties, set the permisions to "no access" for ordinary users. So all users exept administrator will not have access (read, write, delete, execute..)to this exe program, so when a user try the CTRL+ALT+DEL and click to the task manager button it won't work. (But this is not the real solution, you know why...)
Quote:
Originally posted by seaweed:
Actually, I dont think there is a way if you are using WinNT. If anyone knows a way, PLEASE tell all!!! I have been trying to do that for a while now.
To disable Ctl-Alt-Del and Alt-Tab in Win95, you need to trick it into thinking your program is a screen saver. Here is an example of creating your own wrapper function for the API call to turn Ctl-Alt-Del on or off:
Put this in a module:
Now, to turn off Ctl-Alt-Del in code, simply pass your new function the value 'True', and to turn it on again, pass it 'False', as in the following example:Code:Option Explicit
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
Public Sub DisableCtrlAltDel(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Again, I still can't get this to work for WinNT. If anyone knows how, please reply!!!Code:'To disable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(True)
'To enable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(False)
Now, here is how to show and hide the taskbar.
Put this in a module:
Add two command buttons to your form, one to show the taskbar, and one to hide it. (Use the default names, Command1 and Command2). The first button (Command1) will hide the taskbar, the second one will show it again.Code:Declare Function SetWindowPos Lib "user32" (ByVal hwnd _
As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal _
wFlags As Long) As Long
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40
Here's the form code:
Hope this helps,Code:Private Sub Command1_Click()
Dim TaskBarHandle As Long
TaskBarHandle = FindWindow("Shell_traywnd", "")
Call SetWindowPos(TaskBarHandle, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub
Private Sub Command2_Click()
Dim TaskBarHandle As Long
TaskBarHandle = FindWindow("Shell_traywnd", "")
Call SetWindowPos(TaskBarHandle, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub
~seaweed