掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
API(DDC/CI)でモニタの調整 (ID:103235)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
こんにちは。 API(DDC/CI)でモニタの調整を行うとしています。 ただ、GetPhysicalMonitorsFromHMONITORの呼び出しで、PHYSICAL_MONITOR構造体のメンバのhPhysicalMonitorに ハンドルが入りません。 (0のまま) softMCCSで調べるとDDC/CI Supportedと表示され、こちらのソフトから調整も可能なので、 http://www.entechtaiwan.com/lib/softmccs.shtm なぜ、MSのAPIだと無理なのかが分かりません。 IntelのCUI SDKはAPIの仕様が非公開なので、使えませんでした。 http://www.intel.com/jp/support/graphics/sb/cs-020934.htm 環境 Windows7 x64/ Excel2010 x86(VBA) --- Option Explicit Enum MONITORS MONITOR_DEFAULTTONULL MONITOR_DEFAULTTOPRIMARY MONITOR_DEFAULTTONEAREST End Enum Const PHYSICAL_MONITOR_DESCRIPTION_SIZE = 128 - 1 Type PHYSICAL_MONITOR hPhysicalMonitor As Long szPhysicalMonitorDescription(PHYSICAL_MONITOR_DESCRIPTION_SIZE * 2) As Byte End Type Declare Function GetPhysicalMonitorsFromHMONITOR& Lib "Dxva2.dll" (ByVal hMonitor&, ByVal dwPhysicalMonitorArraySize&, ByVal pPhysicalMonitorArray&) Declare Function MonitorFromWindow& Lib "User32.dll" (ByVal hwnd&, ByVal dwFlags&) Declare Function GetNumberOfPhysicalMonitorsFromHMONITOR& Lib "Dxva2.dll" (ByVal hMonitor&, ByVal pdwNumberOfPhysicalMonitors&) Declare Function DestroyPhysicalMonitors& Lib "Dxva2.dll" (ByVal dwPhysicalMonitorArraySize&, ByVal pPhysicalMonitorArray&) Sub hoge() Dim h&, cnt&, ret& Dim s$ Dim st() As PHYSICAL_MONITOR h = MonitorFromWindow(Application.hwnd, MONITOR_DEFAULTTOPRIMARY) If h = 0 Then Exit Sub GetNumberOfPhysicalMonitorsFromHMONITOR h, VarPtr(cnt) If cnt = 0 Then Exit Sub ReDim st(0 To cnt - 1) ret = GetPhysicalMonitorsFromHMONITOR(h, cnt, VarPtr(st(0))) If ret Then s = st(0).szPhysicalMonitorDescription s = Left$(s, InStr(s, vbNullChar) - 1) Debug.Print s Debug.Print st(0).hPhysicalMonitor DestroyPhysicalMonitors cnt, VarPtr(st(0)) End If End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.