How can I be notified when a new window is created on Win32?

前端 未结 5 1577
不思量自难忘°
不思量自难忘° 2020-12-08 11:29

Is there a way using Win32, to register for notifications when a new window is created. I\'m trying to keep a list of current open windows, but am now just polling the list

5条回答
  •  隐瞒了意图╮
    2020-12-08 12:24

    You could try WinEventHook library for autohotkey. Try modifying the notepad popup blocker example with the following:

    HookProc( hWinEventHook, Event, hWnd, idObject, idChild, dwEventThread, dwmsEventTime ) { if Event ; EVENT_SYSTEM_FOREGROUND = 0x3 {
    WinGetTitle, title, ahk_id %hWnd% If (title = "your_window_name" msgbox, your window has been created } }

提交回复
热议问题