Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- HWND = PtrUInt;
- _EnumWindowsProc = function(wnd:HWND; Param: PtrUInt): LongBool;
- TEnumWindowsProc = native(_EnumWindowsProc, ffi_stdcall);
- function EnumWindows(lpEnumFunc: TEnumWindowsProc; Param: PtrUInt): LongBool; external 'EnumWindows@user32.dll stdcall';
- function GetWindowTextW(wnd: HWND; lpString: ^WideChar; nMaxCount: Int32): Int32; external 'GetWindowTextW@user32.dll stdcall';
- function GetWindowText(wnd: HWND): WideString;
- type PWideChar = ^WideChar;
- begin
- SetLength(Result, 1024);
- SetLength(Result, GetWindowTextW(wnd, PWideChar(Result), 1024));
- end;
- procedure EnumProcesses();
- function EnumProcess(Handle: HWND; Param: PtrUInt): LongBool; static;
- begin
- WriteLn GetWindowText(Handle);
- end;
- begin
- EnumWindows(@EnumProcess, 0);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement