Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Large integers (64 bit) in GetDiskFreeSpaceEx API call 2002-04-01 -- Paul van Drunick In WinApi.CLW:
LARGEINTEGER GROUP,TYPE
dwLowPart long
dwHighPart long
END
! You have to create a kernel32.lib with this api in it (with libmaker and kernel32.dll)
! and add it to your project. This api is not in the clarion libs and
! only compatible with Win 95-OSR2/98/NT 4.0/2000/XP
MODULE('KERNEL32.DLL')
GetDiskFreeSpaceEx(*LPCSTR,*LARGEINTEGER,*LARGEINTEGER,*LARGEINTEGER),BOOL,PASCAL,RAW,NAME('GetDiskFreeSpaceExA')
END
Code for your function or method:
SomeFunction PROCEDURE
lintFreeBytesCaller group(LARGEINTEGER)
end
lintTotalBytes group(LARGEINTEGER)
end
lintFreeBytes group(LARGEINTEGER)
end
decFreeBytesLow DECIMAL(31) ! max decimal is not enough for
! max result of
! 3,3161584934796709483252973253515e+327
decFreeBytesHigh DECIMAL(31) ! but is enough for this purpose
! maybe someone knows an alternative?
decFreeBytes DECIMAL(31)
cstrPath CSTRING(MAX_PATH)
CODE
cstrPath = clip(SomePath)
if GetDiskFreeSpaceEx(cstrPath, lintFreeBytesCaller, lintTotalBytes,lintFreeBytes) then .
! you can also use lintFreeBytesCaller (users free space in this path)
if lintFreeBytes.dwLowPart < 0
decFreeBytesLow = 2 ^ 32 + lintFreeBytes.dwLowPart
else
decFreeBytesLow = lintFreeBytes.dwLowPart
end
if lintFreeBytes.dwHighPart < 0
decFreeBytesHigh = 2 ^ 32 + lintFreeBytes.dwHighPart
else
decFreeBytesHigh = lintFreeBytes.dwHighPart
end
decFreeBytes = decFreeBytesLow + decFreeBytesHigh * 2 ^ 32
Today is November 21, 2024, 8:40 am This article has been viewed 35248 times.
|
|