Erro getProcessId delphi
21/12/2015
0
Bom to tentando criar um programa no qual ele acessa as memórias. O problema é que não consigo passar da parte do código em identificar o processo e abrir, acontece o seguinte erro no código o qual ja procurei na net e não achei solução:
Aqui ele indica o seguinte:
Type of expression must to be boolean.
E aqui outro erro:
Expected end, but received a identifier szExeFile.
E aqui está todo o código que estou tentando utilizar:
Se alguem tiver uma luz sobre como corrigir, agradeço.
if (StrIComp(PChar(ExtractFileName(FProcessEntry32.sz ExeFile)), PChar(ExeFileName)) = 0) or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0) then begin
Aqui ele indica o seguinte:
(StrIComp(PChar(ExtractFileName(FProcessEntry32.sz ExeFile))
Type of expression must to be boolean.
E aqui outro erro:
FProcessEntry32.szExeFile
Expected end, but received a identifier szExeFile.
E aqui está todo o código que estou tentando utilizar:
function GetProcessID(Const ExeFileName: string; var ProcessId: integer): boolean; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32; begin result := false; FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := Sizeof(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); while integer(ContinueLoop) <> 0 do begin if (StrIComp(PChar(ExtractFileName(FProcessEntry32.sz ExeFile)), PChar(ExeFileName)) = 0) or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0) then begin ProcessId:= FProcessEntry32.th32ProcessID; result := true; break; end; ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle); end;
Se alguem tiver uma luz sobre como corrigir, agradeço.
Gilberto
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)