WIN32 API编程--枚举系统显示器

#include
#include
#include

BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor,HDC hdcMonitor,LPRECT lprcMonitor,LPARAM dwData)
{
 MONITORINFOEX mi;
 mi.cbSize=sizeof(MONITORINFOEX);
 GetMonitorInfo(hMonitor,&mi);
 printf("Device name:%s\t",mi.szDevice);
 if(mi.dwFlags==MONITORINFOF_PRIMARY) printf("Primary monitor!\n");
 else printf("\n");
 printf("Monitor rectangle:(%d,%d,%d,%d)\n",mi.rcMonitor.left,mi.rcMonitor.top,mi.rcMonitor.right,mi.rcMonitor.bottom);
 printf("Work rectangle:(%d,%d,%d,%d)\n",mi.rcWork.left,mi.rcWork.top,mi.rcWork.right,mi.rcWork.bottom);
 return true;
}

int main(void)
{
 EnumDisplayMonitors(NULL,NULL,MonitorEnumProc,NULL);
 getch();
 return 0;
}

你可能感兴趣的:(WIN32 API编程--枚举系统显示器)