InstallShield自定義對話方塊淺談(四) (轉)

themoney發表於2007-10-04
InstallShield自定義對話方塊淺談(四) (轉)[@more@] 

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

/*  */

/*  Function:  CheckServerDSNInputValid  */

/*  */

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

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

/*  Misc:  */

/*  */

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

  function CheckSQLServerDSNInputValid(hwndDlg, bAllowNotSet)

  STRING szUserName;

  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;

 :namespace prefix = o ns = "urn:schemas--com::office" />

  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);

  _WinSubFocuntrol(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_

 

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10794571/viewspace-974718/,如需轉載,請註明出處,否則將追究法律責任。

相關文章