有時,我們在編寫PB應用程序時,想獲得當前應用程序的路徑,我們可以借助API函數來實現,下面是具體的實現源代碼。
//如何獲得當前應用程序的路徑
FUNCTION unit getmodulefilenamea(ulong hmodule,ref string lpfilename,ulong nsize)library "kernel32.dll"
string ls_buffer=space(255)
int i
if getmodulefilenamea(handle(getapplication()),ls_buffer,255)=0 then
setnull(ls_buffer)
else
do while pos(ls_buffer,"/",i+1)>0
i=pos(ls_buffer,"/",i+1)
loop
ls_buffer=left(ls_buffer,i)
if right(ls_buffer,1)<>"/" then ls_buffer=ls_buffer+"/"
end if
return ls_buffer
新聞熱點
疑難解答