Click to See Complete Forum and Search --> : System modal program
Zvonko
Jun 16th, 2000, 06:59 PM
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
djhayman
Jul 13th, 2000, 11:37 AM
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!
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.
Zvonko
Jul 13th, 2000, 12:46 PM
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...
Paul Warren
Jul 13th, 2000, 02:42 PM
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.
djhayman
Jul 19th, 2000, 10:44 PM
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...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.