|
Wrote this cause I'm such a nice guy.
It runs completly off the command line, just pass it a shutdown command. Run without a command to get a list of the commands it supports. Just link a shortcut to this and put it on your desktop to get a desktop button.
Souce is included below. Attached is the binary, it will run on anything microsoft windows.
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
if (lstrcmpi(lpCmdLine,"hibernate")==0)
SetSystemPowerState( FALSE, FALSE );
else if (lstrcmpi(lpCmdLine, "standby") == 0)
SetSystemPowerState( TRUE, FALSE );
else if (lstrcmpi(lpCmdLine,"restart")==0)
{
ExitWindowsEx(EWX_REBOOT, 0);
} else if (lstrcmpi(lpCmdLine,"shutdown")==0)
{
ExitWindowsEx(EWX_SHUTDOWN, 0);
} else if (lstrcmpi(lpCmdLine,"blankscreen")==0)
{
SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_MONITORPOWER, 2);
} else if (lstrcmpi(lpCmdLine,"logoff")==0)
{
ExitWindowsEx(EWX_LOGOFF, 0);
}
else
MessageBox(NULL, "Usage: shutdown <parameter>\n\nValid Parameters:\n\tblankscreen\n\tlogoff\n\thibernate\ n\treboot\n\tstandby\n\tshutdown\n\nBrought to you by http://www.digitalwheelz.com", "Invalid Command Parameter", MB_ICONSTOP | MB_OK);
return 0;
}
|