InstallShield自定义对话框失效控制

 
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;    
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值