function SdAskSqlInfo(hMSI,szServer, szUid, szPwd, bIsWindows)
STRING szDialogName, szDLLName, szDialog;
NUMBER nDialog, nResult, nCmdValue;
BOOL bDone;
HWND hInstance, hwndParent;
STRING szResult;
begin
// Define the name of a dialog box to pass as first
// parameter to DefineDialog.
szDialogName = RES_DIALOG_NAME;
// DefineDialog's second parameter will be 0 because the
// dll is in _isres.dll.
hInstance = 0;
// DefineDialog's third parameter will be null; setup will
// search for the dialog in _isuser.dll and _isres.dll.
szDLLName = "";
// DefineDialog's fifth parameter will be null because the
// dialog is identified by its ID in the fourth parameter.
szDialog = "";
// This value is reserved and must be 0.
hwndParent = 0;
//UseDLL (szDLLName);
// Define the dialog. The setup's main window will own the
// dialog (indicated by HWND_INSTALL in parameter 7).
nResult = DefineDialog (szDialogName, hInstance, szDLLName, SQLSERVER_DLG, szDialog, hwndParent, HWND_INSTALL, DLG_MSG_STANDARD|DLG_CENTERED);
//nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
// Check for an error.
if (nResult < 0) then
MessageBox ("An error occurred while defining the dialog.", SEVERE);
bDone = TRUE;
abort;
endif;
// Initialize the indicator used to control the while loop.
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: ;
// No initialization is required for this example.
//设置对话框控件的默认值
if(szServer=="")then
szServer = "(local)";
endif;
CtrlSetText(szDialogName, IDC_EDIT_DB_ADD, szServer);
CtrlSetText(szDialogName, IDC_EDIT_DB_UID, szUid);
CtrlSetText(szDialogName, IDC_EDIT_DB_PWD, szPwd);
if(bIsWindows) then
CtrlSetState(szDialogName, IDC_SQL_OPT1, BUTTON_CHECKED);
else
CtrlSetState(szDialogName, IDC_SQL_OPT2, BUTTON_CHECKED);
endif;
case IDC_SQL_OPT1:
//Disable(IDC_EDIT_DB_ADD);
Disable(IDC_EDIT_DB_UID);
Disable(IDC_EDIT_DB_PWD);
这里的
Disable()
不能实现功能,
_WinSubEnableControl (hwndDlg, ID_RBUTTON_DBEXIST, TRUE);
可以实现功能!
case IDC_SQL_OPT2:
//Enable(IDC_EDIT_DB_ADD);
Enable(IDC_EDIT_DB_UID);
Enable(IDC_EDIT_DB_PWD);
case RES_CTRL_ID1: //下一步
CtrlGetText(szDialogName, IDC_EDIT_DB_ADD, szServer);
CtrlGetText(szDialogName, IDC_EDIT_DB_UID, szUid);
CtrlGetText(szDialogName, IDC_EDIT_DB_PWD, szPwd);
if(CtrlGetState(szDialogName, IDC_SQL_OPT1)==BUTTON_CHECKED) then
bIsWindows = TRUE;
szPwd = "";
else
bIsWindows = FALSE;
endif;
szResult = CheckUserInput(szServer, szUid, szPwd, bIsWindows);
if(szResult!="") then
MessageBox(szResult, INFORMATION);
else
bDone = TRUE;
nResult = NEXT;
endif;
case RES_CTRL_ID2: //上一步
bDone = TRUE;
nResult = BACK;
case RES_CTRL_ID3: //取消
bDone = TRUE;
nResult = CANCEL;
endswitch;
until bDone;
// Close the dialog box.
EndDialog (szDialogName);
// Free the dialog box from memory.
ReleaseDialog (szDialogName);
return nResult;
end;