系统之雕虫小技(二)——关机、待机、重启动

转载 2004年06月25日 16:49:00

五 关机,待机,重启动

// Sd.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "resource.h"
#include

#define MAX_LOADSTRING 100
#define BUTTON_HEIGHT  26
#define BUTTON_WIDTH   95
#define OK_X     180
#define OK_Y  45
#define Cancel_X OK_X
#define Cancel_Y OK_Y + BUTTON_HEIGHT + 10

// Global Variables:
HINSTANCE hInst;        // current instance
TCHAR szTitle[MAX_LOADSTRING];        // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];        // The title bar text
HBITMAP ScreenBitmap,MainFrameBitmap;

HBITMAP vScreenBitmap;
HDC vScreenDC;
int maxX, maxY;
HDC WindowDC;
int oldX, oldY;
int CaptionHeight, BorderSizeX, BorderSizeY;
UINT shutdown = 0;
BOOL OKplus = FALSE, Cancelplus = FALSE;
BOOL LButtonUp = TRUE;
short mouseX, mouseY, mouseDownX, mouseDownY;
INT timeout = 0;
DWORD count = 0;
HWND hwnd, countdlg;

// Foward declarations of functions included in this code module:
ATOM    MyRegisterClass(HINSTANCE hInstance);
BOOL    InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
void    StartShutdown();
BOOL    isNT();

inline BOOL InBox(int x1, int y1, int x2, int y2, int x, int y)
{
 return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2);
}
/********************************************************************/
void ShowBitmap(HWND hWnd, int sourceX, int sourceY, int destX, int destY, int width, int height)
{
HDC memdc;
 memdc = CreateCompatibleDC(WindowDC);
 SelectObject(memdc, MainFrameBitmap);
 BitBlt(WindowDC, destX, destY, width, height, memdc, sourceX, sourceY, SRCCOPY);
 DeleteDC(memdc);
}

void ShowMainFrame(HWND hWnd)
{
 ShowBitmap(hWnd, 0, 0 ,0, 0, 300, 180);
}
/********************************************************************/
void CheckShutdown(HWND hWnd, UINT sd)
{
 if (sd == 0)
 {
  ShowBitmap(hWnd, 205, 185, 38, 43, 18, 18);
  ShowBitmap(hWnd, 205, 210, 38, 64, 18, 18);//Clear
  ShowBitmap(hWnd, 205, 210, 38, 85, 18, 18);//Clear
 }
 else
 if (sd == 1)
 {
  ShowBitmap(hWnd, 205, 185, 38, 64, 18, 18);
  ShowBitmap(hWnd, 205, 210, 38, 43, 18, 18);//Clear
  ShowBitmap(hWnd, 205, 210, 38, 85, 18, 18);//Clear
 }
 else
 {
  ShowBitmap(hWnd, 205, 185, 38, 85, 18, 18);
  ShowBitmap(hWnd, 205, 210, 38, 43, 18, 18);//Clear
  ShowBitmap(hWnd, 205, 210, 38, 64, 18, 18);//Clear
 }

}

void CancelButton(HWND hWnd, BOOL plus)
{
const int Y = 208;
 if (plus)
 {
  ShowBitmap(hWnd, 0, Y, Cancel_X, Cancel_Y, BUTTON_WIDTH, BUTTON_HEIGHT+1);
 }
 else
 {
  ShowBitmap(hWnd, BUTTON_WIDTH+1, Y, Cancel_X, Cancel_Y, BUTTON_WIDTH, BUTTON_HEIGHT+1);
 }
}

void OKButton(HWND hWnd, BOOL plus)
{
const int Y = 180;
 if (plus)
 {
  ShowBitmap(hWnd, 0, Y, OK_X, OK_Y, BUTTON_WIDTH, BUTTON_HEIGHT);
 }
 else
 {
  ShowBitmap(hWnd, BUTTON_WIDTH+1, Y, OK_X, OK_Y, BUTTON_WIDTH, BUTTON_HEIGHT);
 }
}

void TrackBar(HWND hWnd, UINT timeout, BOOL on)
{
static char strtime[10];
int hour,min;
 if (on)
 {
  ShowBitmap(hWnd, 260, 188, timeout + 12, 122, 6, 18);
  hour = timeout / 60;
  min = timeout % 60;
  SetBkMode(WindowDC, TRANSPARENT);
  sprintf(strtime, "%02d:%02d", hour, min);
  ShowBitmap(hWnd, 250, 2, 250, 2, 50, 20);
  SetTextColor(WindowDC, 0x0);
  TextOut(WindowDC, 251, 7, strtime, strlen(strtime));
  SetTextColor(WindowDC, 0xFFFFFFFF);
  TextOut(WindowDC, 250, 6, strtime, strlen(strtime));
 }
 else
 {
  if (timeout > 20)
   ShowBitmap(hWnd, 20, 122, timeout + 12, 122, 6, 18);
  else
   ShowBitmap(hWnd, 50, 122, timeout + 12, 122, 6, 18);
 }
}

inline void TitleBar(HWND hWnd)
{
 ShowBitmap(hWnd, 0, 0, 0, 0, 300, CaptionHeight+5);
 TrackBar(hWnd, timeout, TRUE);
}

void RefreshAll(HWND hWnd)
{
 ShowMainFrame(hWnd);
 OKButton(hWnd, OKplus);
 CancelButton(hWnd, Cancelplus);
 CheckShutdown(hWnd, shutdown);
 TrackBar(hWnd, timeout, TRUE);
}
/********************************************************************/
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 MSG msg;
 HACCEL hAccelTable;

 // Initialize global strings
 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
 LoadString(hInstance, IDC_SD, szWindowClass, MAX_LOADSTRING);
 MainFrameBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MAINFRAME));
 if (MainFrameBitmap == NULL) return FALSE;
 MyRegisterClass(hInstance);

 // Perform application initialization:
 if (!InitInstance (hInstance, nCmdShow))
 {
  return FALSE;
 }

 hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SD);

 // Main message loop:
 while (GetMessage(&msg, NULL, 0, 0))
 {
  if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  {
   TranslateMessage(&msg);
   DispatchMessage(&msg);
  }
 }

 return msg.wParam;
}

//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    This function and its usage is only necessary if you want this code
//    to be compatible with Win32 systems prior to the 'RegisterClassEx'
//    function that was added to Windows 95. It is important to call this function
//    so that the application will get 'well formed' small icons associated
//    with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
 WNDCLASSEX wcex;

 wcex.cbSize = sizeof(WNDCLASSEX);

 wcex.style   = CS_HREDRAW | CS_VREDRAW;
 wcex.lpfnWndProc = (WNDPROC)WndProc;
 wcex.cbClsExtra  = 0;
 wcex.cbWndExtra  = 0;
 wcex.hInstance  = hInstance;
 wcex.hIcon   = LoadIcon(hInstance, (LPCTSTR)IDI_SD);
 wcex.hCursor  = LoadCursor(NULL, IDC_ARROW);
 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
 wcex.lpszMenuName = NULL;//(LPCSTR)IDC_SD;
 wcex.lpszClassName = szWindowClass;
 wcex.hIconSm  = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);

 return RegisterClassEx(&wcex);
}

//
//   FUNCTION: InitInstance(HANDLE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable
   maxX = GetSystemMetrics(SM_CXSCREEN);
   maxY = GetSystemMetrics(SM_CYSCREEN);

   oldX = (maxX - 300) >> 1;
   oldY = ((maxY - 180) >> 1) - 30;
 //  hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPED,
 //     oldX, oldY, 300, 180, NULL, NULL, hInstance, NULL);
   hWnd = CreateWindowEx(WS_EX_APPWINDOW ,szWindowClass, szTitle, WS_VISIBLE | WS_POPUP,
      oldX, oldY, 300, 180, NULL, NULL, hInstance, NULL);
   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);
   SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

   return TRUE;
}

inline BOOL MouseInOK(int mouseX, int mouseY)
{
 return ((mouseX >= OK_X-2) && (mouseX <= OK_X+BUTTON_WIDTH-2)
  && (mouseY > OK_Y - CaptionHeight) && (mouseY < OK_Y+BUTTON_HEIGHT - CaptionHeight));
}

inline BOOL MouseInCancel(int mouseX, int mouseY)
{
 return ((mouseX >= Cancel_X-2) && (mouseX <= Cancel_X+BUTTON_WIDTH-2)
   && (mouseY > Cancel_Y - CaptionHeight) && (mouseY < Cancel_Y+BUTTON_HEIGHT - CaptionHeight));
}

inline BOOL MouseInTrack(int mouseX, int mouseY)
{
 return (InBox(12, 122 - CaptionHeight, 300 - 18, 122 + 18 - CaptionHeight, mouseX, mouseY));
}

inline BOOL TrackInRange(int index)
{
 return (index >= 0) && (index <= 60*4+30);
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
 int wmId, wmEvent;
 PAINTSTRUCT ps;
 HDC hdc;
 static BOOL InMove = 0;

 switch (message)
 {
  case WM_CREATE:
   WindowDC = GetWindowDC(hWnd);
   vScreenDC = CreateCompatibleDC(WindowDC);
   vScreenBitmap = CreateCompatibleBitmap(WindowDC, maxX,maxY);
   CaptionHeight = 0;//GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYFIXEDFRAME);
   BorderSizeX = GetSystemMetrics(SM_CXBORDER);
   BorderSizeY = GetSystemMetrics(SM_CYBORDER);
   hwnd = hWnd;
   return TRUE;

  case WM_COMMAND:
   wmId    = LOWORD(wParam);
   wmEvent = HIWORD(wParam);
   // Parse the menu selections:
   switch (wmId)
   {
    case IDCANCEL:
     SendMessage(hWnd, WM_DESTROY, 0, 0);
     break;
    case IDOK:
     SendMessage(hWnd, WM_APP+100, 0, 0);
     break;
    case IDM_INC:
     if (timeout < 4*60 + 30)
      {
       TrackBar(hWnd, timeout, FALSE);
       timeout++;
       TrackBar(hWnd, timeout, TRUE);
      }
     break;
    case IDM_DEC:
     if (timeout > 0)
      {
       TrackBar(hWnd, timeout, FALSE);
       timeout--;
       TrackBar(hWnd, timeout, TRUE);
      }
     break;
    case IDM_CINC:
     if (timeout < 4*60 + 30)
      {
       TrackBar(hWnd, timeout, FALSE);
       timeout+=15;
       if (timeout > 4*60 + 30) timeout = 4*60+30;
       TrackBar(hWnd, timeout, TRUE);
      }
     break;
    case IDM_CDEC:
     if (timeout > 0)
      {
       TrackBar(hWnd, timeout, FALSE);
       timeout-=15;
       if (timeout < 0) timeout = 0;
       TrackBar(hWnd, timeout, TRUE);
      }
     break;
    case IDM_EXIT:
       DestroyWindow(hWnd);
       break;
    default:
       return DefWindowProc(hWnd, message, wParam, lParam);
   }
   break;
  
  case WM_LBUTTONDOWN:
   SetCapture(hWnd);
   InMove = FALSE;
   LButtonUp = FALSE;
   mouseX = LOWORD(lParam);
   mouseY = HIWORD(lParam);
   mouseDownX = mouseX;
   mouseDownY = mouseY;
   if (MouseInOK(mouseX, mouseY))
   {
    OKplus = TRUE;
    OKButton(hWnd, OKplus);
   }
   else
   if (MouseInCancel(mouseX, mouseY))
   {
    Cancelplus = TRUE;
    CancelButton(hWnd, Cancelplus);
   }
   else
   if (InBox(37, 43-CaptionHeight, 40+15+70, 43+13-CaptionHeight, mouseX, mouseY))
   {
    shutdown = 0;
    CheckShutdown(hWnd, shutdown);
   }
   else
   if (InBox(37, 66-CaptionHeight, 40+15+58, 66+13-CaptionHeight, mouseX, mouseY))
   {
    shutdown = 1;
    CheckShutdown(hWnd, shutdown);
   }
   else
   if (InBox(37, 87-CaptionHeight, 40+15+90, 87+13-CaptionHeight, mouseX, mouseY))
   {
    shutdown = 2;
    CheckShutdown(hWnd, shutdown);
   }
   else
   if (MouseInTrack(mouseX, mouseY))
   {
    TrackBar(hWnd, timeout, FALSE);
    timeout = mouseX - 12;
    TrackBar(hWnd, timeout, TRUE);
   }
   else InMove = TRUE;
   break;

  case WM_KILLFOCUS:
   TitleBar(hWnd);
   //Beep(1000, 300);
   break;
  case WM_SETFOCUS:
   TitleBar(hWnd);
   break;

  case WM_LBUTTONUP:
   ReleaseCapture();
   LButtonUp = TRUE;
   mouseX = LOWORD(lParam);
   mouseY = HIWORD(lParam);
   //***************
   if (MouseInOK(mouseX, mouseY) && MouseInOK(mouseDownX, mouseDownY))
   {
    SendMessage(hWnd, WM_APP+100, 0, 0);
   }
   else
   if (MouseInCancel(mouseX, mouseY) && MouseInCancel(mouseDownX, mouseDownY))
   {
    SendMessage(hWnd, WM_CLOSE, 0, 0);
   }
  
   if (OKplus)
   {
    OKplus = FALSE;
    OKButton(hWnd, OKplus);
   }
   
   if (Cancelplus)
   {
    Cancelplus = FALSE;
    CancelButton(hWnd, Cancelplus);
   }
   break;

  case WM_MOVE:
   mouseX = LOWORD(lParam);
   mouseY = HIWORD(lParam);
   if ((oldY < CaptionHeight) && (oldY < HIWORD(lParam)))
   {
    //InvalidateRect(hWnd, NULL, FALSE);
    TitleBar(hWnd);
   }

   if (((oldX <= BorderSizeX+3) && (mouseX > oldX))
    || ((oldX-BorderSizeX + 300 >= maxX) && (mouseX < oldX))
    || ((oldY + 180 >= maxY) && (mouseY < oldY)))
    RefreshAll(hWnd);

   //TrackBar(hWnd, oldX, TRUE);

   oldX = mouseX;
   oldY = mouseY;
   break;

  case WM_MOUSEMOVE:
   mouseX = LOWORD(lParam);
   mouseY = HIWORD(lParam);

   LButtonUp = wParam & MK_LBUTTON?FALSE:TRUE;

   if (MouseInTrack(mouseDownX, mouseDownY) && !LButtonUp)
   {
    if (mouseX < 12)
     {
     if (timeout > 0)
      {
       TrackBar(hWnd, timeout, FALSE);
       timeout = 0;
       TrackBar(hWnd, timeout, TRUE);
      }
     }
    else
    if (mouseX > 4*60+30+12)
     {
     if (timeout < 4*60+30)
      {
       TrackBar(hWnd, timeout, FALSE);
       timeout = 4*60+30;
       TrackBar(hWnd, timeout, TRUE);
      }
     }
    else
     {
      TrackBar(hWnd, timeout, FALSE);
      timeout = mouseX - 12;
      TrackBar(hWnd, timeout, TRUE);
     }
   }
   else
   if (OKplus && (!MouseInOK(mouseX, mouseY)))
   {
    OKplus = FALSE;
    OKButton(hWnd, OKplus);
   }
   else
   if (Cancelplus &&(!MouseInCancel(mouseX, mouseY)))
   {
    Cancelplus = FALSE;
    CancelButton(hWnd, Cancelplus);
   }
   else
   if (!LButtonUp && (MouseInOK(mouseX, mouseY)) && (MouseInOK(mouseDownX, mouseDownY)))
   {
    OKplus = TRUE;
    OKButton(hWnd, OKplus);
   }
   else
   if (!LButtonUp &&(MouseInCancel(mouseX, mouseY)) && (MouseInCancel(mouseDownX, mouseDownY)))
   {
    Cancelplus = TRUE;
    CancelButton(hWnd, Cancelplus);
   }
   else
   if (!LButtonUp && InMove)
   {
   RECT Rect;
    GetWindowRect(hWnd, &Rect);
    MoveWindow(hWnd, Rect.left + (mouseX - mouseDownX), Rect.top + (mouseY - mouseDownY), Rect.right - Rect.left, Rect.bottom - Rect.top, TRUE);
   }
   break;

  case WM_PAINT:
   hdc = BeginPaint(hWnd, &ps);
    //hdc = GetWindowDC(hWnd);
    //MemDC = CreateCompatibleDC(WinDC);
    //SelectObject(MemDC, MainFrameBitmap);
   RefreshAll(hWnd);
   //BitBlt(WindowDC, 0, 0, 300, 180, vScreenDC, 0, 0, SRCCOPY);
    //ReleaseDC(hWnd, WinDC);
    //DeleteDC(MemDC);

   EndPaint(hWnd, &ps);
   break;
  case WM_DESTROY:
   ReleaseDC(hWnd, WindowDC);
   DeleteDC(vScreenDC);
   PostQuitMessage(0);
   break;
  case WM_APP+100:
   //Beep(100,1000);
   StartShutdown();
   break;
  default:
   return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}

LRESULT CALLBACK CountDownDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static char time[10];
static int X = 0, Y = 0;
 switch (message)
 {
  case WM_INITDIALOG:
   countdlg = hDlg;
    return TRUE;

  case WM_COMMAND:
   if (LOWORD(wParam) == IDCANCEL)
   {
    EndDialog(hDlg, LOWORD(wParam));
    return TRUE;
   }
   break;

  case WM_TIMER:
   sprintf(time, "%02d:%02d:%02d", count / 3600, (count % 3600) / 60, count % 60);
   SetDlgItemText(hDlg, IDC_TIME, time);
   break;

  case WM_CLOSE:
   EndDialog(hDlg, 0);
   return TRUE;

  case WM_MOUSEMOVE:
   if (wParam & MK_LBUTTON)
   {
   int x, y;
   RECT Rect;
    GetWindowRect(hDlg, &Rect);
    x = LOWORD(lParam);
    y = HIWORD(lParam);
    MoveWindow(hDlg, Rect.left + (x - X), Rect.top + (y - Y), Rect.right - Rect.left, Rect.bottom - Rect.top, TRUE);
   }
   break;

  case WM_LBUTTONDOWN:
   X = LOWORD(lParam);
   Y = HIWORD(lParam);
   SetCapture(hDlg);
   break;

  case WM_LBUTTONUP:
   ReleaseCapture();
   break;
}
    return FALSE;
}

BOOL ShutdownNT()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
 
if (!OpenProcessToken(GetCurrentProcess(),
        TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return FALSE;
 
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
        &tkp.Privileges[0].Luid);
 
tkp.PrivilegeCount = 1;  // one privilege to set   
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
 
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
        (PTOKEN_PRIVILEGES)NULL, 0);
 
if (GetLastError() != ERROR_SUCCESS) return FALSE;  
 
 if (shutdown == TRUE)
  ExitWindowsEx(EWX_SHUTDOWN, 0L);
 else ExitWindowsEx(EWX_REBOOT, 0L);
return TRUE;
}

void Shutdown9x()
{
 switch (shutdown)
 {
 case 0:
  ExitWindowsEx(EWX_SHUTDOWN, 0L);
  break;
 case 1:
  ExitWindowsEx(EWX_REBOOT, 0L);
  break;
 default:
  WinExec("Exit To Dos.pif", SW_SHOWNORMAL);
  break;
 }
}

VOID WINAPI TimerProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
 if (count <= 0)
 {
  KillTimer(hwnd, 0xCAFE);
  if (isNT())
   ShutdownNT();
  else
   Shutdown9x();
  SendMessage(countdlg, WM_CLOSE, 0, 0);
  SendMessage(hwnd, WM_CLOSE, 0, 0);
 }
 else
 {
  count--;
  SendMessage(countdlg, WM_TIMER, 0, 0);
 }
}

void StartShutdown()
{
char message[MAX_LOADSTRING];
 if (timeout == 0)
 {
  if (isNT())
   ShutdownNT();
  else
   Shutdown9x();
  SendMessage(hwnd, WM_CLOSE, 0, 0);
 }
 else
 {
  char shutdown_msg[3][30] = {"shutdown", "restart", "restart in MSDOS mode"};
  count = (long)timeout * 60;
  SetTimer(hwnd, 0xCAFE, 1000, (TIMERPROC)TimerProc);
  ShowWindow(hwnd, SW_HIDE);
  sprintf(message, "    System will be %s after %d hour(s) and %d minute(s)    ", shutdown_msg[shutdown], timeout / 60, timeout % 60);
  MessageBox(hwnd, message, "Warning", MB_OK | MB_ICONWARNING);

  if (DialogBox(hInst, MAKEINTRESOURCE(IDD_COUNTDOWN), hwnd, (DLGPROC)CountDownDlg)==IDCANCEL)
   SendMessage(hwnd, WM_CLOSE, 0, 0);
 }
}

BOOL isNT()
{
OSVERSIONINFO os;
   os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   GetVersionEx(&os);
   return os.dwPlatformId == VER_PLATFORM_WIN32_NT;
}

Android应用程序--获取待机、唤醒、关机、网络状态变化消息

1) 待机: 广播消息:android.intent.action.SCREEN_OFF (代码) 2) 唤醒: 广播消息:android.intent.action.SCREEN_ON (代码...
  • MyArrow
  • MyArrow
  • 2012年11月12日 16:28
  • 10310

Windows 系统关机、重启、睡眠、休眠及唤醒消息

今天要查找如何获取系统从睡眠、休眠状态下唤醒的消息,写了个MFC对话框的程序,贴出部分核心代码: //唤醒消息捕获 LRESULT CSystemResumedMessageDlg::WindowPr...
  • daiafei
  • daiafei
  • 2015年05月07日 16:49
  • 5016

php实现电脑的定时关机 取消关机等

meta http-equiv="Content-Type"
  • u013533118
  • u013533118
  • 2017年02月16日 21:33
  • 518

使用c#捕获windows的关机事件

在公司上班,下班时需要签退,而我呢隔三差五就会忘那么一次。怎么办呢,于是就想能不能捕获windows的关机事件,做一个程序让它在关机的时候提醒我一下呢。 非常幸运很容易就找到了Microsoft.Wi...
  • xwchen
  • xwchen
  • 2008年02月27日 21:46
  • 536

树莓派 respberry安全关机命令重启命令

树莓派 respberry安全关机命令重启命令  - 树莓派可以通过下面几个命令来实现安全关机: sudo shutdown -h now sudo halt sudo poweroff s...
  • CsharpGame
  • CsharpGame
  • 2013年07月19日 23:12
  • 22135

Android 设置屏幕不待机

转自:http://blog.csdn.net/yudajun/article/details/7748760 最近做项目时正好用到,进行了一下总结: Android设置支部待机有两种方法...
  • obmeflbj
  • obmeflbj
  • 2013年12月24日 12:04
  • 3208

Unity3D之Mecanim动画系统学习笔记(三):Animation View

动画组件之间的关系 我们先看一张图: 这里我们可以看到,我们在GameObject之上绑定的Animator组件是控制模型进行动画播放的。 而其属性Controller则对应一个Anim...
  • cbbbc
  • cbbbc
  • 2017年02月19日 18:20
  • 345

C#捕获windows关机事件,在系统关机前做一些自己想做的事

C#捕获windows关机事件,在系统关机前做一些自己想做的事;有些时候我们可能想在Windows关机时记录或处理一些事情,这里提供几种方法。方法一: /// /// ...
  • testcs_dn
  • testcs_dn
  • 2015年01月03日 18:01
  • 8165

C#重启动WINCE系统

很多底层操作的函数,Visual Studio 2005.NET 的API 库中并没有提供,这个时候,我们就要在C#开发中调用Win32 的函数来进行相应的操作。一大批Win32 底层操作的函数都存在...
  • zggxyx2004
  • zggxyx2004
  • 2008年11月08日 14:24
  • 1500

利用命令行让Windows进入待机(stand by)状态

经济危机下大家都在想办法开源节流,开源当然不是那么简单的,这要是容易的话也不用等到现在这年月。所以更多公司都是在节流这方面打主意。公司最近的一条措施就是号召大家下班后尽量都把电脑设置成待机状态(之所以...
  • dounking
  • dounking
  • 2009年05月04日 19:51
  • 19987
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:系统之雕虫小技(二)——关机、待机、重启动
举报原因:
原因补充:

(最多只允许输入30个字)