请问哪个大侠有进程和模块管理的资料?? 最近看进程里面的模块有有兴趣,不知哪个大侠有DELPHI这方面的资料让我参考参考..... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, TLHelp32;type TForm1 = class(TForm) Button1: TButton; ComboBox1: TComboBox; ListBox1: TListBox; ListBox2: TListBox; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ListBox1Click(Sender: TObject); private { Private declarations } public { Public declarations } FSnapshotHandle: THandle; ModuleArray: array of TModuleEntry32; function GetProcessID(var List: TStringList; FileName: string = ''): TProcessEntry32; end;var Form1: TForm1;implementation{$R *.DFM}function Tform1.GetProcessID(var List: TStringList; FileName: string = ''): TProcessEntry32;var Ret: BOOL; s: string; FProcessEntry32: TProcessEntry32;begin FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := Sizeof(FProcessEntry32); Ret := Process32First(FSnapshotHandle, FProcessEntry32); while Ret do begin s := ExtractFileName(FProcessEntry32.szExeFile); if (FileName = '') then List.Add(PChar(s)) else if (AnsicompareText(Trim(s),Trim(FileName))=0) and (FileName <> '') then begin List.Add(Pchar(s)); result := FProcessEntry32; break; end; Ret := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle);end;procedure TForm1.Button1Click(Sender: TObject);var FProcessEntry32: TProcessEntry32; PID: integer; List: TStringList; ModuleListHandle: Thandle; ModuleStruct: TMODULEENTRY32; J: integer; Yn: boolean;begin if Combobox1.itemindex = -1 then exit; List := TStringList.Create; FProcessEntry32 := GetProcessID(List, Combobox1.text); PID := FProcessEntry32.th32ProcessID; ModuleListHandle := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pID); ListBox1.Items.Clear; ModuleStruct.dwSize := sizeof(ModuleStruct); yn := Module32First(ModuleListHandle, ModuleStruct); j := 0; while (yn) do begin SetLength(ModuleArray, j + 1); ModuleArray[j] := ModuleStruct; ListBox1.Items.Add(ModuleStruct.szExePath); yn := Module32Next(ModuleListHandle, ModuleStruct); J := j + 1; end; CloseHandle(ModuleListHandle);end;procedure TForm1.FormCreate(Sender: TObject);var List: TStringList; i: integer;begin Combobox1.clear; List := TStringList.Create; GetProcessID(List); for i := 0 to List.Count - 1 do begin Combobox1.items.add(Trim(List.strings[i])); end; List.Free; Combobox1.itemindex := 0;end;procedure TForm1.ListBox1Click(Sender: TObject);var I: integer;begin Listbox2.Clear; if Listbox1.itemindex = -1 then exit; for i := 0 to Length(ModuleArray) do begin if UpperCase(Listbox1.items[Listbox1.itemindex]) = UpperCase(ModuleArray[i].szExePath) then begin Listbox2.Items.add('模块名称:' + ModuleArray[i].szModule); Listbox2.items.add('模块ID:' + IntToStr(ModuleArray[i].th32ModuleID)); Listbox2.items.add('所属进程ID:' + IntToStr(ModuleArray[i].th32ProcessID)); Listbox2.Items.add('全局使用数:' + intToStr(ModuleArray[i].GlblcntUsage)); Listbox2.items.add('进程使用数:' + IntToStr(ModuleArray[i].ProccntUsage)); ListBox2.items.add(format('模块基地址:%.8X' ,[Integer(ModuleArray[i].modBaseAddr)])); Listbox2.items.add(format('模块大小:%.8X' ,[ModuleArray[i].modBaseSize])); Listbox2.items.add(format('模块句柄:%.8X' ,[ModuleArray[i].hModule])); exit; end; end;end;end. delphi7做的程序, 在操作系统任务栏的程序图标上右键弹出菜单里选择“关闭”时,是触发什么事件??? 禁止窗体拖大拖小怎么设置啊 如何注销进程中的dll,请教了 有谁用过sncCurrencyEdit这个控件啊?用过的来看看! “Translate Error,Value Out Of Bounds"是怎么回事? 求助 我想要这样的工作环境,不知有没有 日期格式小问题。 报表的问题!对报表比较熟悉的朋友帮一下忙! 请高手指教这个问题 关于Tcxverticalgrid的问题 如何把tmemorystream对象 完整的拷贝到令一个tmemorystream对象??
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, TLHelp32;
type TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
ListBox1: TListBox;
ListBox2: TListBox;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
FSnapshotHandle: THandle;
ModuleArray: array of TModuleEntry32;
function GetProcessID(var List: TStringList; FileName: string = ''): TProcessEntry32;
end;var
Form1: TForm1;implementation{$R *.DFM}
function Tform1.GetProcessID(var List: TStringList; FileName: string = ''): TProcessEntry32;
var
Ret: BOOL;
s: string;
FProcessEntry32: TProcessEntry32;
begin
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
Ret := Process32First(FSnapshotHandle, FProcessEntry32);
while Ret do
begin
s := ExtractFileName(FProcessEntry32.szExeFile);
if (FileName = '') then
List.Add(PChar(s))
else if (AnsicompareText(Trim(s),Trim(FileName))=0) and (FileName <> '') then
begin
List.Add(Pchar(s));
result := FProcessEntry32;
break;
end;
Ret := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;procedure TForm1.Button1Click(Sender: TObject);
var
FProcessEntry32: TProcessEntry32;
PID: integer;
List: TStringList;
ModuleListHandle: Thandle;
ModuleStruct: TMODULEENTRY32;
J: integer;
Yn: boolean;
begin
if Combobox1.itemindex = -1 then exit;
List := TStringList.Create;
FProcessEntry32 := GetProcessID(List, Combobox1.text);
PID := FProcessEntry32.th32ProcessID;
ModuleListHandle := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pID);
ListBox1.Items.Clear;
ModuleStruct.dwSize := sizeof(ModuleStruct);
yn := Module32First(ModuleListHandle, ModuleStruct);
j := 0;
while (yn) do
begin
SetLength(ModuleArray, j + 1);
ModuleArray[j] := ModuleStruct;
ListBox1.Items.Add(ModuleStruct.szExePath);
yn := Module32Next(ModuleListHandle, ModuleStruct);
J := j + 1;
end;
CloseHandle(ModuleListHandle);
end;procedure TForm1.FormCreate(Sender: TObject);
var
List: TStringList;
i: integer;
begin
Combobox1.clear;
List := TStringList.Create;
GetProcessID(List);
for i := 0 to List.Count - 1 do
begin
Combobox1.items.add(Trim(List.strings[i]));
end;
List.Free;
Combobox1.itemindex := 0;
end;procedure TForm1.ListBox1Click(Sender: TObject);
var
I: integer;
begin
Listbox2.Clear;
if Listbox1.itemindex = -1 then exit;
for i := 0 to Length(ModuleArray) do
begin
if UpperCase(Listbox1.items[Listbox1.itemindex]) = UpperCase(ModuleArray[i].szExePath) then
begin
Listbox2.Items.add('模块名称:' + ModuleArray[i].szModule);
Listbox2.items.add('模块ID:' + IntToStr(ModuleArray[i].th32ModuleID));
Listbox2.items.add('所属进程ID:' + IntToStr(ModuleArray[i].th32ProcessID));
Listbox2.Items.add('全局使用数:' + intToStr(ModuleArray[i].GlblcntUsage));
Listbox2.items.add('进程使用数:' + IntToStr(ModuleArray[i].ProccntUsage));
ListBox2.items.add(format('模块基地址:%.8X' ,[Integer(ModuleArray[i].modBaseAddr)]));
Listbox2.items.add(format('模块大小:%.8X' ,[ModuleArray[i].modBaseSize]));
Listbox2.items.add(format('模块句柄:%.8X' ,[ModuleArray[i].hModule]));
exit;
end;
end;
end;end.