C/C++获取屏幕分辨率的方法
1 int main(int argc, char* argv[]) 2 { 3 // 需要添加头文件: 4 // #include <Windows.h> 5 6 system("title Dan.Jacky QQ:773091523"); 7 system("color 0a"); 8 9 int nScreenWidth, nScreenHeight; 10 nScreenWidth = GetSystemMetrics(SM_CXSCREEN); 11 nScreenHeight = GetSystemMetrics(SM_CYSCREEN); 12 printf("当前屏幕的分辨率为:%d×%d", nScreenWidth, nScreenHeight); 13 14 getchar(); 15 return 0; 16 }