Enumerating top level windows

Started by Vortex, December 02, 2025, 10:00:00 PM

Previous topic - Next topic

Vortex

Here is a quick example :

include     EnumWnd.inc

.data

f1          db '%s',13,10,0

.data?

buffer      db 128 dup(?)
buffer2     db 128 dup(?)

.code

start:

    invoke  EnumWindows,ADDR EnumWndProc,0
    invoke  ExitProcess,0
   

EnumWndProc PROC hwnd:DWORD,lParam:DWORD

    invoke  GetWindowText,hwnd,ADDR buffer,64
    invoke  wsprintf,ADDR buffer2,ADDR f1,ADDR buffer
    invoke  StdOut,ADDR buffer2
    mov     eax,1
    ret

EnumWndProc ENDP

END start
Code it... That's all...

TimoVJL

Empty lines should avoid too.
Also wsprintf give count of chrs to print text, so it can be used too.
WriteFile / WriteConsole works well with wsprintf.
May the source be with you

Vortex

Hi Timo,

Thanks, I will take care of it.
Code it... That's all...