Windows98 结束进程的问题(200分)

  • 主题发起人 主题发起人 tswhq
  • 开始时间 开始时间
T

tswhq

Unregistered / Unconfirmed
GUEST, unregistred user!
在Win98中需要结束大智慧软件的hypmain.exe

procedure TMyExplorer.KillProcess(ProcessName: string);//ProcessName为'hypmain.exe'
var
v_lppe :TProcessEntry32;
v_found :Boolean;
v_Hand,h:THandle;
a :Dword;
begin
v_Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
v_lppe.dwSize:=Sizeof(v_lppe);
v_found := Process32First(v_Hand,v_lppe);
while v_found do
begin
if StrPas(v_lppe.szExeFile)=ProcessName then
begin
h:=OpenProcess(PROCESS_ALL_ACCESS,True,v_lppe.th32ProcessID);
GetExitCodeProcess(h,a);
TerminateProcess(h,a);
end;
v_found := Process32Next(v_Hand,v_lppe);
end;
end;
现在的问题是结束不了hypmain.exe这个进程
 
我过时了~ 只能帮顶一下
 
给你个算法,你可以参考,禁止开QQ

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
hkdpr: hwnd;
begin
hkdpr:=findwindow(nil,'QQ用户登录');
if hkdpr<>0 then
postmessage(hkdpr,wm_close,0,0);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
hkdpr: hwnd;
i: integer;
begin
repeat
i:=1;
hkdpr:=findwindow(nil,'QQ用户登录');
if hkdpr<>0 then
postmessage(hkdpr,wm_close,0,0);
i:=i+1;
until i=2
end;

end.
 

Similar threads

后退
顶部