Skip to content

Instantly share code, notes, and snippets.

@Sohamkadam333
Created December 12, 2023 18:28
Show Gist options
  • Save Sohamkadam333/87fac1dd7204c5e8452bafe2cf38cc2f to your computer and use it in GitHub Desktop.
Save Sohamkadam333/87fac1dd7204c5e8452bafe2cf38cc2f to your computer and use it in GitHub Desktop.
Retrieves the specified system metric or system configuration setting.
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
int screenMonitors = GetSystemMetrics(SM_CMONITORS);
cout<<"Screen width = "<<screenWidth<<" px"<<endl;
cout<<"Screen height = "<<screenHeight<<" px"<<endl;
cout<<"Screen Monitors = "<<screenMonitors<<""<<endl;
system("PAUSE");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment