pb9.0怎么判断某个exe是否打开 没打开则打开 这程序怎么写

pb9.0怎么判断某个exe是否打开 没打开则打开 这程序怎么写,第1张

这个需纤蚂要钩子,系统层毁扒埋的,PB好像不擅长这个,C语言可以

一定要做这种,可以利此樱用ini配置文件或者注册表之类的,exe启动设置值,关闭设置另一个值

另一个监控软件在用time事件每隔几秒查询这个数值,发现关闭就run函数调用

isValid(窗口对象伏销名)

如缺哪游:

if isValid(w_main) then

w_main.dw_1.object.c_id[i] = 1

..../缓芦

end if

使用windows自带的团猛基库函数'kernel32.dll' ,来判断程序是否已经运行,示例如下:

//外部函数声明

Function ulong   GetLastError () library 'kernel32.dll' 

Function ulong   CreateMutexA (ulong lpMutexAttributes, int bInitialOwner, ref string lpName) library 'kernel32.dll' 

//app 知数的open事件代码

string  ls_mutex_name

ulong  ll_mutex

ulong   ll_err 

if handle (GetApplication(),false) <> 0 then 

ls_mutex_name = AppName

ll_mutex      = CreateMutexA (0,0,ls_mutex_name) 

ll_err        = GetLastError() 

if ll_err = 183 then 

messagebox("","该程序正在运行塌谨")

Halt close

end if

end if


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12379367.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存