В настоящее время я делаю пользовательский диалог для обработки ситуации с заблокированными файлами в проекте InstallScript.Я знаю, что есть встроенные функции, такие как SdException () для обработки этого случая, но это требование, чтобы избежать случая, когда пользователь случайно решил проигнорировать ситуацию.
В итоге я инициализирую EzDefineDialog () изатем вызовите WaitOnDialog (), чтобы отобразить диалоговое окно, но оно всегда возвращает -1.
Ниже приведен мой код:
prototype NUMBER LockedFile(string /*FilePath*/);
//[[ ID_DATA
#define IDD_VER 300
#define ID_NAME_LOCKED_FILE "LockedFile"
#define ID_TITLE_LOCKED_FILE "Default Dialog Title\nDefault Title message"
#define ID_TEMPLATE_LOCKED_FILE 12345
//]]
//[[ ID_SYMBOLS
#define BT_PostPone 1303
#define BT_Retry 1304
#define BT_Abort 1305
#define IDC_TEXT1_LOCKED_FILE 1301
//]]
function NUMBER LockedFile(szFile /*FilePath*/)
NUMBER nId; // contains the return code of WaitOnDialog
NUMBER nResult; // contains the return code of LockedFile
BOOL bDone; // tells if the dialog is to be closed
INT hwndDlg; // the handle of the dialog itself
STRING szTitle; // dialog's title
STRING szDlg; // the name of the dialog
STRING szMessage; // message to display on dialog
NUMBER nTemplate; // variable to store the template to be used for this dialog
begin
// Specify a name to identify the custom dialog in this installation.
szDlg = ID_NAME_LOCKED_FILE;
nTemplate = ID_TEMPLATE_LOCKED_FILE;
if (EzDefineDialog (szDlg, ISUSER, "", nTemplate) = DLG_ERR) then
MessageBox("Fail to initialize the Locked Dialog for "+szFile, SEVERE);
abort;
endif;
bDone = FALSE;
while (!bDone)
nId = WaitOnDialog(szDlg);
switch (nId)
case DLG_INIT:
// first internal InstallShield intitialise
hwndDlg = CmdGetHwndDlg( szDlg );
SdGeneralInit(szDlg, hwndDlg, 0, "");
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 BT_PostPone:
// user clicked PostPone button, the operation will be carried out after reboot
bDone = TRUE;
nResult = 1;
case BT_Retry:
// user clicked retry button, retry the operation immediately
bDone = TRUE;
nResult = 2;
case BT_Abort:
// user clicked abort button, abort the installation
bDone = TRUE;
nResult = 3;
default:
// user do something else
bDone = TRUE;
nResult = -1;
endswitch;
endwhile;
EndDialog(szDlg); // Close the dialog box.
ReleaseDialog(szDlg); // Free the dialog box from memory.
return nResult;
end;
Я дважды проверил и использую этот ISResourceID в обоих диалогахи Direct Editor - 12345, который был передан в EzDefineDialog (szDlg, ISUSER, "", nTemplate)
как nTemplate.Имя диалога (szDlg) также дважды проверяется.
Я хочу знать, где я поступил неправильно.Как я могу отобразить свой пользовательский диалог?