Jump to content
Sign in to follow this  

Detect Any new popup window and create a popup with its name?

Recommended Posts

Hi Guys,

My laptop keeps getting a random window popup and it vanishs really really fast so I cant see what it is that is popping up, I want to detect the Title of the popup (don't know if it goes into focus or not) and just simply make a popup containing the title of the program so I can have a look at whatever it is.

How would I do this in autoit?

Share this post

Link to post
Share on other sites

You could do this:

#include <GUIConstantsEx.au3>
#include <WinAPIEx.au3>


Func Example()
    Local $hGUI = GUICreate('An(other) example by guinness - 2013', Default, Default) ; Create a GUI.
    GUISetState(@SW_SHOW, $hGUI)

    GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function.
    _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI.

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE

EndFunc   ;==>Example

Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg
    Switch $wParam

            ConsoleWrite('Created: ' & @CRLF & _
                    @TAB & 'PID: ' & WinGetProcess($lParam) & @CRLF & _ ; This is the PID.
                    @TAB & 'Filename: ' & _WinAPI_GetWindowFileName($lParam) & @CRLF & _ ; This is the filepath of the window.
                    @TAB & 'hWnd: ' & WinGetTitle($lParam) & @CRLF) ; This will be the handle of the window closed.

EndFunc   ;==>WM_SHELLHOOK



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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...