📄 unitfunciones.pas
字号:
unit UnitFunciones;
interface
uses Windows, SysUtils;
function ObtenerMejorUnidad(bytes: Int64):String;
function MyGetFileSize(const strFileName: String): LongInt;
implementation
function ObtenerMejorUnidad(bytes: Int64):String;
begin
if bytes < 1024 then
Result := IntToStr(bytes) + ' B'
else if bytes < 1048576 then
Result := FloatToStrF(bytes / 1024, ffFixed , 10, 1)+' Kb'
else if bytes < 1073741824 then
Result := FloatToStrF(bytes / 1048576, ffFixed , 10, 1)+' Mb'
else if bytes > 1073741824 then
Result := FloatToStrF(bytes / 1073741824, ffFixed , 10, 1)+' Gb';
end;
function MyGetFileSize(const strFileName: String): LongInt;
var WFD: TWin32FindData; hFile: THandle;
begin
hFile := FindFirstFileA(PChar(strFileName), WFD);
Result := WFD.nFileSizeLow;
windows.FindClose(hFile);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -