0

I'm trying to obtain screenshots of multiple monitors using IDirect3DDevice9::GetFrontBufferData() and it works but I cannot figure out how I could identify which IDirect3DDevice9 corresponds to which monitor and so how its output is positioned on Windows "virtual screen".

I tried IDirect3DDevice9::GetViewport() but it always obtains viewport coordinates which have left top coordinate set to "0,0" (and proper width and height) so it cannot be used to identify which monitor is left and which is right.

So far I found that when I call EnumDisplayMonitors() then monitors are enumerated in the order as devices are enumerated when I call IDirect3D9::GetAdapterDisplayMode() and this can be used. However I see not documentation saying whether any order of enumeration is guaranteed for these two functions.

Can I rely on EnumDisplayMonitors() and IDirect3D9::GetAdapterDisplayMode() having the same enumeration order? Is there any better way?

sharptooth
  • 163,328
  • 92
  • 501
  • 942
  • 1
    IDirect3D9::GetAdapterMonitor() gives you the HMONITOR directly. More tricks [in the answers to this question](https://stackoverflow.com/questions/6834156/descriptive-monitor-name-from-d3d-display-adapter-id). – Raymond Chen Mar 25 '21 at 21:26
  • @RaymondChen Thank you. Could you please add this as an answer? This does work and I dunno why I failed to find it myself after staring into headers and MSDN for quite a lot of time. – sharptooth Mar 26 '21 at 09:19
  • Go ahead and post your own answer and accept it. That way, you can provide details to your satisfaction to help the next person. – Raymond Chen Mar 26 '21 at 13:52

0 Answers0