1 頁 (共 1 頁)

如何用 win32api 或其他程式方法 kill process

發表於 : 2008年 11月 27日, 18:19
tim
轉貼自:
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=19543
http://bbs.toseek.info/cgi-bin/topic.cg ... ic=3&show=

改為 delphi 版:

代碼: 選擇全部

     
    procedure Tform1.Button1Click(Sender: TObject); 
    var 
      h, t: HWND; 
      d: DWORD; 
    begin 
      h := FindWindow(nil, '記事本 - 未命名'); 
      if h<>0 then 
      begin 
        GetWindowThreadProcessId(h, @d); 
        t := OpenProcess(PROCESS_ALL_ACCESS,false,d); 
        TerminateProcess(t, 0); 
      end; 
    end;