prjLogOffPC - 计算机注销程序 - VC++6.0
Main.cpp
//prjLogOffPC
/*================================================================================================
Macro _WIN32_WINNT & _WIN32_WINDOWS OS List
Windows Server 2003 family _WIN32_WINNT>=0x0502
Windows XP _WIN32_WINNT>=0x0501
Windows 2000 _WIN32_WINNT>=0x0500
Windows NT 4.0 _WIN32_WINNT>=0x0400
Windows Me _WIN32_WINDOWS=0x0490
Windows 98 _WIN32_WINDOWS>=0x0410
================================================================================================*/
/*================================================================================================
if no use "#define _WIN32_WINNT 0x0502",use "#include <winuser.h>",the compiler will report :
c:/program files/microsoft visual studio/vc98/include/winuser.h(39):error C2146:syntax error:missing ';' before identifier 'HDWP'
c:/program files/microsoft visual studio/vc98/include/winuser.h(39):fatal error C1004:unexpected end of file found
================================================================================================*/
#define _WIN32_WINNT 0x0502
//#include <winuser.h>
#include <windows.h>
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
::ExitWindowsEx(EWX_LOGOFF,EWX_FORCEIFHUNG);
/*=============================================
这里只实现了:注销
要是:想实现关机的话,
Win98 :可以把 EWX_LOGOFF 换成 EWX_SHUTDOWN
Windows高版本:还要调用其它API,获取关机权限
=============================================*/
return 0;
}