Solved

Need Win7 x86/x64 source code to set duplicate/extend monitor display modes

Posted on 2011-03-25
9
1,614 Views
Last Modified: 2013-12-04
Can anyone point me to (preferably C#, C++ ok) source code to change display mode back and forth between mirror (duplicate) display mode vs extended mode? Need to target Win7 x86/x64 dual-monitor PCs and need code that's display driver independent. This for an app that reads desired video settings from registry and sets up displays accordingly.

Essentially I want to replicate what happens on Win7 when you hit Windows-P and select Duplicate or Extend.

WMI or not WMI is good. Prefer something expected to be portable to future Windows versions.
0
Comment
Question by:mab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
9 Comments
 
LVL 88

Expert Comment

by:rindi
ID: 35221327
I'm afraid as windows 7 isn't opensource, you will never be able to get their source code. They don't even sell it to partners.
0
 

Assisted Solution

by:mab
mab earned 0 total points
ID: 35226964
Don't need source to Win7, just a bit of source I can put in an app to interact with Win7. Other folks have done this, e.g. UltraMon, but I don't know how. And I need a bit of code I can integrate into an app instead of an existing app which won't have the non-UI control interface I need.
0
 
LVL 88

Expert Comment

by:rindi
ID: 35227042
You won't be able to get even a bit of source code for any Windows OS, at least not legally, and on this site you'll only ever going to get answers that are legal. How others did things I don't know, maybe through reverse engineering, or maybe by creating something new from scratch? But either way you'd have to do it yourself.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Assisted Solution

by:mab
mab earned 0 total points
ID: 35235670
rindi,

My apologies if I'm misinterpreting what you've said, but I get the impression you think I'm trying to obtain some Win7 OS source code, legally or illegally. That's not what I'm after at all.

When I press Windows+P and Duplicate/Extend, something (shell?) responds and calls some Win7 APIs to change the display config. What I want to do is identify what APIs get called to accomplish this so that I can call the same APIs from my code.

0
 

Accepted Solution

by:
mab earned 0 total points
ID: 35449084
Close it as "solved by originator"? Also "abandoned", I guess, but "abandoned" doesn't indicate solution found.

I found a very simple solution buried in the Win7 display driver docs:
SetDisplayConfig(0,NULL,0,NULL,SDC_TOPOLOGY_CLONE|SDC_APPLY);

Guess I'll have to award the points to myself... ;-)
0
 

Author Comment

by:mab
ID: 35449225
so easy to do, so well hidden in the docs...

Why does EE closing insist I choose at least two comments to award points to? None of the comments were useful except my own on closing that showed the solution I found.
0
 

Author Closing Comment

by:mab
ID: 35473563
SetDisplayConfig() and related Win7 APIs are more powerful/flexible and more complex than what was available previously.

Wish I'd thought of digging around in the driver docs sooner. Been looking into this issue off and on for some time now.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question