PDA

View Full Version : Silent Custom Dialog



ctyghe
09-18-2003, 02:57 PM
Hello,

I have one custom dialog in my set up. I am trying to make this setup silent. Given that I have a custom dialog, I cannot simply use the '-r' swtich. I am having difficulty with the SilentReadData and SilentWriteData :(

Any help would be appreciated. T
hank-you in advance.

Code:

function InstallAdvancedFeatures()

NUMBER nResult;
STRING strIo, strHot, strSettings;
STRING szDlgName;
NUMBER nCmdValue;
HWND hwndParent, hInstance;
BOOL bDone;
//Used for Silent functionality with Custom Dialogue
STRING svSection, szSection, szDlg, szUnused, szVal, svVal;
NUMBER nv10206, nVal;

begin

//String values for registry keys.
strIo = @SOFTWARE ^@COMPANY_NAME;
strHot = strIo ^@PRODUCT_NAME @PRODUCT_VERSION;
strSettings = strHot ^ "Settings";
hInstance = 0;
hwndParent = 0;
szDlgName = "10206";

if (MODE = SILENTMODE) then
SdMakeName (svSection, "10206", "", nv10206);
SilentReadData (svSection, "Result", DATA_NUMBER, svVal, nResult);
endif;

//Register the dialog with InstallShield
DefineDialog (szDlgName, hInstance, "", RES_DIALOG_ID, "", hwndParent, HWND_INSTALL, DLG_CENTERED | DLG_MSG_STANDARD);

bDone = FALSE;
while ( bDone = FALSE )

nCmdValue = WaitOnDialog(szDlgName);

switch (nCmdValue)

case DLG_INIT:
//Makes sure 'No' button defaulted
CtrlSetState (szDlgName, RES_NO_ID, BUTTON_CHECKED);

case RES_BUTTON_NEXT:
if (CtrlGetState (szDlgName, RES_YES_ID) = BUTTON_CHECKED) then
RegDBSetDefaultRoot( HKEY_CURRENT_USER );
//Set to a DWORD value of 1, to enable Pro options.
RegDBSetKeyValueEx ( strSettings , "Mixed" , REGDB_NUMBER , '1' , -1 );

bDone = TRUE;
else
bDone = TRUE;
endif;

endswitch;

endwhile;

EndDialog ( szDlgName );
ReleaseDialog ( szDlgName );


if (MODE = RECORDMODE) then
SdMakeName (svSection, "10206", "", nv10206);
SilentWriteData (szSection, "Result", DATA_NUMBER, szVal, nVal);
endif;



end;

jsparks
09-29-2003, 02:56 PM
After reading the silent mode date the function should return and not continue to process the dialog.


if (MODE = SILENTMODE) then
SdMakeName (svSection, "10206", "", nv10206);
SilentReadData (svSection, "Result", DATA_NUMBER, svVal, nResult);

return nResult;
endif;