Jump to content

Check for unknown window


Recommended Posts

Hello

The application that I am testing occasionally flashes up what I think is an MSI window for a split second, but I dont know the name of it.

Is there a function in AutoIt that would sit and wait and when this rogue window flashes up would send an alert message containing some useful info on the window, or even do a print screen while the box is up??

I know usually I would use a winwaitactive command but as I say I dont know the name or any details of the window :)

Cheers for any help

Adam

Link to comment
Share on other sites

Hello

The application that I am testing occasionally flashes up what I think is an MSI window for a split second, but I dont know the name of it.

Is there a function in AutoIt that would sit and wait and when this rogue window flashes up would send an alert message containing some useful info on the window, or even do a print screen while the box is up??

I know usually I would use a winwaitactive command but as I say I dont know the name or any details of the window :)

Cheers for any help

Adam

This will register the creation of any windows.

#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $hForm

$hForm = GUICreate('')
GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), '_ShellHookProc')
_WinAPI_RegisterShellHookWindow($hForm)

While 1
    Sleep(100)
WEnd

Func _ShellHookProc($hWnd, $iMsg, $wParam, $lParam)
    Switch $hWnd
        Case $hForm
            Switch $wParam
                Case $HSHELL_WINDOWCREATED

                    Local $Title = WinGetTitle($lParam)

                    If IsString($Title) Then
                        ConsoleWrite('Created window: ' & $Title & @CR)
                    EndIf
            EndSwitch
    EndSwitch
EndFunc   ;==>_ShellHookProc

Func OnAutoItExit()
    _WinAPI_DeregisterShellHookWindow($hForm)
EndFunc   ;==>OnAutoItExit

WinAPIEx.au3

Edited by Yashied
Link to comment
Share on other sites

  • 2 years later...

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...