Exit Windows SOS, my code is good ?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

Hello :)

I will want to make a small application to stop my PC at one hour precise.
To stop the PC I use the following code:

OpenLibrary(0,"USER32.DLL")

CallFunction(0,"ExitWindowsEx",EWX_POWEROFF,0)



The problem it is that the PC does not stop but Windows closes just the session in progress.
How to make to stop the PC easily?


It would be necessary that the code goes with win9X and NT XP.
Thank you for your assistance.
Also if somebody knows how to know the number of the mother card,
it would be well.

Sorry for my English, but I french
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

EWX_POWEROFF will be 0 (variable). Use the real constant value instead (#EWX_POWEROFF = 8)

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

I tested that, but that closes only the session.
OpenLibrary(0, "USER32.DLL")

CallFunction(0,"ExitWindowsEx",EWX_POWEROFF,8)



J'ai essayé ça, mais ça ferme uniquement la session :

OpenLibrary(0, "USER32.DLL")

CallFunction(0,"ExitWindowsEx",EWX_POWEROFF,8)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TheBeck.

See my reply to your question here:
viewtopic.php?t=5274
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Joël Roly.

Mon cher Julien.
Comme vous me l'avez demandé je vous ai envoyé les codes pour 98/Millénium/NT/2000/et XP
à votre adresse Email.
Salutation
Joël...
Programmeur amateur.
Post Reply