Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on December 02, 2025, 10:00:00 PM

Title: Enumerating top level windows
Post by: Vortex on December 02, 2025, 10:00:00 PM
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
Title: Re: Enumerating top level windows
Post by: TimoVJL on December 03, 2025, 01:16:10 PM
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.
Title: Re: Enumerating top level windows
Post by: Vortex on December 03, 2025, 09:23:22 PM
Hi Timo,

Thanks, I will take care of it.