Windows 7 automation: Screen Resolution - Set Monitor as main display

From excel, and using the terminology of ControlPanel// Display/ Screen Resolution, how do I use code to set my PC laptop's screen as the MAIN DISPLAY?

My project uses an extension screen, and I must ensure that the property of 'Main Display' is not altered when I use automation to fit the dimensions of office Application windows to their respective screens.

Thanks,
Kelvin



Sorry! My references (above) to automation and code served to indicate the need for a programming solution.
Thanks



Sorry! My references (above) to automation and code served to indicate the need for a programming solution.
Thanks



What do you mean by "from excel"?
Are you looking for something like this *link removed*. and have you tried the Windows Key + P?



Thanks lionelmm, this HELPS ME...

Firstly, just to clarify, I run excel, plus an instance of the MS Visio application in early binding to the excelApp. An extension monitor is added to my laptop PC and, via vba, I can automatically re-position the excel and visio app windows, and user forms, so they present a tidy layout to the user.

However, the code supporting this re-positioning requires that the PC laptop monitor is the MAIN Monitor of the two.
Vba function MonitorEnumProc, DETECTS if the extended monitor is the main monitor, but I dont have the code procedure to RE_SET the PC laptop monitor as the MAIN MONITOR, whilst KEEPING the DUAL-monitor setup in use.

YOUR LINK to stackoverflow is very interesting. I found that Windows 7 key + P always sets the laptop monitor as the MAIN monitor, even if the extended monitor was previously the main monitor. SO! I'd like to try to use it for the above!

Please can you help me for one more step? In the stackoverflow answer:
DisplaySwitch.exe /external
notepad.exe
..... this batch file [will] open notepad and it will always open and switch to the external display only.
(actually I have never made a batch file).... but..... I guess that the following will switch to the extended monitor setup with laptop monitor as main monitor:
DisplaySwitch.exe /extend
notepad.exe

I dont know how to write a batch file, and I need to use the SWITCH function in real time, when excel is being used.
Can I use a batch file for that, or should I write a different sort of module code procedure?

Many thanks indeed for your help
Kelvin



@Kelvin4

A comment was deleted just above your first comment, probably because it was a 'blind' link. I'll check for you what happened.

Gerwin Jansen
EE Topic Advisor



Hi Gerwin:Thanks - that's kind.
I did read and respond to that that comment (Kelvin42015-04-02 at 17:11:08ID: 40703397).
Useful progress has now been made with another expert.

Regards,
Kelvin

Share this

Related Posts

There was an error in this gadget