Results 1 to 7 of 7

Thread: System modal program

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Talking

    Hello!

    Does anyone know how can I make my program (form) system modal, so noone could use windows until I enter pass and unload program?

    Regards
    Zvonko
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2
    New Member
    Join Date
    Jul 2000
    Posts
    6

    Cool System Modal Window

    Hi!

    This might work, but I'm not sure. I got it out of an old VB-Knowledge base help file:


    [Declarations:]
    Private Declare Function SetSysModalWindow Lib "User32" (ByVal hWnd) as Integer

    [Code:]
    Return=SetSysModalWindow(hWnd)


    Give it a go and see if it works!
    Here is my suggestion. If you don't like it, bite me.

  3. #3
    Guest
    Code:
    Me.Show vbModal
    This is the way to show it using General VB Code. This will disable every form only allowing that form to be accessed. But since this in in Api, I guess you wanted the API way.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    And how can I "UnSet" it?
    It would be funny if I set it and if then I have to restart windows because I would be unable to "UnSet" it...
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  5. #5
    Guest
    Just unload the form.

  6. #6
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282

    modal

    Using the Me.Show vbModal method will put your form on top until it's cleared but it won't stop the user from bring other applications forward. I think you're after locking down windows until your form is cleared ? Sorry to say, that function SetSysModalWindow only works under 16-bit windows. According to Technet it can't be done with 32 bit Windows.

    However, you could put a timer on a form and everytime it goes off - say every second execute

    Me.SetFocus

    this would keep bringing your form ( and app. ) to the front. However, this also stops users from typing text into the form because the focus is taken away from the controls on the form to the form itself.

    Hope this helps.
    That's Mr Mullet to you, you mulletless wonder.

  7. #7
    New Member
    Join Date
    Jul 2000
    Posts
    6

    SetSysModelWindow

    True, this API will only work in 16-bit windows, or if you write a 16-bit program and run THAT in 32-bit windows. I.e. use SetSysModelWindow in Visual Basic 3 or 4 16-bit and the program will work in 32-bit windows. A bit impractical, though...
    Here is my suggestion. If you don't like it, bite me.

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