- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Example of FeatureGetCostEx and ConvertSizeToUnits
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
I was asked to write an installer that will allow the user to install data in a different location than the software. So I'm trying to check the user's chosen path to make sure there is enough space there.
For some reason the following code produces an error on the "ConvertSizeToUnits" line, stating "numeric variable required," error code C8046.
Does anyone have a working example of this? Can you see anything wrong? I've tried this with and without assigning variables to hold the result of the FeatureGetCostEx and ConvertSizeToUnits functions. I hope this has a simple answer.
Dlg_SdAskDestPath_data: szTitle = "Choose Data Folder"; szMsg = "Choose where to install data for %P."; //Initialize directories to DATA_DIR global variable, which is basically C:\\Users\\Public\\myapp_data svDataDir = DATA_DIR; nDataDirResult = SdAskDestPath(szTitle, szMsg, svDataDir, 0); if (nDataDirResult = BACK) then goto Dlg_SetupType2; else // Check disk space at the data destination path nDataSpace = GetDiskSpaceEx (svDataDir, MBYTES); //nDataSpaceReq = FeatureGetCostEx (MEDIA, "Data Files", svDataDir, nvCostHigh, nvCostLow); FeatureGetCostEx (MEDIA, "Data Files", svDataDir, nvCostHigh, nvCostLow); nConv = ConvertSizeToUnits (nvCostHigh, nvCostLow, BYTES, nvCostMBHigh, nvCostMBLow, MBYTES); // ---> Error flags this line nDataSpaceReqMB = nvCostMBHigh + nvCostMBLow; if (nDataSpaceReqMB > nDataSpace) then MessageBox(svDataDir + " does not have enough space to install Data Files. Please choose a different location with at least " + nDataSpaceReq + " MB free." , SEVERE); goto Dlg_SdAskDestPath_data; endif; // If it gets this far, it passes the tests, so DATA_DIR = svDataDir; endif;
Hi @SpiderLily1 ,
Check the below link for the sample code, and pass the last parameter in a variable:
nUnitsTarget = MBYTES;
And in the message box, use the conversion function to convert the NUMBER to string before doing the concatenation.
Hi @SpiderLily1 ,
Check the below link for the sample code, and pass the last parameter in a variable:
nUnitsTarget = MBYTES;
And in the message box, use the conversion function to convert the NUMBER to string before doing the concatenation.
Thank you so much! That helped. Now on to other errors...