在PB中如何用GetDiskfreespaceEx()和MovefileEx()两个API
编号:QA000316
建立日期: 1999年1月9日 最后修改日期:1999年1月9日
所属类别:
学生:
工具: pb65
操作系统: pwin98
在PB中如何用GetDiskfreespaceEx()和MovefileEx()两个API?最好能举例说明。
回答:
首先PB中API函数的调用是在与代码有关Declare菜单的Global External Fuctions...菜单项中定义。定义时参考API手册,注意数据类型的一致, 指针变量定义前要加"ref"。其次在代码中进行调用,注意参数数据类型的一致。注意: 部分函数是区分大小写的, 凡是参数类型中有字符型函数名称加字母"A"。
具体做法如下:
1.GetDiskfreespaceEx()
此函数PB6.0不支持,只能用GetDiskfreespace()
Global External Fuctions...代码段:
Function Boolean GetDiskFreeSpaceA(ref string dirname, ref long getval1,ref long getval2,ref long getval3,ref long getval4) Libary "kernal32"
Scripts 代码段:
...
string dirname
long getval1 , getval2 , getval3 ,getval4
boolean retval
dirname = "c:\"
retval = GetDiskFreeSpaceA(dirname , getval1 , getval2 , getval3 , getval4)
...
2.MoveFileEx()
Global External Fuctions...代码段:
Function Boolean MoveFileExA(ref string oldfilename, ref string newfilename,ref long val1) Libary "kernal32"
Scripts 代码段:
...
string oldfilename,newfilename
long val1
boolean retval
val1 = 1 (此值由手册定)
oldfilename = "c:\temp.txt" (文件必须存在)
newfilename = "c:\temp.ttt"
retval = MoveFileExA(oldfilename,newfilename,val1)
此问题由gxg回答。
| |
|
|
| |
|
|