首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

怎的获得自己的PID呢

2013-01-07 
怎样获得自己的PID呢?其实,我是想实现判断一个应用程序是否正在运行(前提是不能通过标题判断)网上可以查到

怎样获得自己的PID呢?
其实,我是想实现判断一个应用程序是否正在运行(前提是不能通过标题判断)
网上可以查到可以通过判断PID的方法,但是我却不能取得自己的PID
请大家帮忙!!!
[解决办法]
function uint getmodulehandle(string szmoudlename)library "krnl386.exe" 
function uint getmoduleusage(uinthend) library "krnl386.exe" 
如检查已经运行的word是否存在的代码如下; 
uin t uimodule 
integer nusage 
uimodule=getmodulehandle("winword.exe") 
nusage=getmoduleusage(uimodule) 
if nusage=0 then 
run(winword.exe") 
end if 
利用handle()函数的可选参数可以查看同一个可执行文件的另一个pb应用程序的存在,如下: 
if handle(this,true)>0 then 
//already running 
halt close 
end if 

[解决办法]
Function Long GetCurrentProcessId() Library "kernel32.dll"
取自己的PID
ulong ll_pid = GetCurrentProcessId() 

热点排行
Bad Request.