Forum > Windows
GetFileSizeEx function missing
440bx:
Hello,
The definition of GetFileSizeEx is missing in Windows.pas.
Possible definitions:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const kernel32 = 'kernel32'; { missing definitions } function GetFileSizeEx ( InFileHandle : THANDLE; OutFileSize : PLARGE_INTEGER ) : BOOL; stdcall; external kernel32; { no need to specify the name } function GetFileSizeEx ( InFileHandle : THANDLE; OutFileSize : pint64 ) : BOOL; stdcall; external kernel32; overload; The first definition mirrors the MSDN definition exactly (except the parameter names which are of no relevance.) The second one would be a "nice to have" overload since FPC supports 64 bit integers without having to resort to the LARGE_INTEGER structure.
Two more overloads are possible using "var" to eliminate the need for pass a pointer to either function.
ETA:
forgot to mention, this applies to FPC v3.2.2. I don't know if the definition has already been added in an upcoming version.
paweld:
function is available in FPC 3.2.2 - attach JwaWinBase unit to uses section
Thaddy:
Or simply jwaWindows which solves more than that problem.
And yes, It can be replaced with var, but you have to convince Marcov and I did not succeed in doing that in the past odd 20 years or so.
Just that the API can not express var. The - OLD - Delphi developers were a bit more analytic about those calls and made them safe from the start.
440bx:
--- Quote from: paweld on November 06, 2024, 10:28:29 am ---function is available in FPC 3.2.2 - attach JwaWinBase unit to uses section
--- End quote ---
I know that but, that should not be necessary. GetFileSizeEx is documented and defined in kernel32 which is a "bread and butter" dll. For that reason it should not be necessary to include some other unit/file to access a very common API.
Thaddy:
Posts crossed, was editting...
(Marcov did provide a compat unit, btw, so I do not blame him for everything)
Navigation
[0] Message Index
[#] Next page