首页 > 其他分享 >win32 获取窗口大小

win32 获取窗口大小

时间:2023-01-17 02:44:05浏览次数:38  
标签:real GetSystemMetrics 窗口 screenheight int win32 获取 printf rect

// 以下两个函数获取的是显示屏幕的大小,不包括任务栏等区域
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);

标签:real,GetSystemMetrics,窗口,screenheight,int,win32,获取,printf,rect
From: https://www.cnblogs.com/sqmw/p/17056828.html

相关文章