get current display resolution
Is the resolution of the screen that displays the console window.
#include <Windows.h>
#include <stdio.h>
int main ()
{
int nscreenwidth, nscreenheight;
Nscreenwidth = GetSystemMetrics (sm_cxscreen);
Nscreenheight = GetSystemMetrics (sm_cyscreen);
printf ("The current screen resolution is:%dx%d", Nscreenwidth, nscreenheight);
GetChar ();
return 0;
}
Run Result:
The resolution of the current screen is: 1920x1080
get the number of screens
My Computer now has 4 screens.
#include <Windows.h>
#include <stdio.h>
int main ()
{
int screennum;
Screennum = GetSystemMetrics (sm_cmonitors);
printf ("Current number of screens:%d\n", screennum);
GetChar ();
return 0;
}
Run the output:
Current screen Number: 4
get the total resolution of the screen
#include <Windows.h>
#include <stdio.h>
int main ()
{
int ascreenwidth, ascreenheight;
Ascreenwidth = GetSystemMetrics (sm_cxvirtualscreen);
Ascreenheight = GetSystemMetrics (sm_cyvirtualscreen);
printf ("The current screen total resolution is:%dx%d \ n", Ascreenwidth, ascreenheight);
GetChar ();
return 0;
}
Run the output:
The total resolution for the current screen is: 6400x1080
get the resolution of each screen
-To be continued
Reference website:
Http://www.it610.com/article/1468754.htm
http://my.oschina.net/u/1255773/blog/177533
http://blog.csdn.net/hzy694358/article/details/7396130