Results 1 to 7 of 7

Thread: lOCKING sCREEN

  1. #1

    Thread Starter
    Addicted Member nota141's Avatar
    Join Date
    Feb 2000
    Location
    The place down there under everyone else.
    Posts
    224

    Post

    IS THERE A WAY TO STOP A USER FROM LEAVING YOUR PROGRAM UNTIL YOU EXIT?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Post

    You can always hide the taskbar and disable the Ctrl+Atl+Del/Ctrl+Esc key.

    ______________
    Chris.C
    Software Engineer
    [email protected]

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    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


  4. #4
    Junior Member
    Join Date
    Jan 2000
    Posts
    24

    Post

    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

  5. #5
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    VBModal:
    Form1.show VBModal

    ------------------
    DiGiTaIErRoR
    VB, QBasic, Iptscrae, HTML
    Quote: There are no stupid questions, just stupid people.

  6. #6
    Junior Member
    Join Date
    Jan 2000
    Posts
    24

    Post

    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

  7. #7
    Junior Member
    Join Date
    Jan 2000
    Location
    Skopje,Macedonia
    Posts
    20

    Post

    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
  •  



Click Here to Expand Forum to Full Width