Jump to content

MsgBox Monitor


Recommended Posts

Quick question. How do you control which monitor a MsgBox will pop up on. Most normal windows popup where the mouse/focus is. The MsgBox seems to always go to the Default desktop monitor.

Bob Chernow

--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Link to comment
Share on other sites

Quick question. How do you control which monitor a MsgBox will pop up on. Most normal windows popup where the mouse/focus is. The MsgBox seems to always go to the Default desktop monitor.

Bob Chernow

The last optional parameter of MsgBox() is a window handle to use as a parent for the MsgBox().

Entering a window handle into the MsgBox() parameter, causes the MsgBox to pop-up on the window with that handle.

Link to comment
Share on other sites

The last optional parameter of MsgBox() is a window handle to use as a parent for the MsgBox().

Entering a window handle into the MsgBox() parameter, causes the MsgBox to pop-up on the window with that handle.

Thanks for the suggestion. I just tried it but it does not seem to affect the window. I am sure it probably is making the window the parent, but it still comes up smack dab in the center of the first monitor. Here is the code.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

MsgBox(4096, "Handle", "Get Foreground Window: " & _WinAPI_GetForegroundWindow(),_WinAPI_GetForegroundWindow())

Bob Chernow

--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Link to comment
Share on other sites

Thanks for the suggestion. I just tried it but it does not seem to affect the window. I am sure it probably is making the window the parent, but it still comes up smack dab in the center of the first monitor. Here is the code.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

MsgBox(4096, "Handle", "Get Foreground Window: " & _WinAPI_GetForegroundWindow(),_WinAPI_GetForegroundWindow())

Bob Chernow

The last parameter in MsgBox() is the fifth parameter. You have the Window handle as the timeout value.

Try

MsgBox(4096, "Handle", "Get Foreground Window: " & _WinAPI_GetForegroundWindow(), 0, _WinAPI_GetForegroundWindow())

Link to comment
Share on other sites

The last parameter in MsgBox() is the fifth parameter. You have the Window handle as the timeout value.

Try

MsgBox(4096, "Handle", "Get Foreground Window: " & _WinAPI_GetForegroundWindow(), 0, _WinAPI_GetForegroundWindow())

Well, I probably am still doing something wrong, but it does not work as the fifth parm either. At least not for me. But the UDF in the previous post seems to work just fine. Seems like a lot of code but I imagine most of that is for the scrollbars. It will serve me for now, until I can figure out an easier way if possible.

Thanks to all of you. I hope to start contributing more that I ask, as soon as I can.

Bob

--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Link to comment
Share on other sites

Well, I probably am still doing something wrong, but it does not work as the fifth parm either. At least not for me. But the UDF in the previous post seems to work just fine. Seems like a lot of code but I imagine most of that is for the scrollbars. It will serve me for now, until I can figure out an easier way if possible.

Thanks to all of you. I hope to start contributing more that I ask, as soon as I can.

Bob

Mea Culpa,

The Hwnd in the last parm does work. It just was not doing what I expected it to do. Last night when I was testing the change I only had a single monitor attached and was expecting the msgbox to pop up relative to the active window. I tested with windows in all sorts of screen locations and it always popped dead center in the screen so I ASSUMED it was not working.

This morning I tried it with both monitors and it does show on the correct monitor now. Still in the screen center, but on the correct monitor. That is great. Thanks to all.

Bob (newbie)

--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...