home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDADPATH.RUL next >
Encoding:
Text File  |  1997-11-20  |  4.9 KB  |  128 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    : sdadpath.rul                                              */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdAskDestPath         */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdAskDestPath                                              */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will ask user for the destination directory    */
  22.  /*             for installation.                                          */
  23.  /*   Misc:                                                                */
  24.  /*                                                                        */
  25.  /*------------------------------------------------------------------------*/
  26. function SdAskDestPath(szTitle, szMsg, svDir, nStyle)
  27.           STRING  szDlg, svDirLoc, szTemp;
  28.           INT     nId, nTemp;
  29.           HWND    hwndDlg;
  30.           BOOL    bDone;
  31.         begin
  32.  
  33.           szDlg     = SD_DLG_ASKDESTPATH;
  34.           nSdDialog = SD_NDLG_ASKDESTPATH;
  35.           svDirLoc = svDir;
  36.  
  37.           // record data produced by this dialog
  38.           if (MODE=SILENTMODE) then
  39.             SdMakeName( szAppKey, szDlg, szTitle, nSdAskDestPath );
  40.             SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  41.             if ((nId != BACK) && (nId != CANCEL)) then
  42.                SilentReadData( szAppKey, "szDir", DATA_STRING, svDir, nTemp );
  43.             endif;
  44.  
  45.             return nId;
  46.           endif;
  47.  
  48.           // ensure general initialization is complete
  49.           if (!bSdInit) then
  50.              SdInit();
  51.           endif;
  52.  
  53.          if (EzDefineDialog( szDlg, "", "", SD_NDLG_ASKDESTPATH ) = DLG_ERR) then
  54.             return -1;
  55.           endif;
  56.  
  57.           // Loop in dialog until the user selects a standard button
  58.           bDone = FALSE;
  59.  
  60.           while (!bDone)
  61.  
  62.              nId = WaitOnDialog( szDlg );
  63.  
  64.              switch (nId)
  65.              case DLG_INIT:
  66.                   CtrlSetText( szDlg, 0x80000000 | SD_STA_DESTDIR, svDirLoc );
  67.  
  68.                   if(szMsg != "") then
  69.                       SdSetStatic( szDlg, SD_STA_CHANGEDIRMSG, szMsg );
  70.                   endif;
  71.  
  72.                   hwndDlg = CmdGetHwndDlg( szDlg );
  73.                   SdGeneralInit( szDlg, hwndDlg, nStyle, szSdProduct );
  74.  
  75.                   if(szTitle != "") then
  76.                       SetWindowText( hwndDlg, szTitle );
  77.                   endif;
  78.  
  79.              case SD_PBUT_CHANGEDIR:
  80.                   nTemp = MODE;
  81.                   MODE  = NORMALMODE;
  82.                   SelectDir( "",
  83.                              "",
  84.                              svDirLoc,
  85.                              TRUE );
  86.                   CtrlSetText( szDlg, 0x80000000 | SD_STA_DESTDIR, svDirLoc );
  87.                   MODE = nTemp;
  88.  
  89.              case SD_PBUT_CONTINUE:
  90.                   svDir = svDirLoc;
  91.                   nId   = NEXT;
  92.                   bDone = TRUE;
  93.  
  94.              case BACK:
  95.                   nId    = BACK;
  96.                   bDone  = TRUE;
  97.  
  98.              case DLG_ERR:
  99.                   SdError( -1, "SdAskDestPath" );
  100.                   nId   = -1;
  101.                   bDone = TRUE;
  102.  
  103.              case DLG_CLOSE:
  104.                   SdCloseDlg( hwndDlg, nId, bDone );
  105.  
  106.              default:
  107.                   // check standard handling
  108.                   if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  109.                       bDone = TRUE;
  110.                   endif;
  111.              endswitch;
  112.  
  113.           endwhile;
  114.  
  115.           EndDialog( szDlg );
  116.           ReleaseDialog( szDlg );
  117.  
  118.           SdUnInit( );
  119.  
  120.           // record data produced by this dialog
  121.           SdMakeName( szAppKey, szDlg, szTitle, nSdAskDestPath );
  122.           SilentWriteData( szAppKey, "szDir", DATA_STRING, svDir, 0 );
  123.           SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  124.  
  125.           return nId;
  126.         end;
  127.  
  128.