Solved

Is WindowsExit(EWX_POWEROFF) bad fr your computer?

Posted on 2004-08-18
3
808 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

631 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