Results 1 to 7 of 7

Thread: System modal

  1. #1
    Guest

    Unhappy

    Hallo

    How can I make a form system modal. In other words, nothing else can be opened on the computer will this one form is not filled in?

    Would appreciate any help....maybe another way of doing it

    Thanx

  2. #2
    Lively Member
    Join Date
    Apr 2000
    Posts
    70

    Talking

    I believe you can.. use..
    Code:
    frmFormName.Show vbModal
    Daniel Rose
    VB 5.0 Enterprise.
    irc:irc2.dynam.ac

    If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()

  3. #3
    Guest
    Hallo

    I tried vbModal, but you can still move between other programs and your application. I want to freeze the whole computer until my form is executed correctly.

    I also tried vbSystemModal, but receive an error (Invalid procedure call....)

    Can anyone help!!!

  4. #4
    Lively Member
    Join Date
    Apr 2000
    Posts
    70
    Sorry, vbmodal on show is only for app modal..
    You can use a msgbox..
    like so:
    Code:
    MsgBox "Prompt", vbOkOnly + vbSystemModal, "Title"
    Daniel Rose
    VB 5.0 Enterprise.
    irc:irc2.dynam.ac

    If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()

  5. #5
    Guest
    Hi

    Form is a login form. The user must complete this form before going on. On accessing the computer, I'm writing a log file....so I cannot use a msgbox. Isn't there something like Lib "user32" that I can use?

  6. #6
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Try This :
    The user will not be able to move the mouse or to use ctrl,alt or delete or do anything.He will only be allowed to do something inside this form.
    Code:
    'in module
    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
    Declare Function ClipCursor Lib "user32.dll" (lpRect As RECT) As Long
    Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Public Const SWP_NOACTIVATE = &H10
    Public Const SWP_NOMOVE = &H2
    Public Const SWP_NOSIZE = &H1
    
    Public 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
    Public Declare Function GetDesktopWindow Lib "user32" () As Long
    Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    
    Sub DisableCtrlAltDelete(bDisabled As Boolean)
        Dim x As Long
        x = SystemParametersInfo(97, bDisabled, CStr(1), 0)
    End Sub
    
    'in form
    
    Private Sub Form_Load()
    Call DisableCtrlAltDelete(True)
    Call SetWindowPos(hwnd, HWND_TOP = 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOACTIVATE Or SWP_NOSIZE)
    Dim r As RECT
    GetWindowRect Form1.hwnd, r
    Call ClipCursor(r)
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    Dim deskh As Long
    Dim deskr As RECT
    deskh = GetDesktopWindow
    GetWindowRect deskh, deskr
    ClipCursor deskr
    Call DisableCtrlAltDelete(False)
    End Sub
    
    'Use something to unload the form
    'Private Sub Form_DblClick()
    'Unload Form1
    'End Sub
    [Edited by Vlatko on 10-20-2000 at 08:12 AM]
    I am become death, the destroyer of worlds.
    mail:vlatkovr@hotmail.com

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  7. #7
    Guest
    Hallo

    Thanx for the code. I'm experiencing one problem....If i run this code from VB it works perfectly, but as soon as I'm running the exe, the mouse is not kept within the window parameters. Is there something that I missed?

    Thanx

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