| View previous topic :: View next topic |
| Author |
Message |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Thu Sep 17, 2009 7:38 pm Post subject: Computer Shutdown |
|
|
When you go to Start -> Turn off or whatever, what code does it execute at that point? Does it use ExitWindows(Ex)?
I'm curious because I want to prevent shutting down the computer using that button. I want it to be shutdown by physically pressing the button on the computer case. So if you have any methods other than hooking ExitWindows that would be appreciated as well. Thanks
_________________
Blog
| Quote: | Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that |
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Sep 17, 2009 10:48 pm Post subject: |
|
|
| Why would you honestly want to do that?
|
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Thu Sep 17, 2009 10:49 pm Post subject: |
|
|
| slovach wrote: | | Why would you honestly want to do that? |
I live with my grandma and she can't seem to remember to not turn it off after every time she checks her email (3-4 times a day)...I tell her over and over to not turn it off.
_________________
Blog
| Quote: | Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that |
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Sep 17, 2009 10:57 pm Post subject: |
|
|
Oh, there's a windows setting somewhere where you set the behavior for hitting the power button in windows.
edit: power saving settings. You can set the power button to do nothing.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 25985 Location: The netherlands
|
Posted: Fri Sep 18, 2009 4:46 am Post subject: |
|
|
I think he means to only shut it off when the power button is pressed and blocking the start->shutdown way
Not sure if that's possible, but perhaps there's a windows policy you can set for that
Or perhaps you could enumerate all the windows in the start menu, find the shutdown item and hide it's window (hidewindow)
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
AIva1110 Advanced Cheater
Reputation: 0
Joined: 16 Sep 2009 Posts: 56 Location: The Void
|
Posted: Fri Sep 18, 2009 6:26 am Post subject: |
|
|
You need to have access to the registry.
Press Start > run
then type "regedit" this opens registry editor, locate these directories:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
check if there is a dword value called "NoClose" if there isn't create it. Set it to 1 to prevent shutdown.
_________________
|
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Fri Sep 18, 2009 7:58 pm Post subject: |
|
|
| Dark Byte wrote: | I think he means to only shut it off when the power button is pressed and blocking the start->shutdown way
Not sure if that's possible, but perhaps there's a windows policy you can set for that
Or perhaps you could enumerate all the windows in the start menu, find the shutdown item and hide it's window (hidewindow) |
Yes you're right about what I want. And that is a possibility. But I'd rather do something that doesn't mess with the appearance of the computer. Is a hook not possible? What about returning a false value to WM_QUERYENDSESSION?
I also found an API that may be what I'm looking for: ShutdownBlockReasonCreate. Would that help or am I misunderstood?
Thanks a lot for your help. I know I ask a lot of questions.
_________________
Blog
| Quote: | Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that |
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Fri Sep 18, 2009 8:58 pm Post subject: |
|
|
| Overload wrote: | | Dark Byte wrote: | I think he means to only shut it off when the power button is pressed and blocking the start->shutdown way
Not sure if that's possible, but perhaps there's a windows policy you can set for that
Or perhaps you could enumerate all the windows in the start menu, find the shutdown item and hide it's window (hidewindow) |
Yes you're right about what I want. And that is a possibility. But I'd rather do something that doesn't mess with the appearance of the computer. Is a hook not possible? What about returning a false value to WM_QUERYENDSESSION?
I also found an API that may be what I'm looking for: ShutdownBlockReasonCreate. Would that help or am I misunderstood?
Thanks a lot for your help. I know I ask a lot of questions. |
Do ittttttttttttt, and make your reason "Your grandson told you no"
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Sep 19, 2009 7:22 am Post subject: |
|
|
if you dont call ShutdownBlockReasonDestroy, and you close the window, can you shutdown?
_________________
|
|
| Back to top |
|
 |
AIva1110 Advanced Cheater
Reputation: 0
Joined: 16 Sep 2009 Posts: 56 Location: The Void
|
Posted: Sat Sep 19, 2009 9:28 am Post subject: |
|
|
I don't know why you want to make yourself more problems than you have to, just use register and it will prevent shutting down through start > shutdown. Windows sends messages to all programs and then they terminate don't remember message ids at the moment. If programs don't terminate themselves, windows kills them.
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Sep 19, 2009 9:47 am Post subject: |
|
|
| AIva1110 wrote: | | I don't know why you want to make yourself more problems than you have to, just use register and it will prevent shutting down through start > shutdown. Windows sends messages to all programs and then they terminate don't remember message ids at the moment. If programs don't terminate themselves, windows kills them. |
WM_CLOSE ?
|
|
| Back to top |
|
 |
AIva1110 Advanced Cheater
Reputation: 0
Joined: 16 Sep 2009 Posts: 56 Location: The Void
|
Posted: Sat Sep 19, 2009 10:05 am Post subject: |
|
|
no. it sends WM_QUERYENDSESSION
_________________
|
|
| Back to top |
|
 |
|