You really should just allow windows to handle your password, (although there are simple ways to get around it...)
If your really want to I'm sure the DLL is the best way to go. However, just to throw other options out there. There is a 'command prompt' command that will shutdown your comp. It might be useful because it allows you to display a message to the user and set a countdown timer until the comp will shutdown allowing the user to save data so they won't lose anything. It also allows you to log off, or restart the comp instead of shuting down.
To access command prompt, click 'START > RUN : "command" '
type "shutdown" press enter. Don't worry, doing that wont start the shutdown, it will print all the info on the command to the screen.
for example: typing "shutdown -s -t 30" will shutdown your computer in 30 seconds. To use this in your program simply open notepad and type the "shutdown -s blablabla" in notepad and save it as "whatever
.bat" then you can execute the batch file from your program.
NOTE: after the shutdown counter starts you can type "shutdown -a" to abort it.
-----------------------------------------------------------------
Just for fun, try typing "shutdown -s -t 10" and see if you can type "shutdown -a" before the timer runs out, LOL.
The right man in the wrong place can make all the difference in the world.