zoukankan      html  css  js  c++  java
  • 使用Windows API获取和改变当前显示设置

    #include <windows.h>
    #include <stdio.h>
    #include <conio.h>

    void main()
    {
        DEVMODE devmode,oldmode;
        EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
        ZeroMemory(&oldmode,sizeof(DEVMODE));
        CopyMemory(&oldmode,&devmode,sizeof(DEVMODE));
        printf("BitsPerPel:%d\n",devmode.dmBitsPerPel);
        printf("DisplayFrequency:%d\n",devmode.dmDisplayFrequency);
        printf("PelsWidth:%d\n",devmode.dmPelsWidth);
        printf("PelsHeight:%d\n",devmode.dmPelsHeight);
        printf("Press any key to change display...\n");
        getch();
        printf("BitsPerPel:%d\n",devmode.dmBitsPerPel=16);
        printf("DisplayFrequency:%d\n",devmode.dmDisplayFrequency=60);
        printf("PelsWidth:%d\n",devmode.dmPelsWidth=800);
        printf("PelsHeight:%d\n",devmode.dmPelsHeight=600);
        ChangeDisplaySettings(&devmode,0);
        printf("Press any key to restore...\n");   
        getch();
        printf("BitsPerPel:%d\n",oldmode.dmBitsPerPel);
        printf("DisplayFrequency:%d\n",oldmode.dmDisplayFrequency);
        printf("PelsWidth:%d\n",oldmode.dmPelsWidth);
        printf("PelsHeight:%d\n",oldmode.dmPelsHeight);
        printf("Press any key to change display...\n");
        ChangeDisplaySettings(&oldmode,0);
        getch();
    }

  • 相关阅读:
    python requests 上传excel数据流
    No module named 'requests_toolbelt'
    code
    pytest 打印调试信息
    python3 获取日期时间
    Java单元测试之JUnit篇
    The import junit cannot be resolved解决问题
    什么是索引
    python3 ini文件读写
    js 测试题
  • 原文地址:https://www.cnblogs.com/MaxWoods/p/286755.html
Copyright © 2011-2022 走看看