Registriert seit: 27. Okt 2004
292 Beiträge
Delphi 7 Professional
|
Re: LVM_FINDITEM, Taskmanager stürzt ab
5. Jun 2005, 15:16
Sorry, wenn ich wieder nerve.
Ich hab das jetzt so:
Delphi-Quellcode:
function TfrMain.GetTaskmgrProcess(process: String):integer;
var
wnd: HWND;
ItemCount: Cardinal;
LVI: TLvfindinfo;
ret: Integer;
dwPId: DWORD;
hProc: THANDLE;
pAddr: pointer;
begin
wnd := FindWindow('#32770', 'Windows Task-Manager');
wnd := FindWindowEx(wnd, 0, '#32770', nil);
wnd := FindWindowEx(wnd, 0, 'SysListView32', 'Prozesse');
if wnd <> 0 then
begin
if BOOL(GetWindowThreadProcessId(wnd,dwPID)) then
hProc := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE, FALSE, dwPId);
if hProc <> 0 then
begin
pAddr:=VirtualAllocEx(hProc, nil, sizeof(lvi), MEM_RESERVE or MEM_COMMIT, PAGE_READWRITE);
LVI.psz := Pchar(process);
LVI.flags := LVFI_STRING;
ret := SendMessage(wnd, LVM_FINDITEM, -1, Integer(@pAddr));
result:=ret;
end;
end;
end;
Und wen wunderts, es geht immernoch nicht ;( . Was habe ich denn vergessen ? Wo steckt mein Denkfehler ?
|
|
Zitat
|