1#include "wtypes.h"
2#include <iostream>
3using namespace std;
4
5// Get the horizontal and vertical screen sizes in pixel
6void GetDesktopResolution(int& horizontal, int& vertical)
7{
8 RECT desktop;
9 // Get a handle to the desktop window
10 const HWND hDesktop = GetDesktopWindow();
11 // Get the size of screen to the variable desktop
12 GetWindowRect(hDesktop, &desktop);
13 // The top left corner will have coordinates (0,0)
14 // and the bottom right corner will have coordinates
15 // (horizontal, vertical)
16 horizontal = desktop.right;
17 vertical = desktop.bottom;
18}
19
20int main()
21{
22 int horizontal = 0;
23 int vertical = 0;
24 GetDesktopResolution(horizontal, vertical);
25 cout << horizontal << '\n' << vertical << '\n';
26 return 0;
27}