1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
//将屏幕分辨率设置成1024*768 #include <windows.h> #include <stdio.h> void main() { DEVMODE DevMode; ZeroMemory(&DevMode, sizeof(DevMode)); DevMode.dmSize = sizeof(DevMode); // DEVMODE结构的大小 DevMode.dmFields=DM_PELSWIDTH | DM_PELSHEIGHT; DevMode.dmPelsWidth=1024; DevMode.dmPelsHeight=768; ChangeDisplaySettings(&DevMode,0); return; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//刷新屏幕分辨率 #include <windows.h> #include <stdio.h> void main() { DEVMODE DevMode; ZeroMemory(&DevMode, sizeof(DevMode)); //首先获取当前屏幕分辨率 if(EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&DevMode) != 0) { DevMode.dmFields=DM_PELSWIDTH | DM_PELSHEIGHT; //然后再设置屏幕 ChangeDisplaySettings(&DevMode,0); return; } printf("Enum DisplaySettings Error/n"); return; } |
转载请注明:exchen's blog » 设置 刷新屏幕分辨率