Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Automatic shutting down of windows xp

i wonder if there is a way to write a function using win32 API or .NET to automatically shut down windows xp when called.Then i can put the function in the comsumer application in WMI using the Start method to listen to the provider application which fires the event since the System.Management provides the wrapper for WMI.

i am just curious about such an interesting problem.

welcome any advice

G_Zola
Friday, May 06, 2005

Are you doing this as a part of a package installation or do you want your application to be able to shut down Windows XP?

Reason to ask is that if you're installing software and want to do a reboot/ shutdown etc , then Windows Installer SDK provides support for that.

My guess is that your particular situation isn't of the installation kind but is of the application kind

Sheeshers
Friday, May 06, 2005

Google for the Win32 ExitWindowsEX function. There may be some issues with permissions if you are not an administrator.

matt
Friday, May 06, 2005

Funnily enough I discovered on www.pinvoke.net the other day...

Here's a good example.  I've not tested this, but shouldn't take 2 mins to work out:

http://www.pinvoke.net/default.aspx/user32.ExitWindowsEx


Alan
-----
http://alangraham.co.uk/

Alan Graham
Friday, May 20, 2005

*  Recent Topics

*  Fog Creek Home