Jump to content
Sign in to follow this  

ControlClick Issue with Vista

Recommended Posts


Hi folks,

i wrote a little script to switch the primary monitor in Vista.

I need to click at the control

[CLASS:Monitor32; INSTANCE:2]

which changes to

[CLASS:Monitor32; INSTANCE:1]

after a click on it (the other monitor gets INSTANCE:2 then).

Well, sounds quite easy, bt when i use the following command, the settings dialog is opened but no click is performed:

Run ("RunDll32.exe shell32.dll,Control_RunDLL desk.cpl")
ControlClick ( "Anzeigeeinstellungen", "", "[CLASS:Monitor32; INSTANCE:2]")

What did i do wrong?

Thank you very much in advance.

Edited by bmueller

Share this post

Link to post
Share on other sites

Same problem. Here's a possible solution, not pretty, but it works.

Opt("MouseCoordMode", 2)

Run ("RunDll32.exe shell32.dll,Control_RunDLL desk.cpl")
WinWait("[CLASS:#32770; TITLE:Display Settings]")
$hwnd = WinGetHandle("[CLASS:#32770; TITLE:Display Settings]")
$chwnd = ControlGetHandle("Display Settings", "", "Monitor322")
$cpos = ControlGetPos($hwnd, "", $chwnd)
MouseMove($cpos[0] + 5, $cpos[1] + 5, 0)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.