|
-
Aug 18th, 2000, 02:04 AM
#1
Thread Starter
Hyperactive Member
Is their a way to disable windows from being able to shut down? Granted you could just hit the power switch. But I have 2 computers networked, and i use them both and at times people shut off the other one while I am useing it. I want to make it so I can tell windows not to let it shut down. So the only way you could shut down the comp would be by hitting the power switch.
-
Aug 18th, 2000, 02:12 AM
#2
ummmmm....
you could subclass so the user can not click the "**** down" on the start menu, and you would also have to subclass so when ctrl-alt-del is hit twice it wouldnt do anything,
this would require a DLL in made in C++ though, and I dont really know how to do any of it... I am just giving you ideas
-
Aug 18th, 2000, 02:22 AM
#3
transcendental analytic
I haven't used it but it should do the trick i think
Code:
Declare Function AbortSystemShutdown Lib "advapi32.dll" Alias "AbortSystemShutdownA" (ByVal lpMachineName As String) As Long
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 18th, 2000, 02:32 AM
#4
Guru
Nah...
MSDN says:
The InitiateSystemShutdown function displays a dialog box that notifies the user that the system is shutting down.
During the InitiateSystemShutdown time-out period, the AbortSystemShutdown function can prevent the system from shutting down.
Also, it's only for NT, and, your program must have a certain privilege (from what I remember, setting privileges on NT is more trouble than it's worth).
Even hooks (like denniswrenn suggested) aren't "allowed" to disable shutting Windows down.
Besides, are you sure you don't want Windows to ever shut down?
-
Aug 18th, 2000, 03:07 AM
#5
transcendental analytic
But i'm sure there is a way, for instance if you cancel notepad with typed text in it, shutdown will automatically abort At least you could shell notepad, send a little text, alt F4 and then press cancel
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 18th, 2000, 03:16 AM
#6
Guru
Try it the "notepad method". (Not sure if it will work)
Create a form with Visible = False and add this code.
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = True
End Sub
-
Aug 18th, 2000, 03:25 AM
#7
Fanatic Member
-
Aug 18th, 2000, 03:27 AM
#8
transcendental analytic
It works! I can't believe it
hmm, ok anyway ctrl-alt-del can be disabled also:
Code:
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
SystemParametersInfo 97, bDisabled, CStr(1), 0
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 18th, 2000, 03:39 AM
#9
-
Aug 18th, 2000, 12:22 PM
#10
transcendental analytic
WoW! WoW! and WOW again
Sorry i didn't notice that it actually was Yonatan , welcome back!
Yep, you are disbled from everything except to press that power or reset button
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 18th, 2000, 01:07 PM
#11
How is vbAppWindows used?
unloadmode - A value or constant indicating the cause of the QueryUnload event, as described in Return Values.
vbAppWindows - 2 - The current Microsoft Windows operating environment session is ending.
http://forums.vb-world.net/showthrea...threadid=21294
Code:
If UnloadMode = vbAppWindows Then
Shell "C:\yourapppath\yourapp.exe", vbNormalFocus
End If
End Sub
You Shell a program upon shutting down, but how would you stop Windows? Would it be something like:
Code:
If UnloadMode = vbAppWindows Then Cancel = True
-
Aug 18th, 2000, 02:14 PM
#12
Guru
Put it all together, in a huge mess, and it somehow works. 
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbAppWindows Then
Call Shell("C:\YourAppPath\YourApp.Exe", vbNormalFocus)
Cancel = True
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|