使用GetDiskSpaceEx()时出错!

xiaobo 2001-03-25 02:47:00
[C++ Error] System.cpp(213): E2015 Ambiguity between '__stdcall GetDiskFreeSpaceEx(const char *,_ULARGE_INTEGER *,_ULARGE_INTEGER *,_ULARGE_INTEGER *)' and 'Sysutils::GetDiskFreeSpaceEx'

怎样才能解决?
...全文
105 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
skt985 2001-06-01
  • 打赏
  • 举报
回复
30399关注!
xiaobo 2001-03-25
  • 打赏
  • 举报
回复
回songhtao:
我也是这样做的,可惜只能正确表示c盘的容量,而计算出来的d,e容量不对,不知是和原因!
我不懂电脑 2001-03-25
  • 打赏
  • 举报
回复
要得到驱动器的容量和剩余容量,用下面的程序
var
driver:pchar;
sec1, byt1, cl1, cl2:longword;
begin
driver:='c:\';//要显示的驱动器名
GetDiskFreeSpace(driver, sec1, byt1, cl1, cl2);
cl1 := cl1 * sec1 * byt1;
cl2 := cl2 * sec1 * byt1;
Label1.Caption := '该驱动器总共容量' + Formatfloat('###,##0',cl2) + '字节';
Label2.Caption := '该驱动器可用容量' + Formatfloat('###,##0',cl1) + '字节';
end;

狐帝 2001-03-25
  • 打赏
  • 举报
回复
调用的时候用 ::GetDiskFreeSpaceEx这样的形式就可以直接调用Windows的GetDiskFreeSpaceEx函数,或者用Sysutils::GetDiskFreeSpaceEx调用经过BCB封装的函数。
xycleo 2001-03-25
  • 打赏
  • 举报
回复
在大容量硬盘中不能使用GetDiskFreeSpace,绝对不正确
而要用它的扩展函数GetDiskFreeSpaceEx
其实windows中也有这样的一个BUG,不信你看看回收站中各磁盘的容量
他就是用了GetDiskFreeSpace这个来计算的!!!
运行效果 http://hi.csdn.net/attachment/201012/9/0_1291865794j998.gif ************************************************************************* PowerBuilder Foundation Class Library Version 9.0 R E L E A S E N O T E S Copyright ?1996-2003 Sybase, Inc. and its subsidiaries. All rights reserved. ************************************************************************* Last Updated: January 17, 2003 ************************************************************************* Please take a few minutes to review this file for fixes that were made in PowerBuilder 8.0.2 and 9.0. ************************************************************************* BUG FIXES IN PFC 9.0 ************************************************************************* CR300376 Object: pfc_n_cst_fileSrv, pfc_n_cst_fileSrvwin32 Method: OfGetDiskSpace Fix: Method returned a negative number when the calculated amount of free disk space exceeded 2 gigabytes. Added new method of_GetDiskSpaceEx that takes decimals as arguments instead of longs. of_GetDiskSpace will be obsolete in a future release. ************************************************************************* BUG FIXES IN PFC 8.0.2 ************************************************************************* PFC.PBR CR256529 Fix: The PFC.PBR file can be used to copy bitmaps and dynamically referenced DataWindow objects into the executable file for deployment. The following bitmap files that were removed from PFC have now been removed from the PFC.PBR file: details.bmp, helptop.bmp, largeico.bmp, listv.bmp, and smallico.bmp. ======================================================== PFC DataStore CR261992 Object: pfc_u_ds Method: pfc_print/pfc_printdlg Fix: Changed the return code test to check for 1 on success, otherwise there is an error or the user cancelled. Fix: Set the

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧