C++ 获取系统度量

void CDemoDlg::OnBnClickedButtonSm()
{
	// TODO: 在此添加控件通知处理程序代码
	CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST);
	pListBox->ResetContent();

	CString strText;
	strText.Format(_T("屏幕大小:                 %d x %d"),GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
	pListBox->AddString(strText);

	strText.Format(_T("全屏窗口大小:           %d x %d"),GetSystemMetrics(SM_CXFULLSCREEN),GetSystemMetrics(SM_CYFULLSCREEN));
	pListBox->AddString(strText);

	strText.Format(_T("最大化窗口大小:        %d x %d"),GetSystemMetrics(SM_CXMAXIMIZED),GetSystemMetrics(SM_CYMAXIMIZED));
	pListBox->AddString(strText);

	strText.Format(_T("最小化窗口大小:        %d x %d"),GetSystemMetrics(SM_CXMINIMIZED),GetSystemMetrics(SM_CYMINIMIZED));
	pListBox->AddString(strText);

	strText.Format(_T("窗口边框大小:           %d x %d"),GetSystemMetrics(SM_CXBORDER),GetSystemMetrics(SM_CYBORDER));
	pListBox->AddString(strText);

	strText.Format(_T("固定边框厚度:           %d x %d"),GetSystemMetrics(SM_CXFIXEDFRAME),GetSystemMetrics(SM_CYFIXEDFRAME));
	pListBox->AddString(strText);

	strText.Format(_T("可变边框厚度:           %d x %d"),GetSystemMetrics(SM_CXSIZEFRAME),GetSystemMetrics(SM_CYSIZEFRAME));
	pListBox->AddString(strText);

	strText.Format(_T("水平滚动条箭头大小:  %d x %d"),GetSystemMetrics(SM_CXHSCROLL),GetSystemMetrics(SM_CYHSCROLL));
	pListBox->AddString(strText);

	strText.Format(_T("垂直滚动条箭头大小:  %d x %d"),GetSystemMetrics(SM_CXVSCROLL),GetSystemMetrics(SM_CYVSCROLL));
	pListBox->AddString(strText);

	strText.Format(_T("标题栏高度:              %d"),GetSystemMetrics(SM_CYCAPTION));
	pListBox->AddString(strText);

	strText.Format(_T("标题栏按钮大小:        %d x %d"),GetSystemMetrics(SM_CXSIZE),GetSystemMetrics(SM_CYSIZE));
	pListBox->AddString(strText);

	strText.Format(_T("菜单栏高度:              %d"),GetSystemMetrics(SM_CYMENU));
	pListBox->AddString(strText);

	strText.Format(_T("鼠标指针大小:           %d x %d"),GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR));
	pListBox->AddString(strText);

	strText.Format(_T("默认图标大小:           %d x %d"),GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
	pListBox->AddString(strText);
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值