[B]function[/B] GetModuleFileNameEx(hProcess:DWORD; hModule:DWORD; Buffer:PChar; nSize:DWORD):DWORD; [B]stdcall; external[/B] 'PSAPI.DLL'[B] name[/B] 'GetModuleFileNameExA'; [B]procedure[/B] WinEventProc(hWinEventHook :THandle; event :DWORD; hwnd :HWND; idObject, idChild :Longint; idEventThread, dwmsEventTime :DWORD); [B]stdcall;[/B] [B]var[/B] buffer :[B]array[/B] [0..MAX_PATH] [B]of[/B] char; ModuleName:[B]string[/B]; ClassName :[B]string[/B]; Caption :[B]string[/B]; pID :DWORD; hProc :DWORD; [B]begin[/B] SetString(ClassName,buffer,GetClassName(hwnd,buffer,MAX_PATH)); SetString(Caption,buffer,GetWindowText(hwnd,buffer,MAX_PATH)); SetString(ModuleName,buffer,GetWindowModuleFileName(hwnd,buffer,MAX_PATH)); [B]if [/B]ModuleName=EmptyStr [B]then[/B] [B]begin[/B] GetWindowThreadProcessId(hwnd,@pID); hProc:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ or SYNCHRONIZE,TRUE,pID); [B] if[/B] hProc>0 [B]then[/B] [B] try[/B] SetString(ModuleName,buffer,GetModuleFileNameEx(hProc,0,buffer,MAX_PATH)); [B]finally[/B] CloseHandle(hProc); [B]end; end;[/B] //TODO[SIZE=4] [B]What is the next step?[/B][/SIZE] [B]end;[/B]
Edited by Gerg? Magyar, 08 December 2011 - 08:06 AM.


Sign In
Create Account


Back to top









