找回密码
 加入网盟
分割线
官方精品推荐
  1. // test.cpp : 定义应用程序的入口点。
  2. //

  3. #include "stdafx.h"
  4. #include "test.h"
  5. #include <PhysicalMonitorEnumerationAPI.h>
  6. #include <HighLevelMonitorConfigurationAPI.h>

  7. #pragma  comment(lib, "dxva2.lib")

  8. int APIENTRY _tWinMain(HINSTANCE hInstance,
  9.                      HINSTANCE hPrevInstance,
  10.                      LPTSTR    lpCmdLine,
  11.                      int       nCmdShow)
  12. {
  13.         HMONITOR hMonitor = NULL;
  14.         DWORD cPhysicalMonitors;
  15.         LPPHYSICAL_MONITOR pPhysicalMonitors = NULL;

  16.         // Get the monitor handle.
  17.         hMonitor = MonitorFromWindow(GetDesktopWindow(), MONITOR_DEFAULTTOPRIMARY);

  18.         // Get the number of physical monitors.
  19.         BOOL bSuccess = GetNumberOfPhysicalMonitorsFromHMONITOR(
  20.                 hMonitor,
  21.                 &cPhysicalMonitors
  22.                 );

  23.         if (bSuccess)
  24.         {
  25.                 // Allocate the array of PHYSICAL_MONITOR structures.
  26.                 pPhysicalMonitors = (LPPHYSICAL_MONITOR)malloc(
  27.                         cPhysicalMonitors* sizeof(PHYSICAL_MONITOR));

  28.                 if (pPhysicalMonitors != NULL)
  29.                 {
  30.                         // Get the array.
  31.                         bSuccess = GetPhysicalMonitorsFromHMONITOR(
  32.                                 hMonitor, cPhysicalMonitors, pPhysicalMonitors);

  33.                         // Use the monitor handles (not shown).
  34.                         RestoreMonitorFactoryDefaults(pPhysicalMonitors->hPhysicalMonitor);
  35.                         // Close the monitor handles.
  36.                         bSuccess = DestroyPhysicalMonitors(
  37.                                 cPhysicalMonitors,
  38.                                 pPhysicalMonitors);

  39.                         // Free the array.
  40.                         free(pPhysicalMonitors);
  41.                 }

  42.         }

  43.         return 0;
  44. }

复制代码
显示器恢复出厂工具(成品 源码).rar (24.61 KB, 下载次数: 14)
分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 加入网盟
关闭

华夏网盟推荐 上一条 /1 下一条