Solved

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

Posted on 2011-03-25
9
1,599 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

832 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