Jump to content

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


 Share

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?
Thanks

Link to comment
Share on other sites

You could do this:

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

Example()

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
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_DeregisterShellHookWindow($hGUI)
    GUIDelete($hGUI)
EndFunc   ;==>Example

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

        Case $HSHELL_WINDOWCREATED
            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.


    EndSwitch
EndFunc   ;==>WM_SHELLHOOK

 

Saludos

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