VC++编程技巧集
代码如下: void CSys1View::OnDraw(CDC* pDC) { CSys1Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here // 显示系统Windows目录 WCHAR szPath[MAX_PATH]; GetWindowsDirectoryW( szPath, sizeof(szPath) ); pD
代码如下:
void CSys1View::OnDraw(CDC* pDC)
{
CSys1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
// 显示系统Windows目录
WCHAR szPath[MAX_PATH];
GetWindowsDirectoryW( szPath, sizeof(szPath) );
pDC->TextOut(100,100,"Windows目录:");
pDC->TextOut(250,100,szPath);
// 显示temp目录
char tempPath[_MAX_PATH+1];
::GetTempPath (_MAX_PATH,tempPath);
pDC->TextOut(100,150,"temp目录:");
pDC->TextOut(250,150,tempPath);
// 显示系统分辨率
char a1[12],b1[12];
CSize sizeScreen (GetSystemMetrics (SM_CXSCREEN),
GetSystemMetrics (SM_CYSCREEN));
itoa(sizeScreen.cx,a1,10);
itoa(sizeScreen.cy,b1,10);
pDC->TextOut(100,200,"水平分辨率:");
pDC->TextOut(100,225,"垂直分辨率:");
pDC->TextOut(250,200,a1);
pDC->TextOut(250,225,b1);
}
截图如下: