⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rebootdlg.cpp

📁 重启动 ce设备
💻 CPP
字号:
// ReBootDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ReBoot.h"
#include "ReBootDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//zb
#define IOCTL_HAL_GET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) 
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) 
//ze

/////////////////////////////////////////////////////////////////////////////
// CReBootDlg dialog

CReBootDlg::CReBootDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CReBootDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReBootDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CReBootDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReBootDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CReBootDlg, CDialog)
	//{{AFX_MSG_MAP(CReBootDlg)
	ON_BN_CLICKED(IDC_BUTTON_ShutOff, OnBUTTONShutOff)
	ON_BN_CLICKED(IDC_BUTTON_WarmBoot, OnBUTTONWarmBoot)
	ON_BN_CLICKED(IDC_BUTTON_ColdBoot, OnBUTTONColdBoot)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReBootDlg message handlers

BOOL CReBootDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen

	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}


void CReBootDlg::OnBUTTONShutOff() 
{
	::keybd_event(VK_OFF, 0, 0, 0); 
	::keybd_event(VK_OFF, 0, KEYEVENTF_KEYUP, 0);
}

void CReBootDlg::OnBUTTONWarmBoot() 
{
	if (MessageBox(_T("所有没有保存的数据都将丢失,确定Reset?"),_T("提示:"),MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
	{
		KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);	
	}
}

void CReBootDlg::OnBUTTONColdBoot() 
{
	if (MessageBox(_T("所有没有保存在电子硬盘中的数据都将丢失!确定吗?"),_T("警告:"),MB_OKCANCEL|MB_ICONWARNING)==IDOK)
	{
		SetCleanRebootFlag();
		KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -