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
Solved

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

Posted on 2011-03-25
9
1,603 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

861 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