Page 1 of 1

WINAPI System Modal

Posted: Wed Jan 14, 2004 8:52 pm
by Xqzzy Rcxmcq
Can somebody give me the function name for the System Modal function in the Windows API?
Thanks.

Re:WINAPI System Modal

Posted: Thu Jan 15, 2004 8:13 am
by Tim
Assuming you mean "how do I create a system modal dialog in Win32?", you can't.

Re:WINAPI System Modal

Posted: Thu Jan 15, 2004 6:36 pm
by Xqzzy Rcxmcq
Well, I'm just talking about a standard Visual Basic form. Not a dialog box.

Re:WINAPI System Modal

Posted: Fri Jan 16, 2004 3:17 am
by Tim
Same thing. What are you trying to achieve?

Re:WINAPI System Modal

Posted: Mon Jan 19, 2004 8:00 am
by ark
What Tim is saying is that Microsoft removed the ability to create system modal windows starting with Windows 95, so that no application could hold up the entire system. The "system modal" that currently exists essentially is just a setting for the window to always stay on top (WS_EX_TOPMOST is the style, IIRC).

Having explained that, it goes back to Tim's question of what you are trying to achieve. System modal is generally undesirable for the user, and it was really intended to provide absolutely critical information to the user. If you tell us what you are trying to do, we might be able to give you some better alternatives.

Re:WINAPI System Modal

Posted: Fri Jan 23, 2004 8:45 pm
by Xqzzy Rcxmcq
I want the user to not be able to have the window lose the focus. Also, the user cannot click Start, etc. on the taskbar. This is a computer locking program that requires a password to unlock the system.

Thanks.

Re:WINAPI System Modal

Posted: Sat Jan 24, 2004 9:33 am
by Tim
Depending on the type of Windows you're using, you can't completely lock the system. On any version of Windows you'll be able to press Ctrl+Alt+Del. On Win95/98/Millenium this brings up a dialog where you can kill your lock program. On NT/2000/XP you get the Windows Security dialog where you can run Task Manager and do pretty much whatever you like.

If you are running on one of the NT operating systems, you should use the normal Lock Computer function to lock the computer. This will require you to enter the logged-on user's password to continue, and you can do this through your program by calling LockWorkStation.

Re:WINAPI System Modal

Posted: Mon Jan 26, 2004 7:05 am
by Candy
Xqzzy Rcxmcq wrote: I want the user to not be able to have the window lose the focus. Also, the user cannot click Start, etc. on the taskbar. This is a computer locking program that requires a password to unlock the system.

Thanks.
obvious answer:

Code: Select all

Window::LostFocus() {
   this->setFocus();
}
otherwise, the official ways (see Tim's reply)(.

Re:WINAPI System Modal

Posted: Mon Jan 26, 2004 6:40 pm
by ark
I don't believe that takes care of Tim's point that there is always Ctrl+Alt+Delete.

Re:WINAPI System Modal

Posted: Tue Jan 27, 2004 5:51 am
by Candy
Joel wrote: I don't believe that takes care of Tim's point that there is always Ctrl+Alt+Delete.
Windows is by design incapable of letting a simple application take over the system. It would make for quite a security risk (imagine a virus that takes over your corporate computer and won't let you access it until you pay the author $10). Don't try to make something like that, or use the win32 system calls to do it (if you register in some special way it might be possible. Don't think so though).

Re:WINAPI System Modal

Posted: Tue Jan 27, 2004 8:46 am
by Tim
One of the Windows design points is "The user is always in control of their computer". So the user is always able to kill misbehaving applications (given the right permissions -- by default, an unprivileged user can only kill their own processes).

Re:WINAPI System Modal

Posted: Tue Jan 27, 2004 2:34 pm
by sonneveld
Tim Robinson wrote: One of the Windows design points is "The user is always in control of their computer".
Thank God for DRM then hey?

- Nick