楼主,试试以下的Var CurrentProcessId, Snapshot: DWord; MsgProcess: PROCESSENTRY32; begin CurrentProcessId := CurrentProcessId(); // 获得当前(你的)进程的ID Snapshot:=CreateToolhelp32Snapsho(TH32CS_SNAPPROCESS,CurrentProcessId) ; MsgProcess.dwSize := 296 ; // 获得第一个进程 Process32First(Snapshot, MsgProcess) ; // 循环取列举的进程 While (True) Do Begin If Process32Next(Snapshot,MsgProcess)= False Then Exit; If (MsgProcess.szExeFile='QQ.exe') Then begin If MsgProcess.th32ProcessID= CurrentProcessId Then ShowMessage('该程序是QQ'); end ; End ;end;// 楼主,能不能把注入Exe 的代码 贴出来,大家一起学习!
d0347朋友的代码有小小的错误,跑不起来,我改了一下,大家可以跑它了: procedure TForm1.Button1Click(Sender: TObject); Var CurrentProcessId, Snapshot: DWord; MsgProcess: PROCESSENTRY32; temp:string; begin CurrentProcessId := GetCurrentProcess(); // 获得当前(你的)进程的ID Snapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,CurrentProcessId) ; MsgProcess.dwSize := 296 ; // 获得第一个进程 Process32First(Snapshot, MsgProcess) ; // 循环取列举的进程 While (True) Do Begin If Process32Next(Snapshot,MsgProcess)= False Then Exit; temp:=MsgProcess.szExeFile; If (temp='smss.exe') Then begin //If MsgProcess.th32ProcessID= CurrentProcessId Then ShowMessage(Format('找到已运行程序smss.exe,进程大小=%d字节,进程ID=%d',[MsgProcess.dwSize,MsgProcess.th32ProcessID])); end ; End ;end;
当前正在运行的程序的文件名列表
uses tlhelp32;--------------varlppe:tprocessentry32;sshandle:thandle;found:boolean;beginsshandle:=createtoolhelp32snapshot(th32cs_snapail,0);found:=process32first(sshandle,lppe);while found dobegin//进行你的处理其中lppe.szExefile就是程序名。found:=proccess32next(sshandle,lppe);end;end;//线程用Thread32First,Thread32Next//模块用Module32First,Module32Next//堆用Heap32First,Heap32Next//可执行文件用process32first
CurrentProcessId, Snapshot: DWord;
MsgProcess: PROCESSENTRY32;
begin
CurrentProcessId := CurrentProcessId(); // 获得当前(你的)进程的ID
Snapshot:=CreateToolhelp32Snapsho(TH32CS_SNAPPROCESS,CurrentProcessId) ;
MsgProcess.dwSize := 296 ;
// 获得第一个进程
Process32First(Snapshot, MsgProcess) ;
// 循环取列举的进程
While (True) Do
Begin
If Process32Next(Snapshot,MsgProcess)= False Then Exit;
If (MsgProcess.szExeFile='QQ.exe') Then
begin
If MsgProcess.th32ProcessID= CurrentProcessId Then
ShowMessage('该程序是QQ');
end ;
End ;end;// 楼主,能不能把注入Exe 的代码 贴出来,大家一起学习!
====================================================================像和尚的唐僧
procedure TForm1.Button1Click(Sender: TObject);
Var
CurrentProcessId, Snapshot: DWord;
MsgProcess: PROCESSENTRY32;
temp:string;
begin
CurrentProcessId := GetCurrentProcess(); // 获得当前(你的)进程的ID
Snapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,CurrentProcessId) ;
MsgProcess.dwSize := 296 ;
// 获得第一个进程
Process32First(Snapshot, MsgProcess) ;
// 循环取列举的进程
While (True) Do
Begin
If Process32Next(Snapshot,MsgProcess)= False Then Exit;
temp:=MsgProcess.szExeFile;
If (temp='smss.exe') Then
begin
//If MsgProcess.th32ProcessID= CurrentProcessId Then
ShowMessage(Format('找到已运行程序smss.exe,进程大小=%d字节,进程ID=%d',[MsgProcess.dwSize,MsgProcess.th32ProcessID]));
end ;
End ;end;
uses tlhelp32;--------------varlppe:tprocessentry32;sshandle:thandle;found:boolean;beginsshandle:=createtoolhelp32snapshot(th32cs_snapail,0);found:=process32first(sshandle,lppe);while found dobegin//进行你的处理其中lppe.szExefile就是程序名。found:=proccess32next(sshandle,lppe);end;end;//线程用Thread32First,Thread32Next//模块用Module32First,Module32Next//堆用Heap32First,Heap32Next//可执行文件用process32first