prjLogOffPC - 计算机注销程序 - VC++6.0 - HackerJLY

这是一个使用VC++6.0编写的简单程序,用于实现Windows系统的强制注销功能。它通过定义_WIN32_WINNT宏来确保兼容性,并使用ExitWindowsEx函数完成注销操作。适用于Windows Server 2003、Windows XP及更早版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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;
 
}
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值