Solved

Is WindowsExit(EWX_POWEROFF) bad fr your computer?

Posted on 2004-08-18
3
801 Views
Last Modified: 2010-08-05
I have 2 buttons that execute these 2 lines of code
1:  WindowsExit(EWX_POWEROFF)
2. WindowsExit(EWX_REBOOT)
can these do any harm to your computer if used by themself to shut it down or restart?

thanks
Myles :)
0
Comment
Question by:myleseven2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Assisted Solution

by:Tyrsis
Tyrsis earned 25 total points
ID: 11835378
Are you talking about the ExitWindows() win32 API function?

Either way, it can't get any more danagerous then hitting your power button on your computer, or the reset button.  And usually when it's done pragmatically, it's even more safe.  You really shouldn't have any fear of doing these functions.  It was only long long long ago when turning off your computer could cause harm.  With today's computers it's a nonissue.

Tyrsis

0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 25 total points
ID: 11840004
These functions can do harm to the data on your computer, but not to your computer itself...
First of all, computers don't just power off just like that. Hitting the poweswitch is not the same anymore as pulling the power plug and thus cutting off power. When you hit the power-off button, several computerparts will get enough power to finish whatever task needs to be done and then get into a safemode. Which basically means that harddisks will move the reader head to a track of the disk that cannot be damaged. (Which in the DOS time you had to do with the command PARK.EXE) Modern disks will always try to auto-park themselves if the power is disconnected.
And other hardware parts? Well, most are non-mechanical, no moving parts. The fan will stop fanning but that should not be a real problem since the processor won't continue to heat up anymore.

No, your hardware is reasonable safe...

However, for software, things are a bit different. Documents might not be saved, databases might not be updated, emails might not be sent, all because the power is disconnected. You could be working on a very important project and then the system resets while you haven't changed your modifications yet. I almost punched the nose of my previous system administrator once since he decided to remotely install a new Microsoft patch that needed a restart while I was running a long task that wasn't supposed to be stopped. The patch needed a reboot so I got a message (NET SEND stuff) on my system that I had 5 minutes to close all documents or else they would be lost. And my project was already running for an hour and had to stay running for another two hours... (It was a "quick" convertion of a very large database.)
Fortunately, in 5 minutes I did manage to get him and tell him to cancel that reboot or else his nose would be cancelled. Considering the circumstances he was willing to cancel the reboot.

Always be careful when planning a reboot/shutdown for other users. They could lose valuable time and data. But nothing more.
0
 

Author Comment

by:myleseven2
ID: 11846847
THat is great thanks guys, I will split the points between you both

Myles
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question