📄 firstdlgdlg.cpp
字号:
// firstdlgDlg.cpp : implementation file
//
#include "stdafx.h"
#include "firstdlg.h"
#include "firstdlgDlg.h"
#include <winbase.h>
#include <stdlib.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
// CFirstdlgDlg dialog
void CFirstdlgDlg::updateBAT()
{
DWORD dwLen = GetSystemPowerStatusEx2(&sps, sizeof(sps), TRUE);
this->m_FullLifeTime.Format(_T("%d"), sps.BatteryFullLifeTime) ;
this->m_aclinestatus.Format(_T("%d"), sps.ACLineStatus) ;
this->m_batteryflag.Format(_T("%d"), sps.BatteryFlag) ;
this->m_LiftPresent.Format(_T("%d"), sps.BatteryLifePercent) ;
this->m_Voltage.Format(_T("%d"), sps.BatteryVoltage) ;
this->m_Current.Format(_T("%d"), sps.BatteryCurrent) ;
this->m_Temperature.Format(_T("%d"), sps.BatteryTemperature) ;
this->m_Chemistry.Format(_T("%d"), sps.BatteryChemistry) ;
}
CFirstdlgDlg::CFirstdlgDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFirstdlgDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFirstdlgDlg)
m_aclinestatus = _T("");
m_batteryflag = _T("");
m_LiftPresent = _T("");
m_FullLifeTime = _T("");
m_Voltage = _T("");
m_Current = _T("");
m_Temperature = _T("");
m_Chemistry = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
updateBAT(); //Update the battery info
}
void CFirstdlgDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFirstdlgDlg)
DDX_Text(pDX, IDC_EDIT1, m_aclinestatus);
DDX_Text(pDX, IDC_EDIT2, m_batteryflag);
DDX_Text(pDX, IDC_EDIT3, m_LiftPresent);
DDX_Text(pDX, IDC_EDIT4, m_FullLifeTime);
DDX_Text(pDX, IDC_EDIT5, m_Voltage);
DDX_Text(pDX, IDC_EDIT6, m_Current);
DDX_Text(pDX, IDC_EDIT7, m_Temperature);
DDX_Text(pDX, IDC_EDIT8, m_Chemistry);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFirstdlgDlg, CDialog)
//{{AFX_MSG_MAP(CFirstdlgDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFirstdlgDlg message handlers
BOOL CFirstdlgDlg::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
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -