Jump to content

Detecting the origin of the message box.


Recommended Posts

My AutoIt program operates on windows of another application. The application opens many windows and some of them generate their own native dialog boxes or message boxes that have identical titles. While my script is joggling the windows some new may be opened by the main application also with their msgboxes. Many a time I must get on top of the screen the message box generated by a specific window and not just any window. How do I know that a message box has been generated by the Window1 and not by the Window2, again if simultaneously there are the two message boxes of the identical titles?

If I could detect the origin of the message box or in other words determine the relation to its "parent" window...

Warmly,Narciso

Link to comment
Share on other sites

My AutoIt program operates on windows of another application. The application opens many windows and some of them generate their own native dialog boxes or message boxes that have identical titles. While my script is joggling the windows some new may be opened by the main application also with their msgboxes. Many a time I must get on top of the screen the message box generated by a specific window and not just any window. How do I know that a message box has been generated by the Window1 and not by the Window2, again if simultaneously there are the two message boxes of the identical titles?

If I could detect the origin of the message box or in other words determine the relation to its "parent" window...

Download Auto3Lib and run this in SciTE:

#include <A3LWinAPI.au3>

Send("!F")
Send("a")

$hWnd = WinGetHandle("Save File")
ConsoleWrite("Save File handle .: " & $hWnd & @CR)
$hParent = _API_GetParent($hWnd)
ConsoleWrite("Parent handle ....: " & $hParent & @CR)
ConsoleWrite("Parent caption ...: " & _API_GetWindowText($hParent) & @CR)
Auto3Lib: A library of over 1200 functions for AutoIt
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...