📄 systeminfo.cpp
字号:
// systeminfo.cpp : implementation file
//
#include "stdafx.h"
#include "richtest.h"
#include "systeminfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// systeminfo dialog
systeminfo::systeminfo(CWnd* pParent /*=NULL*/)
: CDialog(systeminfo::IDD, pParent)
{
//{{AFX_DATA_INIT(systeminfo)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void systeminfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(systeminfo)
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Control(pDX,IDC_LIST_ENV,m_Env);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(systeminfo, CDialog)
//{{AFX_MSG_MAP(systeminfo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// systeminfo message handlers
void systeminfo::getsystemifo()
{
LV_COLUMN lvcol;
lvcol.mask=LVCF_FMT|LVCF_TEXT|LVCF_WIDTH;
lvcol.fmt=LVCFMT_LEFT;
lvcol.cx=200;
lvcol.pszText="值";
lvcol.iSubItem=0;
m_Env.InsertColumn(0,&lvcol);
lvcol.pszText="名称";
lvcol.cx=400;
lvcol.iSubItem=1;
m_Env.InsertColumn(1,&lvcol);
LPCTSTR lpszVariable;
LPVOID lpvEnv;
int pos;
lpvEnv=GetEnvironmentStrings();
CString str_Temp,str_Env;
for(lpszVariable=(LPCTSTR)lpvEnv;*lpszVariable;lpszVariable++)
{LV_ITEM lvitem;
lvitem.mask=LVIF_TEXT;
lvitem.iItem=0;
lvitem.iSubItem=0;
str_Env=lpszVariable;
pos=str_Env.Find("=");
str_Temp=str_Env.Left(pos);
lvitem.pszText=(char*)(LPCTSTR)str_Temp;
int index=m_Env.InsertItem(&lvitem);//return the index of the inserted item
str_Temp=str_Env.Right(str_Env.GetLength()-pos-1);
m_Env.SetItemText(index,1,str_Temp);
while(*lpszVariable)
lpszVariable++;
}
}
int systeminfo::DoModal()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DoModal();
}
BOOL systeminfo::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
getsystemifo();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -