| // 以下两个函数获取的是显示屏幕的大小,不包括任务栏等区域 |
| int screenwidth = GetSystemMetrics(SM_CXFULLSCREEN); |
| int screenheight = GetSystemMetrics(SM_CYFULLSCREEN); |
| printf("%d,%d\n", screenwidth, screenheight); |
| |
| // 以下两个函数获取的是真正屏幕的大小,即实际的大小 |
| int screenwidth_real = GetSystemMetrics(SM_CXSCREEN); |
| int screenheight_real = GetSystemMetrics(SM_CYSCREEN); |
| printf("%d,%d\n", screenwidth_real, screenheight_real); |
| // 获取可用桌面大小 |
| RECT rect; |
| SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); |
| int cx = rect.right - rect.left; |
| int cy = rect.bottom - rect.top; |
| |
| printf("%d,%d\n",cx,cy); |
| printf("%d,%d,%d,%d",rect.left,rect.top,rect.right,rect.bottom); |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步