#include <Windows.h>
#include <sstream>
bool GetScreenResolution(unsigned int* pwidth, unsigned int* pheigth) {
const HWND desktopWindow = GetDesktopWindow();
RECT desktopRectangle;
if (desktopWindow && GetWindowRect(desktopWindow, &desktopRectangle)) {
*pwidth = desktopRectangle.right;
*pheigth = desktopRectangle.bottom;
return true;
}
return false;
}
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
unsigned int width = 0, heigth = 0;
std::string s;
if (GetScreenResolution(&width, &heigth)) {
std::ostringstream oss;
oss << width;
oss << " x ";
oss << heigth;
oss << " pixels";
s = oss.str();
}
MessageBoxA(0, s.c_str(), "info", MB_OK);
}
/*
run:
2560 x 1440 pixels
*/