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

Posted on 2007-08-11
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.

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

    Accepted Solution

    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
    LVL 4

    Author Comment

    beautiful! you are my new best friend!

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



    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now