how to know screen resolution c++ code example
Example: cpp get screen resolution
#include "wtypes.h"
#include <iostream>
using namespace std;
void GetDesktopResolution(int& horizontal, int& vertical)
{
RECT desktop;
const HWND hDesktop = GetDesktopWindow();
GetWindowRect(hDesktop, &desktop);
horizontal = desktop.right;
vertical = desktop.bottom;
}
int main()
{
int horizontal = 0;
int vertical = 0;
GetDesktopResolution(horizontal, vertical);
cout << horizontal << '\n' << vertical << '\n';
return 0;
}