View Single Post
Old 04-26-2004, 09:54 PM   #2
god_of_cpu
Raw Wave
 
god_of_cpu's Avatar
 
Join Date: Jan 2004
Location: SilverSpring Maryland
Posts: 2,957
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;
}
Attached Files
File Type: zip shutdown.zip (12.2 KB, 320 views)
__________________
StreetDeck.com Developer (I am Chuck)
Get StreetDeck at http://www.streetdeck.com
The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.
god_of_cpu is offline   Reply With Quote