[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


how do I extend my desktop to a 2nd monitor, using a script?

Posted on 2007-08-11
Medium Priority
Last Modified: 2013-11-05
I would like  script to extend my desktop to a 2nd monitor. I frequently take my laptop from home and work. I would like to not have to manually switch it by right clicking on the desktop, what a pain. Is there a windows API command or a .NET command that would do this for me? The solution could be written as a VBscript, or windows script, or in .NET. or a 3rd party app.

I found this blog which was useful, but I wonder if there is a better, more reliable way. I don't really like scripting against the GUI (using autoIT). It is not a very safe thing to do in my opinion. http://rallenhome.com/2006/08/extending-desktop-via-script.html

I'd really appreciate the help!
Question by:brokeMyLegBiking

Accepted Solution

danis79 earned 2000 total points
ID: 19676421
If you have nvidia this should do the trick

for dual view
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("rundll32.exe nvcpl.dll,dtcfg setview 1 dualview")

for single display
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("rundll32.exe nvcpl.dll,dtcfg setview 1 normal")

more information about nvcpl.dll can be found here http://download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/common/src/NvCpl/docs/NVControlPanel_API.pdf#search=%22nvcpl.dll%20api%22

Author Comment

ID: 19677631
beautiful! you are my new best friend!

Loads of thanks, bloody brilliant. (Sorry, I'm reading Harry Potter 7 right now).



Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

872 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