Jump to content
Sign in to follow this  
apr1985

Check for unknown window

Recommended Posts

apr1985

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

Share this post


Link to post
Share on other sites
Yashied

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

Share this post


Link to post
Share on other sites
apr1985

Thanks very much!!

That works perfectly (although I changed it to an msgbox rather than console text :) ).

Those winapi functions will come in handy as well.

Cheers

Adam

Share this post


Link to post
Share on other sites
anandchakru

This is not working when the autoit is running as "SYSTEM" and not as logged in User. Any idea anybody whats missing here ?


[font="Book Antiqua"]Thanks`A[/font]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.