Delphi关闭进程
2012-12-16 21:05
316 查看
procedure TForm2.Button2Click(Sender: TObject); var h: HWND; dwPid: DWORD; hThreadProcess: THANDLE; s: string; begin h := FindWindow(PChar(Edit2.Text), PChar(Edit1.Text)); if h > 0 then begin OutputDebugString('找到句柄'); GetWindowThreadProcessId(h, @dwPid); if dwPid > 0 then begin {$IFNDEF _API} OutputDebugString('通过命令行关闭进程'); s := Format('ntsd -c q -p %d',[dwPid]); //taskkill同ntsd也可以关闭进程 Self.Caption := s; WinExec(PAnsiChar(s) ,SW_HIDE); {$ELSE} OutputDebugString('通过API关闭进程'); hThreadProcess := OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid); TerminateProcess(hThreadProcess, 0); CloseHandle(hThreadProcess); {$ENDIF} end; end; end;
相关文章推荐
- DELPHI根据进程名强制关闭进程
- delphi 对抗任务管理器关闭(提升进程到Debug模式,然后设置进程信息SE_PROC_INFO)
- DELPHI 关闭进程
- DELPHI关闭进程
- 很强的用DELPHI关闭进程代码
- delphi 中关闭进程
- DELPHI根据进程名强制关闭进程
- DELPHI根据进程名强制关闭进程
- 怎样用delphi关闭并重新启动 explorer.exe进程
- Delphi 中关闭指定进程的方法
- Delphi2010 关闭指定的程序进程。
- DELPHI实现关闭指定进程,自身防杀
- delphi 关闭进程方法
- 创建关闭进程
- C# 关闭 Excel进程
- Delphi定时关闭各种对话框
- 进程隐藏的Delphi代码(操作 PhysicalMemory
- C# 强制关闭当前程序进程(完全Kill掉不留痕迹)
- delphi 获取当前进程的cpu占用率
- Delphi中上指定进程(进程名)