Software Archive
Read-only legacy content
17061 Discussions

Programmatically enable/disable secondary monitor (winxp, vista)

helpseeker
Beginner
1,162 Views
Hi,

we are currently working on software project which involves multi
monitor (up to two monitors) support. Basically, the s/w should
be able to:

- Run on any windows computer (desktop or laptop) supporting
secondary monitor.
- Detect whether the secondary monitor is connected or not;
- Route desktop picture to: Primary monitor, Secondary Monitor, or
both.
- Do some GDI graphics on Primary/Secondary/Both displays but that
is not related to this topic tho.

We have no problems with the most of graphics and only stuck when
it comes to Intel integrated chipsets such as 945G etc. The problem
(it is s/w problem) is that 945G windows drivers are not following
any rules when it comes to programmatic control. Unfortunately
there is no way to tell whether there is a secondary monitor connected
or enable/disable it using native win32 API such as EnumDisplayDevices
or EnumDisplaySettingsEx.

Finally we found a way to detect whether there is a secondary monitor
connected inspecting [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesialmDevice0]
registry key. But it is still not 100% reliable and we have no way to
enable/disable the secondary monitor.

The main problem here as we see it is that graphics drivers are not
supporting standard API paths but instead are using a different
interface named Intel CUI (Common User Interface). Basically it is a
set of COM interfaces intended to control various settings of the
graphics chipset, including multi monitor support!

Could someone kindly answer whether there is a possibility to access
CUI information (we suspect there should be an SDK or whatever) or
suggest how to workaround it using native win32 API. The highest
priority items are: detecting secondary monitor, enabling/disabling
secondary monitor. Note that EnumDisplayDevices/EnumDisplaySettings
are useless here returning same information regardless of the actual
multimon setup: primary, secondary or both monitors are enabled...

Thanks for any pointers.

0 Kudos
4 Replies
helpseeker
Beginner
1,162 Views
Anyone pls. How does one get access to the CUI SDK? It is clearly
possible, at least laptop manufacturers can control the second monitor
from their s/w or using dedicated function keys on keypad.

It is so frustrating, our customers are constantly complaining about
issues on laptops with Intel integraded graphics. Why this can't be
just done using native OS API?


0 Kudos
7oby
New Contributor II
1,162 Views
Have you tried
http://www.entechtaiwan.com/util/multires.shtm

Command Line options are mentioned on the webpage. Just bundle it with your app (I don't think you need to install anything).

The website above also has a forum with very competent people and coders. Maybe they can provide you to some direct (maybe even undocumented) Windows API Links that help.
0 Kudos
helpseeker
Beginner
1,162 Views
Thanks 7oby,

multires doesn't alow you to enable/dispable secondary monitor.
It is only used to change the resolution, something that we have
no probs with.
0 Kudos
7oby
New Contributor II
1,162 Views
Since it supported multi monitor setups I concluded that it would also be able to enable/disable multi monitors. enabling by means of /2:1024,768,16,60 and maybe /restore.

But I haven't installed it and can't check it.

You have seen the Hotkeys to enable/disable screens within the GMA driver Application (igfxcfg). If the hotkeys are sufficient, then you might trigger those from inside your application as a kind of workaaround. Certainly it's difficult to "read" / "probe" the current display state in this approach.

bg,
7oby
0 Kudos
Reply