Windows 2000 and NT have extra security features. Your program has to do some extra stuff before it can shutdown the computer (basically, it has to request permission). Go to this link:
http://www.planet-source-code.com/xq...s/ShowCode.htm

It'll explain everything for you.