更改监视器输入源

Jos*_*h D 10 windows winapi autohotkey

我想用AutoHotkey更改我的显示器输入源,我有部分工作.但是,当我使用热键将监视器输入源从PC(DVI)更改为我的xbox(YPbYr)时,监视器未检测到xbox已打开,它表示没有来源.

Monitor =>华硕vg236

VCP Monitor输入我的显示器的源代码:

  • DVI => 3
  • HDMI => 4
  • YPbPr => 12

我正在使用Windows API Monitor配置函数,特别是使用DDC/CI的SetVCPFeature函数.

经过一些研究后,我决定要设置VCP输入源,这里有一些有用的信息,特别是关于输入源的第71页.

AutoHotkey代码:

setMonitorSource(source)
{  
  ; Initialize Monitor handle
  hMon := DllCall("MonitorFromPoint"
    , "int64", 0 ; point on monitor
    , "uint", 1) ; flag to return primary monitor on failure


  ; Get Physical Monitor from handle
  VarSetCapacity(Physical_Monitor, (A_PtrSize ? A_PtrSize : 4) + 128, 0)

  DllCall("dxva2\GetPhysicalMonitorsFromHMONITOR"
   , "int", hMon   ; monitor handle
   , "uint", 1   ; monitor array size
   , "int", &Physical_Monitor)   ; point to array with monitor

  hPhysMon := NumGet(Physical_Monitor)

  DllCall("dxva2\SetVCPFeature"
    , "int", hPhysMon
    , "char", 0x60 ;VCP code for Input Source Select
    , "uint", source)


  ; Destroy handle
  DllCall("dxva2\DestroyPhysicalMonitor", "int", hPhysMon)
}

!z::
setMonitorSource(12)
return
Run Code Online (Sandbox Code Playgroud)

我想知道是否需要在某处设置另一个VCP代码值以通知监视器源已更改.

注意:我没有HDMI设备,所以我不知道这是否只影响YPbYr或所有输入.

问题:如何让我的显示器识别YBpYr已启用,因为现在显示器的作用就好像YBpYr没有打开?

问题:我是否需要设置除0x60输入源以外的其他VCP代码值?