·天新网首页·加入收藏·设为首页
首页|笔记本|手机|数码相机|摄像机|MP3/MP4|主板|内存|显示器|办公|打印机|下载|开发|汽车|学院|业界
硬件|台式机|数码|数字家庭|投影仪|GPS/CPU|显卡|硬盘|服务器|网络|一体机|驱动|源码|游戏|考试|报价
pb6中获取应用所在路径及更改当前路径
http://dev.21tx.com 2005年03月13日

Get the execution path of the current application//应用路径
[PB external function declaration]
FUNCTION int GetModuleFileNameA(&
ulong hinstModule, &
REF string lpszPath, &
ulong cchPath) LIBRARY "kernel32"

[Powerscript]
string ls_Path
unsignedlong lul_handle
ls_Path = space(1024)
lul_handle = Handle(GetApplication())
GetModuleFilenameA(lul_handle, ls_Path, 1024)
MessageBox("Current application path", ls_path)
//当前路径
First declare FUNCTION long GetCurrentDirectoryA( long length , ref string path) &
LIBRARY "Kernel32"

and then
long ll_ret
string ls_path
ls_path = Space(250)
ll_ret = GetCurrentDirectoryA(250, ls_path)
IF ll_ret > 0 THEN
ls_path = Left(ls_path,ll_ret)
MessageBoxBox("", ls_path)
ELSE
Messagebox("Error","Err GetCurrentDirectory " + String(ll_ret))
END IF
///改变当前路径
[FUNCTION DECLARATIONS]
FUNCTION boolean SetCurrentDirectoryA(ref string lpsdir) &
LIBRARY "kernel32.dll"

[powerscript]
String ls_Directory
ls_Directory = "C:\MyNewDirectory\" lb_Return = SetCurrentDirectoryA(ls_Directory)

--注:用PB8就方便多了,都不用API,自己有函数

上一篇: 怎样将PB应用的全部源代码打印出来
下一篇: 在PowerBuilder中调用ChooseColor函数

Google
 
热点文章
关于我们 | 联系我们 | 广告服务 | 工作机会 | 版权声明 | 欢迎投稿 | 网站地图
Copyright © 2000-2008 , www.21tx.com , All Rights Reserved .
晨新科技 版权所有 Created by TXSite.net