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

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!
LVL 4
brokeMyLegBikingAsked:
Who is Participating?
 
danis79Commented:
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
0
 
brokeMyLegBikingAuthor Commented:
beautiful! you are my new best friend!

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

Cheerio,

-brokeMyLegBiking
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.