procedure TForm2.Button1Click(Sender: TObject);
var
hSnapshot,
PID: Cardinal;
Proc32: TProcessEntry32;
Mod32: TModuleEntry32;
begin
PID := 0;
hSnapshot := TlHelp32.CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot <> 0)
and (hSnapshot <> INVALID_HANDLE_VALUE)
then
begin
try
if Process32First(hSnapshot, Proc32)
then
begin
while Process32Next(hSnapshot, Proc32)
do
begin
if AnsiUppercase(Proc32.szExeFile) = '
QIP.EXE'
then
begin
PID := Proc32.th32ProcessID;
Break;
end;
end;
end;
finally
CloseHandle(hSnapshot);
end;
end;
if PID <> 0
then
begin
hSnapshot := TlHelp32.CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, PID);
if (hSnapshot <> 0)
and (hSnapshot <> INVALID_HANDLE_VALUE)
then
begin
try
if Module32First(hSnapshot, Mod32)
then
begin
while Module32Next(hSnapshot, Mod32)
do
begin
if AnsiUppercase(Mod32.szModule) = '
PLUGIN.DLL'
then
begin
// Modul Handle steht jetzt in
// Mod32.hModule
Break;
end;
end;
end;
finally
CloseHandle(hSnapshot);
end;
end;
end;
end;