|
-
Feb 10th, 2000, 09:00 AM
#1
Thread Starter
Addicted Member
IS THERE A WAY TO STOP A USER FROM LEAVING YOUR PROGRAM UNTIL YOU EXIT?
-
Feb 10th, 2000, 01:15 PM
#2
-
Feb 11th, 2000, 02:17 AM
#3
Frenzied Member
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:
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
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:
'To disable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(True)
'To enable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(False)
Again, I still can't get this to work for WinNT. If anyone knows how, please reply!!!
Now, here is how to show and hide the taskbar.
Put this in a module:
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
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.
Here's the form code:
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
Hope this helps,
~seaweed
-
Feb 11th, 2000, 06:43 AM
#4
Junior Member
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
-
Feb 11th, 2000, 06:46 AM
#5
So Unbanned
VBModal:
Form1.show VBModal
------------------
DiGiTaIErRoR
VB, QBasic, Iptscrae, HTML
Quote: There are no stupid questions, just stupid people.
-
Feb 11th, 2000, 06:51 AM
#6
Junior Member
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
-
Feb 13th, 2000, 02:55 AM
#7
Junior Member
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...)
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:
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
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:
'To disable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(True)
'To enable Ctrl-Alt-Delete:
Call DisableCtrlAltDel(False)
Again, I still can't get this to work for WinNT. If anyone knows how, please reply!!!
Now, here is how to show and hide the taskbar.
Put this in a module:
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
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.
Here's the form code:
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
Hope this helps,
~seaweed
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
|