unit DEjectDllMain; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, ThdMsgAutoClose; type TDlgEjectDllMain = class(TForm) Label1: TLabel; edPid: TEdit; btnEject: TButton; mmDlls: TMemo; btnAutoClose: TButton; procedure btnEjectClick(Sender: TObject); procedure btnAutoCloseClick(Sender: TObject); private { Private declarations } ThdMsgAutoClose_: TThdMsgAutoClose; public { Public declarations } Constructor Create(aOwner: TComponent); override; Destructor Destroy; override; end; var DlgEjectDllMain: TDlgEjectDllMain; implementation uses Tocsg.Strings, Tocsg.Safe, Tocsg.Process, Tocsg.WndUtil; {$R *.dfm} Constructor TDlgEjectDllMain.Create(aOwner: TComponent); begin Inherited Create(aOwner); ThdMsgAutoClose_ := nil; end; Destructor TDlgEjectDllMain.Destroy; begin if ThdMsgAutoClose_ <> nil then FreeAndNil(ThdMsgAutoClose_); Inherited; end; procedure TDlgEjectDllMain.btnAutoCloseClick(Sender: TObject); begin if ThdMsgAutoClose_= nil then begin ThdMsgAutoClose_ := TThdMsgAutoClose.Create; ThdMsgAutoClose_.StartThread; btnAutoClose.Caption := '´Ý±â OFF'; MessageBox(Handle, PChar('ÀÚµ¿ ´Ý±â ½ÃÀÛ'), PChar(Caption), MB_ICONINFORMATION or MB_OK); end else begin FreeAndNil(ThdMsgAutoClose_); btnAutoClose.Caption := '´Ý±â ON'; MessageBox(Handle, PChar('ÀÚµ¿ ´Ý±â ÁßÁö'), PChar(Caption), MB_ICONINFORMATION or MB_OK); end; Application.ProcessMessages; end; procedure TDlgEjectDllMain.btnEjectClick(Sender: TObject); var dwPid: DWORD; sEjectDlls: String; StrList: TStringList; i, n: Integer; begin dwPid := StrToInt64Def(Trim(edPid.Text), 0); if dwPid = 0 then begin MessageBox(Handle, PChar('PID¸¦ ÀÔ·ÂÇØ ÁֽʽÿÀ.'), PChar(Caption), MB_ICONWARNING or MB_OK); exit; end; sEjectDlls := Trim(mmDlls.Text); if sEjectDlls = '' then begin MessageBox(Handle, PChar('DLLÀ» ÀÔ·ÂÇØ ÁֽʽÿÀ.'), PChar(Caption), MB_ICONWARNING or MB_OK); exit; end; sEjectDlls := StringReplace(sEjectDlls, #13#10, '|', [rfReplaceAll]); Guard(StrList, TStringList.Create); SplitString(sEjectDlls, '|', StrList); n := 0; for i := 0 to StrList.Count - 1 do begin Inc(n, EjectModuleFromName(StrList[i], dwPid)); end; MessageBox(Handle, PChar(Format('¼º°ø : %d', [n])), PChar(Caption), MB_ICONINFORMATION or MB_OK); end; end.