Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Computer Shutdown

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Thu Sep 17, 2009 7:38 pm    Post subject: Computer Shutdown Reply with quote

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
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Sep 17, 2009 10:48 pm    Post subject: Reply with quote

Why would you honestly want to do that?
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Thu Sep 17, 2009 10:49 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Sep 17, 2009 10:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

Joined: 09 May 2003
Posts: 25985
Location: The netherlands

PostPosted: Fri Sep 18, 2009 4:46 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
AIva1110
Advanced Cheater
Reputation: 0

Joined: 16 Sep 2009
Posts: 56
Location: The Void

PostPosted: Fri Sep 18, 2009 6:26 am    Post subject: Reply with quote

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
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Fri Sep 18, 2009 7:58 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Fri Sep 18, 2009 8:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Sep 19, 2009 7:22 am    Post subject: Reply with quote

if you dont call ShutdownBlockReasonDestroy, and you close the window, can you shutdown?
_________________
Back to top
View user's profile Send private message
AIva1110
Advanced Cheater
Reputation: 0

Joined: 16 Sep 2009
Posts: 56
Location: The Void

PostPosted: Sat Sep 19, 2009 9:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Sep 19, 2009 9:47 am    Post subject: Reply with quote

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
View user's profile Send private message
AIva1110
Advanced Cheater
Reputation: 0

Joined: 16 Sep 2009
Posts: 56
Location: The Void

PostPosted: Sat Sep 19, 2009 10:05 am    Post subject: Reply with quote

no. it sends WM_QUERYENDSESSION
_________________



Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites