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 


Shutdown according to time

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

Joined: 06 Nov 2007
Posts: 130

PostPosted: Thu Feb 07, 2008 12:04 pm    Post subject: Shutdown according to time Reply with quote

Hello,

i want to know how to shutdown my computer. I mean if the time is above 11pm then it will shutdown automatically. i hope that explains
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Thu Feb 07, 2008 12:12 pm    Post subject: Reply with quote

Create a program thats check the time and if it 11 run shutdown.exe.
Back to top
View user's profile Send private message
raushan2007
Expert Cheater
Reputation: 0

Joined: 06 Nov 2007
Posts: 130

PostPosted: Thu Feb 07, 2008 12:13 pm    Post subject: Reply with quote

HolyBlah wrote:
Create a program thats check the time and if it 11 run shutdown.exe.


Whats the code? i want it to see if the time is above 11pm
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Thu Feb 07, 2008 12:22 pm    Post subject: Reply with quote

I can give you functions and hints, but not the full code:
1. use a Timer.
2. Use GetLocalTime to get the full date and extract the time from SYSTEMTIME structure.


Last edited by HolyBlah on Thu Feb 07, 2008 2:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Thu Feb 07, 2008 12:25 pm    Post subject: Reply with quote

like he said above
use a timer

or you can create a seperate thread for it (CreateThread)

but i just used get system time

C++:

Code:

   SYSTEMTIME lpSystemTime;
   GetSystemTime( lpSystemTime );
   if ( lpSystemTime.wHour >= 23 ) // 23 = 11 PM
      // Do Shutdown command here!



sorry, to lazy to look up the paramaters for CreateProcess

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Feb 07, 2008 12:49 pm    Post subject: Reply with quote

Definitely not the best solution, but you can call NtShutdownSystem as well.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Feb 07, 2008 2:19 pm    Post subject: Reply with quote

You can also use the ExitWindowsEx API.
http://msdn2.microsoft.com/en-us/library/aa376868(VS.85).aspx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Thu Feb 07, 2008 3:32 pm    Post subject: Reply with quote

Or you could create a task for Windows, that calls shutdown.exe.

o_o

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Thu Feb 07, 2008 5:02 pm    Post subject: Reply with quote

Wiccaan wrote:
You can also use the ExitWindowsEx API.
http://msdn2.microsoft.com/en-us/library/aa376868(VS.85).aspx


I thought ExitWindows just logged you off?
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Feb 07, 2008 5:29 pm    Post subject: Reply with quote

If you use the extended version you have the ability to control what level of "shutdown" it will do:

Code:
BOOL WINAPI ExitWindowsEx(
  __in  UINT uFlags,
  __in  DWORD dwReason
);


uFlags can be:

Logoff / Shutdown+PowerOff / Reboot / Reboot+RestartApps / Shutdown

Check the descriptions on the link I gave above.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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