现在的位置: 首页 > 综合 > 正文

用VC实现系统关机(2)

2013年06月19日 ⁄ 综合 ⁄ 共 388字 ⁄ 字号 评论关闭

 其实昨天就有这个想法了,只是没写出来,今天写出来了

  1. #include<windows.h>
  2. #include<fstream>
  3. using namespace std;
  4. int WINAPI WinMain(HINSTANCE hinstance,
  5.   HINSTANCE prevInstance, 
  6.   PSTR cmdLine,
  7.   int showCmd)
  8. {
  9.  MessageBox(0, "关机""浩浩无敌!", MB_OK);
  10.  ofstream fout;
  11.  fout.open("shutdown.bat");
  12.  fout << "c://windows//system32//shutdown -s";
  13.  fout.close();
  14.  ShellExecute(0, "open""shutdown.bat""""", SW_SHOW);
  15.  return 0;
  16. }

 

 

 

抱歉!评论已关闭.