The information in this article applies to:
SUMMARY
From a Microsoft Visual Basic for Windows program under Windows 95, Windows
98, or Windows 3.x, you can disable the ability to switch to other Windows
programs by calling the Windows API function SetSysModalWindow. The method
outlined below will not work with Windows NT.
MORE INFORMATION
Microsoft Windows is designed so that the user can switch between
applications without terminating one program to run another program. There
may be times when the program needs to take control of the entire
environment and run from only one window, restricting the user from
switching to any other application. An example of this is a simple security
system, or a time-critical application that may need to go uninterrupted
for long periods of time.
At an appropriate place in your code, add the following:
Once this line is executed, your window will be the only window that can get focus until that window is destroyed. NOTE: Because Visual Basic for Windows was not designed with system modal capabilities in mind, using a MsgBox, InputBox, or Form.Show of another form from a system modal window will not work correctly. If you want to show another window from a system modal form, use another Visual Basic for Windows form and call SetSysModalWindow for this second form also, so that it becomes the system modal window. When the second form is unloaded, the original system modal form will again become the system modal window. Note that because the window(s) shown from a system modal window must also call SetSysModalWindow, and since MsgBox/InputBox windows cannot have associated code, you should not call the MsgBox or InputBox functions from a system modal window. Additional query words: kbVBp400 kb16only kbVBp kbDSupport kbdsd kbNoKeyWord
Keywords : kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |