Jump to content
Sign in to follow this  

Moving a MsgBox

Recommended Posts


Hey guys!

I'm new at autoit(I'm c++ programmer), so I love if someone can help me with my problem.

So my question is, is there a way I can move the MsgBox?

I tried it with:

MsgBox(4096, "Test", "This is a test")
WinMove("[LAST]", "", 100, 100, 500, 250)  

for example, but the problem is that WinMove doesn't detect it by default.

So can someone explain me how I can fix this?

Share this post

Link to post
Share on other sites

MsgBox is a blocking function, meaning that it pauses script execution.

The WinMove line only gets called when the message box is closed.

Try using Melba23's ExtMsgBox UDF:

'?do=embed' frameborder='0' data-embedContent>>

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha


Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post

Link to post
Share on other sites

Thank you guys - really helped me!

Share this post

Link to post
Share on other sites

MsgBoxUDF is very good, it will be usefull, thank you !

An other way could be to use a timer with _Timer_SetTimer, which does not seem to be blocking...

Global $moved = 0
_Timer_SetTimer($hWnd, 250, "_MoveBox")

MsgBox(0, $boxTitle, "", 2)

Func _MoveBox($hWnd, $Msg, $iIDTimer, $dwTime)
    If WinExists($boxTitle) AND NOT $moved Then
        WinMove($boxTitle, "", 0, 0)
        $moved = 1

Is it appropriate?

Share this post

Link to post
Share on other sites

If it works and doesn't cause any problems, then why not.

I've used the Adlib functions and even fired off a small external watching exe in times past ... called WinWatch or something like that, where you pass the Title name to be watched for as a parameter of the Run command. That exe can have a timeout and be hidden, and you run it just prior to the MsgBox or Window in question ... and have it read some values from an INI file ... even the title (rather than place it on the command-line).

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


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