こんにちは。
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
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/f629d161-023a-4e5c-b5ea-6cc9f5f7accb/
新しいバージョンのDDC.CIしか対応していない旨の書き込みがあるので、
つまりは、そういう事なのでしょう。
ツイート | ![]() |