
Single-line code -vs- 7K version
| This is NOT meant to be an anti-MS post, but I really want to know why
| their 7K code can be reduced to one single line and still work?
1) Your method has no error checking whatsoever
2) Your method doesn't take into account people using NT / 2000, where your
program has to get security privileges in order to restart the computer.
3) Your method doesn't include comments, procedure headers, etc.
Basically, yours is fine if you are always running it on a guarenteed 9x
system (95, 98 or ME) and you also know that there is no way that your method
will throw an error (for example if a running program cancels the shutdown
process) then you are OK. The MS example is more robust, will work on all
Win32 systems, and also lets you retrieve error information if an error did
occur.
steve