kroiz
kroiz

Reputation: 1772

Disabling "Next" button In InstallScript

Using InstallShield - InstallScript project:

I made a custom dialog for browsing for a file.

On the dialog initialization I want to disable the "Next" button.

I am successful in disabling other buttons on this dialog except for any of the buttons of the install wizard: Cancel, Next and Back.

I used the functions _WinSubEnableControl or EnableWindow.

Upvotes: 0

Views: 3203

Answers (2)

kroiz
kroiz

Reputation: 1772

The code for disabling the button should be after the call to SdGeneralInit. If you put it before (like I did) the change won't stick.

The call to SdGeneralInit explicitly enables the "Next" button, that is why it did not work for the "Next" button but did work for the other custom buttons on the dialog.

It should look something like that:

case DLG_INIT:    

    SdGeneralInit( szDlg, hwndDlg, 0, szSdProduct );

    hDlgHandle = CmdGetHwndDlg(szDlg);          
    hNextButton = GetDlgItem(hDlgHandle, 1); // 1 is the id for the next button.            
    EnableWindow(hNextButton, FALSE);

Upvotes: 3

Ivan
Ivan

Reputation: 3184

It works for me:

   function
     HWND    hwndDlg, hwndNext;
     ...
   begin
     ...
     hwndDlg = CmdGetHwndDlg( strDialogName );
     hwndCtrl = GetDlgItem(hwndDlg, NEXT);
     EnableWindow(hwndCtrl, FALSE);
     ...
   end;

If you didn't find this useful, please publish your code.

Upvotes: 4

Related Questions