View Full Version : Showing disk space information on a dialog

04-15-2002, 11:06 AM
Hi all,

I just upgraded ISWI 2.01 to Developer 7.02. I have a question regarding how to show the disk space information on the destination folder dialog.

I saw that the SdFeatureDialog has a section at the bottom of the dialog that can show how much space is available on a particular drive (e.g. C:). If I want to do the same thing on the SdAskDestPath dialog, is there a way to do so? Any help will be very appreciated.

Thanks in advance,

Happy Days
04-15-2002, 11:35 AM

Well I am not sure......see if it works and pls. let me know then :)
Here are the steps :

1. In the SdFeatureDialog, see the name of the Property to whch the space required text is associated to.
1. In the MyFunction function, call the function GetSystemInfo in the following way:
Here, svResult has the result.
2. Now, you have to set the property(of step1). To do this, use the function SetMSIProperty.
3. Now, create a custom action that calls this function,MyFunction.
4. Insert this Custom Action in the start of the Execute Sequence.

That's all....build the setup and see........


04-15-2002, 12:44 PM
I believe there is an easier way if this is a standard project:

Call the system info function:

Then, during the init portion of your dialog's function, call CtrlSetText to set the text control(one that you have already added to the dialog).

04-16-2002, 10:37 AM

I created a text field in the SdAskDestPath dialog, and tried to call CtrlSetText to update the text field; but it doesn't work. The dialog ID is 12005, and the Controller ID of the text field is 1302. I don't understand why it didn't work. Can anyone give me a hand on this? Any help will be appreciated.

Thanks a lot,

P.S. Here is a snapshot what I did in my InstallScript:

#define RES_DIALOG_ID 12005
#define RES_EDITNAME 302

nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
if (nResult < 0) then
// Report an error; then terminate.
MessageBox ("Error in defining dialog", SEVERE);

nResult = CtrlSetText (szDialogName, RES_EDITNAME, "Hi");
if (nResult = 0) then
MessageBox("CtrlSetText is successful",INFORMATION);
MessageBox("CtrlSetText failed", INFORMATION);
nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);

04-16-2002, 10:59 AM
Not sure by your code where in the dialog code you are setting the text. Here is an example of how it works for me. Usually, if you want the text to be set when the dialog is shown, you put it in the init case.


//loop through user choices
while (!bDone)

//return control referecned

nControl = WaitOnDialog(szDialogName)

case DLG_INIT:
CtrlSetText (szDialogName,ISUSER,szDialogName,0);

//Some code
//Some code

04-16-2002, 01:18 PM
Thanks JG1210! It works now!

May I ask you one more question? If I create a custom field in a standard dialog, do I have to use WaitOnDialog(szDialogName) in order to display the new, modified standard dialog? I originally thought that I only need to call that function if I am creating a new dialog from scratch.

Thanks again!

04-16-2002, 01:30 PM
I have never tried to use CtrlSetText on a standard dialog.

Usually the standard dialogs have a built in function (SdAskDestPath for example) where you pass in all the info as a parameter.

I believe in your case, if you want more control, you will have to use a custom dialog. That is what I did. I created my own destination Folder dialog, so that I could show diskspace info in it. To do so, you will also have to include your own Browse button, and then call the SelectDirEx function when it is clicked if you want to allow the user to select a different install directory.

For my project, I have found that I have to create custom dialogs for just about everything, except welcome and finish. It is just too difficult to do what my company wants to do with the limited control the standard dialogs give you.

Hope this helps,


04-16-2002, 03:45 PM
Hi JG,

Actually, I have modified the SdAskDestPath dialog and it works for me. The only thing is that I can no longer called the built-in SdAskDestPath() function in my InstallScript. Instead, like what you told me, I have to use WaitOnDialog() to display the modified standard dialog.

By the way, I don't really understand how you can identify the custom dialog you created. If I created a new dialog in the dialog menu, there is no way I can assign an ID to the new dialog - there is not a specific field in the property table that I can put a controller ID. Therefore, how can my InstallScript points to my new custom dialog? Would you mind to explain it a little bit more to me please?

Thanks again,

04-16-2002, 04:01 PM
I had a had time with this at first.

Then I realized that the dialog is defined in isuser.dll by the name of the dialog not the control id.

So my EZDialog function is written like so:


Always works for me. I know it is better to use variables instead of hard coded strings, but I don't expect to ever change the name of a dialog in my project.

Take care,