~ Fire Hackers ~
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Função GetProcessID

Ir para baixo

Função GetProcessID Empty Função GetProcessID

Mensagem por Coca Sáb 24 Jul 2010 - 10:21

Usando a Função GetProcessID

Oi, este é um código de começar um processo de corte, ou de outra coisa,
espero que possa ajudar em seu projeto:
Const
ProgramName = 'Programa.exe'; //write here your process to pick

Var// Variables declared
PidHandle: integer;
PidID: integer;

Function GetProcessID(Const ExeFileName: string; var ProcessId: integer;
//Function GetProcessID
Const ProcessNo :Integer = 1): boolean;
var ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
Temp: Integer;
begin
result := false;
temp:=1;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while integer(ContinueLoop) <> 0 do
begin
if (StrIComp(PChar(ExtractFileName(FProcessEntry32.szExeFile)),
PChar(ExeFileName)) = 0)
or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0) then
begin
If Temp = ProcessNo then
begin
ProcessId:= FProcessEntry32.th32ProcessID;
result := true;
break;
end else inc(Temp);
end;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle) ;
end;


if GetProcessID(ProgramName, PidId, 2) then // The number "2" is for
pick a correct pid if the program is runing and have 1 or more process
ona example: GunBound Brasil.Razz .
begin
PidHandle:= OpenProcess(PROCESS_ALL_ACCESS,False,PidId);
closehandle(PidHandle) ;
end;
Coca
Coca
Administrador
Administrador

<b>Mensagens/Posts</b> Mensagens/Posts : 77
Moedas Moedas : 5462
Idade Idade : 27
<b>Localização</b> Localização : Hacking

Compras
   : Compro o Fórum..

http://firehackers.rg3.net

Ir para o topo Ir para baixo

Ir para o topo


 
Permissões neste sub-fórum
Não podes responder a tópicos