Solved

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

Posted on 2011-03-25
9
1,624 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

729 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