Skip to content

Instantly share code, notes, and snippets.

@berlysia
Created September 27, 2018 13:01
Show Gist options
  • Save berlysia/bd50b4e1796f7da05a000a13d6a2862a to your computer and use it in GitHub Desktop.
Save berlysia/bd50b4e1796f7da05a000a13d6a2862a to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <Windows.h>
BOOL CALLBACK monitor_enum_proc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM cbData) {
MONITORINFOEX mi;
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
std::wstring szDevice(mi.szDevice);
std::cout << mi.rcMonitor.left << ", " << mi.rcMonitor.top << ": ";
std::wcout << szDevice << std::endl;
return true;
}
int main() {
EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, NULL);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment