My question is if my application is running and the user tries to
logoff or shutdown he should not be able to do it.
Printable View
My question is if my application is running and the user tries to
logoff or shutdown he should not be able to do it.
To prevent users from getting or starting other windows set your from to system modal, it blocks ALT-TAB:
You still have to block CTRL-ALT-DEL. Do a search on this forum. Lots of good answers on how to do this.Code:Declare Function SetSysModalWindow Lib "User" (ByVal hwnd%) As Integer
i = SetSysModalWindow(From1.hwnd)
PS: the type of app you're making had better tell users it has locked the sytem and actively shows that its doing something.
It's the kind of thing that makes users angry - angry enough to unplug the PC, because they think it's locked up. My best advice is DON'T DO IT.
For Win9x systems you can stop ctrl-alt-del with:
I do not know how to do this on NTCode: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
Private Const SPI_SETSCREENSAVERRUNNING = 97
' DISABLED = TRUE TO DISABLE CTRL-ALT-DELETE
' DISABLED = FALSE TO RE-ENABLE
Dim lRet As Long
lRet = SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, _
Disabled, 0&, 0&)