//下边两个函数获取的是显示屏幕的大小,但不包括任务栏等区域
int cx = GetSystemMetrics(SM_CXFULLSCREEN);
int cy = GetSystemMetrics(SM_CYFULLSCREEN);
printf("屏幕大小(不含任务栏):宽:%d,高:%d \r\n", cx,cy);
//下边这两个函数获取的是真正屏幕的大小:屏幕分辨率
int nWidth = GetSystemMetrics(SM_CXSCREEN); //屏幕宽度
int nHeight = GetSystemMetrics(SM_CYSCREEN); //屏幕高度
printf("屏幕大小:宽:%d,高:%d \r\n", nWidth,nHeight);
//对话框窗体大小及其屏幕坐标
CRect rectDlg;
//GetClientRect(rectDlg);//获得窗体的大小
//法1:
GetWindowRect(rectDlg);//获得窗体在屏幕上的位置
//法2:
ScreenToClient(rectDlg);
printf("窗口位置大小:底:%d, 右:%d, 宽:%d, 高:%d\r\n", rectDlg.bottom, rectDlg.right, rectDlg.Width(), rectDlg.Height());
//控件大小和位置
CRect rectCtrl;
CStatic *p = (CStatic*)GetDlgItem(IDC_VIDEOSHOW1);
//p->MoveWindow(100, 100, 100, 100);//更改控件大小并移动其到指定位置
p->GetWindowRect(rectCtrl);
this->ScreenToClient(rectCtrl);
//GetDlgItem(IDC_STATIC_TEST)->GetClientRect(rectCtrl);
printf("控件位置大小:左:%d, 顶:%d, 宽:%d, 高:%d\r\n", rectCtrl.left, rectCtrl.top, rectCtrl.Width(), rectCtrl.Height());
