Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File Size.
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00827331
Message ID:
01039179
Views:
18
Hi Anatoliy,

It seems that your code can return incorrect file size in some cases. Take a look at Re: Can't make getFileSize work on really big files (20GB) Message #1039133

>I bet your answer is correct, and it's much shorter than can be done with API functions
>
>LPARAMETERS lcFilename
>#DEFINE OF_READ             0
>#DEFINE OF_SHARE_DENY_NONE  64
>#DEFINE HFILE_ERROR        -1
>#DEFINE dwordPlus           0xffffffff + 1
>
>DECLARE INTEGER GetFileSize IN kernel32;
>	INTEGER hFile, INTEGER @lpFileSizeHigh
>
>DECLARE INTEGER OpenFile IN kernel32;
>	STRING lpFileName, STRING @lpReOpenBuff, INTEGER wStyle
>
>DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject
>
>LOCAL lpReOpenBuff, hFile, lnSizeLo, lnSizeHi
>lpReOpenBuff = REPLI (Chr(0), 250)
>hFile = OpenFile(lcFilename, @lpReOpenBuff, OF_SHARE_DENY_NONE)
>
>IF hFile <> HFILE_ERROR
>	lnSizeHi = 0
>	lnSizeLo = GetFileSize(hFile, @lnSizeHi)
>	= CloseHandle(hFile)
>	RETURN lnSizeHi * dwordPlus + lnSizeLo
>ELSE
>	RETURN 0
>ENDIF
>
>
>http://www.news2news.com/vfp/?example=114&function=165
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform