home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDLIC.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  5.4 KB  |  141 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdlic.rul                                                 */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdLicense             */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdLicense                                                  */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will ask the user to agree with the terms of   */
  22.  /*             a license agreement.                                       */
  23.  /*   Misc:                                                                */
  24.  /*                                                                        */
  25.  /*------------------------------------------------------------------------*/
  26. function SdLicense( szTitle, szMsg, szQuestion, szLicenseFile )
  27.           STRING  szDlg, szTemp, szFinalFile;
  28.           INT     nId, list, nValue1, nValue2;
  29.           HWND    hwndDlg;
  30.           BOOL    bDone;
  31.         begin
  32.  
  33.           szDlg     = SD_DLG_LICENSE;
  34.           nSdDialog = SD_NDLG_LICENSE;
  35.  
  36.           // record data produced by this dialog
  37.           if (MODE=SILENTMODE) then
  38.             SdMakeName( szAppKey, szDlg, szTitle, nSdLicense );
  39.             SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  40.             return nId;
  41.           endif;
  42.  
  43.           // Determine license file location. Check path for UNC or disk id
  44.           szFinalFile = SUPPORTDIR ^ szLicenseFile;
  45.           GetByte( nValue1, szLicenseFile, 0 );
  46.           GetByte( nValue2, szLicenseFile, 1 );
  47.           switch (nValue2)
  48.           case 58: // colon
  49.                if ( ((nValue1 >= 'a') && (nValue1 <= 'z')) ||
  50.                     ((nValue1 >= 'A') && (nValue1 <= 'Z')) ) then
  51.                   szFinalFile = szLicenseFile; // path contains drive-path-file
  52.                endif;
  53.           case 92: // slash
  54.                if (nValue1 = 92) then
  55.                   szFinalFile = szLicenseFile; // path is UNC
  56.                endif;
  57.           endswitch;
  58.  
  59.  
  60.           // ensure general initialization is complete
  61.           if (!bSdInit) then
  62.              SdInit();
  63.           endif;
  64.  
  65.           if (EzDefineDialog( szDlg, "", "", SD_NDLG_LICENSE) = DLG_ERR) then
  66.              return -1;
  67.           endif;
  68.  
  69.           // Loop in dialog until the user selects a standard button
  70.           bDone = FALSE;
  71.  
  72.           while (!bDone)
  73.  
  74.              nId = WaitOnDialog( szDlg );
  75.  
  76.              switch (nId)
  77.              case DLG_INIT:
  78.                   if(szMsg != "") then
  79.                       SdSetStatic( szDlg, SD_STA_MSG1, szMsg );
  80.                   endif;
  81.  
  82.                   if(szQuestion != "") then
  83.                       SdSetStatic( szDlg, SD_STA_MSG2, szQuestion );
  84.                   endif;
  85.  
  86.                   hwndDlg = CmdGetHwndDlg( szDlg );
  87.                   SdGeneralInit( szDlg, hwndDlg, 0, szSdProduct );
  88.  
  89.                   if(szTitle != "") then
  90.                       SetWindowText( hwndDlg, szTitle );
  91.                   endif;
  92.  
  93.                   // set agreement multi-line edit field
  94.                   list = ListCreate( STRINGLIST );
  95.                   if (!ListReadFromFile( list, szFinalFile )) then
  96.                      CtrlSetMLEText( szDlg, SD_MULTEDIT_FIELD1, list );
  97.                   endif;
  98.                   ListDestroy( list );
  99.  
  100.              case SD_PBUT_CONTINUE:
  101.                   nId   = NEXT;
  102.                   bDone = TRUE;
  103.  
  104.              case SD_PBUT_YES:
  105.                   nId   = YES;
  106.                   bDone = TRUE;
  107.  
  108.              case BACK:
  109.                   nId    = BACK;
  110.                   bDone  = TRUE;
  111.  
  112.              case DLG_ERR:
  113.                   SdError( -1, szDlg );
  114.                   nId   = -1;
  115.                   bDone = TRUE;
  116.  
  117.              case DLG_CLOSE:
  118.                   SdCloseDlg( hwndDlg, nId, bDone );
  119.  
  120.              default:
  121.                   // check standard handling
  122.                   if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  123.                       bDone = TRUE;
  124.                   endif;
  125.              endswitch;
  126.  
  127.           endwhile;
  128.  
  129.           EndDialog( szDlg );
  130.           ReleaseDialog( szDlg );
  131.  
  132.           SdUnInit();
  133.  
  134.           // record data produced by this dialog
  135.           SdMakeName( szAppKey, szDlg, szTitle, nSdLicense );
  136.           SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  137.  
  138.           return nId;
  139.         end;
  140.  
  141.