'Change Monitor Input Source

I want to change my monitor input source with AutoHotkey, and I have this partially working. However when I use the hotkey to change the Monitor Input Source to my xbox(YPbYr) from pc(DVI), the monitor doesn't detect that the xbox is on, it says no source.

Monitor => Asus vg236

VCP Monitor Input Source codes for my monitor:

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

I'm using the Windows API Monitor Configuration Functions specifically the SetVCPFeature function which uses DDC/CI.

After some research I've decided I want to set the VCP Input Source this has some useful information specifically on page 71 about the Input Source.

AutoHotkey Code:

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

I'm wondering if I need to set another VCP code value somewhere to notify the monitor the source has changed.

Note: I have no HDMI devices so I can't tell if this only affects YPbYr or all inputs.

Question: how do I make my monitor recognize YBpYr is on, as right now the monitor acts as if YBpYr is not on?

Question: Do I need to set another VCP code value other than the 0x60 Input Source?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source