Jump to content
Sign in to follow this  

Click a window's system menu (NOT by pressing Alt-Space)

Recommended Posts


I'm working on a script that runs the DOSBox MS-DOS emulator while the script remains running in the background.

DOSBox doesn't respond to the Alt-Space keystroke that normally opens the "system menu" at the upper left corner of a window. I want to set a hotkey in my script that will click on that menu when I press Alt-Space or some other key.

I know how to set a hotkey in AutoIt. What I don't know is how to make AutoIt click the system menu (NOT the File menu or any other top-line menu) of a window. If anyone knows how to do this, could you kindly let me know how it's done?

Thanks for any help.

Share this post

Link to post
Share on other sites


Take a look at MouseMove, MouseClick functions in the help file.

Edit :

Global $aDOSBoxWndPos = WinGetPos("DOSBox ")

MouseClick("left", $aDOSBoxWndPos[0] + 5, $aDOSBoxWndPos[1] + 5, 1, 0)

Edit2 : There is maybe a winapi function or another trick to show this menu without clicking with the mouse on it.

Br, FireFox.

Edited by FireFox


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control


Share this post

Link to post
Share on other sites

The MouseClick idea is probably the best one - and thanks for spelling out the exact code. As you say in your EDIT2, I hope there's something else that can do this, because the MouseClick method relies on coordinates which may not always be where we expect.

But this certainly does what I asked - thank you again!

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