CSDN博客

img flyelf

InstallShield自定义对话框浅谈(四)

发表于2004/2/7 22:59:00  1763人阅读

 

/*------------------------------------------------------------------------*/

/*                                                                        */

/*   Function:  CheckSQLServerDSNInputValid                               */

/*                                                                        */

/*   Descrip:   check the input data is valid.                                     */

/*       do not need to check the pwd if empty                            */

/*   Misc:                                                                */

/*                                                                        */

/*------------------------------------------------------------------------*/

  function CheckSQLServerDSNInputValid(hwndDlg, bAllowNotSet)

      STRING szDBUserName;

      STRING szSQLDB;

      STRING szSQLAddr;

      STRING szSQLDSN;

  begin

      

       if(bAllowNotSet) then

           _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 1);

           return 1;

       endif;

      

       if((CtrlGetState(DSN_SQLSERVER_DLG, IDC_RADIO_DSN_USER) = BUTTON_UNCHECKED) &&

          (CtrlGetState(DSN_SQLSERVER_DLG, IDC_RADIO_DSN_SYSTEM) = BUTTON_UNCHECKED)) then

              _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);

              return 0;

       endif;

 

       CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_SQLSERVER_USER_NAME, szDBUserName);

       if(StrLength(szDBUserName) = 0) then

           _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);

           return 0;

       endif;

       CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_SQLSERVER_DSN, szSQLDSN);

       if(StrLength(szSQLDSN) = 0) then

           _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);

           return 0;

       else

           if(!SQLValidDSN(szSQLDSN)) then

               MessageBox("输入了无效的数据源名称!", INFORMATION);

               _WinSubFocusControl(hwndDlg, IDC_EDIT_SQLSERVER_DSN);

               return 0;

           endif;

       endif;

       CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_SQLSERVER_DB, szSQLDB);

       if(StrLength(szSQLDB) = 0) then

           _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);

           return 0;

       endif;

       CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_DB_ADDR, szSQLAddr);

       if(StrLength(szSQLAddr) = 0) then

           _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);

           return 0;

       endif;

      

       _WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 1);

       return 1;

  end;

 

          

 

#endif // __KDCIS_RUL_

         

 

0 0

相关博文

我的热门文章

img
取 消
img