Delphi获取进程PID


本文整理自网络,侵删。

 Delphi获取进程PID

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
hwin:dword;
pid:dword;
begin
hwin:=FindWindow(nil,'新建 文本文档.txt - 记事本');
getwindowthreadprocessid(hwin,pid);
if pid=0 then
label1.caption:='wrong'
else
label1.Caption :=inttostr(pid);
end;
end.

相关阅读 >>

Delphi dbgrid去除滚动条

Delphi 计算加班时间工时的函数

Delphi跨平台的字符串代码标准

Delphi 文件分割合并

Delphi常用获取系统信息的函数单元

Delphi webbrowser中模拟连接点击(非鼠标模拟)

Delphi 代替pos的函数

Delphi 进程通讯之wm_copydata 发送程序(senddata.exe)

Delphi中treeview节点的遍历

Delphi 如何将access数据库后缀名accdb改为mdb

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    正在狠努力加载,请稍候...