Friday, June 18, 2010

Check Free space on disk

function CheckFreeSpace(hMSI)
_DISK_INFO di;
NUMBER n; // to do: something with function return values
NUMBER nvSizeTargetHigh, nvSizeTargetLow, nUnitsTarget;
begin
// init. _DISK_INFO members: what drive, what info
di.szDiskPath = INSTALLDIR;
di.nInfoToQuery = DISK_INFO_QUERY_DISK_FREE_SPACE;

n = GetDiskInfo(&di);
// change to desired unit for free space
nUnitsTarget = MBYTES;

n = ConvertSizeToUnits(di.nFreeSpaceHigh, di.nFreeSpaceLow, BYTES,nvSizeTargetHigh, nvSizeTargetLow, nUnitsTarget);

//SprintfBox(INFORMATION, "Free Space", "Free space: %d MB", nvSizeTargetLow);
if(nvSizeTargetLow<500) then
MsiSetProperty(hMSI,"VALIDFREESPACE","0");
MessageBoxEx("Atleast 500 MB space is required on the destination drive to install Beyond TXT G4 Client. Please free the required space and try again..","",INFORMATION);
else
MsiSetProperty(hMSI,"VALIDFREESPACE","1");
endif;
end;

No comments:

Post a Comment