PDA

View Full Version : How to disable Modify Button in SdWelcomeMaint dialog?



email2venki
07-12-2006, 01:26 AM
Hi All,

The following code below should be able to disable Modify button. There is no need to edit the resource as mentioned in the article
http://support.installshield.com/kb/view.asp?pcode=ALL&articleid=Q106761

Editing resource may cause problem when you have skins. Simply replace the function call SdWelcomeMaint with SdWelcomeMaintCustom.

Note: You can even hide the Modify button with ShowWindow API. This function is not fully tested.




#define RES_DIALOG_ID 12053 // ID of dialog box itself
#define RES_PBUT_NEXT 1 // ID of Next button
#define RES_PBUT_CANCEL 9 // ID of Cancel button
#define RES_PBUT_BACK 12 // ID of Back button
#define RES_RBUT_MODIFY 301 // ID of Modify button
#define RES_RBUT_REPAIR 302 // ID of Repair button
#define RES_RBUT_REMOVE 303 // ID of Remove button
#define RES_MSG_INFO 710 // ID of Message displayed

//---------------------------------------------------------------------------
// SdWelcomeMaintCustom
//
//---------------------------------------------------------------------------
function SdWelcomeMaintCustom(bDisableRepair)
HWND hwndDlg;
STRING szTitle, szMsg,szDialogName;
STRING svValue ;
NUMBER nResult,nCmdValue,nCmdReturned;
BOOL bDone;
LIST listDrive;
STRING svSelection;
STRING sText,sProduct;
STRING svSelLang, svUserDll;
begin


// Specify a name to identify the custom dialog in this setup.
szDialogName = "uninstallDialog";

// Define the dialog. Pass a null string in the second parameter
// to get the dialog from _isuser.dll or _isres.dll. Pass a null
// string in the third parameter because the dialog is identified
// by its ID in the fourth parameter.

svUserDll = "";

nResult = EzDefineDialog (szDialogName, svUserDll, "", RES_DIALOG_ID);
bDone = FALSE;

// Loop until done.
repeat

// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's close button.
Do (EXIT);
case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
// Get the dialog's window handle.
hwndDlg = CmdGetHwndDlg (szDialogName);

// Set the window title. SetWindowText is prototyped
// in Winsub.h and defined in Winsub.rul.
CtrlGetText(szDialogName,710,sText);
sProduct=UNINSTALL_DISPLAYNAME;
Sprintf(sText,sText,sProduct);
CtrlSetText(szDialogName,710,sText);
//CtrlSetText (szDialogName, 301,sMachineDecision);

//Disable the modify button
_WinSubEnableControl(hwndDlg, RES_RBUT_MODIFY, 0);
CtrlSetState ( szDialogName , RES_RBUT_REPAIR, BUTTON_CHECKED );

case 9:
// The user clicked the Cancel button.
Do (EXIT);
case 1:
// Get the current selection so it can be displayed.
//CtrlGetText (szDialogName, 301,sMachineDecision);
if (CtrlGetState ( szDialogName ,302 )=BUTTON_CHECKED) then
nCmdReturned=REPAIR;
else
nCmdReturned=REMOVEALL;
endif;
bDone = TRUE;
endswitch;
until bDone;

// Close the dialog box.
EndDialog (szDialogName);

// Free the dialog box from memory;
ReleaseDialog (szDialogName);

return nCmdReturned;

end;