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

  1.  /*=======================================================================*/
  2.  /*                                                                       */
  3.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  4.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  5.  /*                       Schaumburg, Illinois 60173                      */
  6.  /*                          All Rights Reserved                          */
  7.  /*                           InstallShield (R)                           */
  8.  /*                                                                       */
  9.  /*   File    : sdint.rul                                                 */
  10.  /*                                                                       */
  11.  /*   Purpose : This file contains the general internal utility code for  */
  12.  /*             the script dialogs.                                       */
  13.  /*                                                                       */
  14.  /*=======================================================================*/
  15.  
  16. /*------------------------------------------------------------------------*/
  17. /*                                                                        */
  18. /*   Function: SdInit                                                     */
  19. /*                                                                        */
  20. /*   Descrip:  This will hande any initialization required for all script */
  21. /*             dialogs and related functions.                             */
  22. /*   Misc:                                                                */
  23. /*                                                                        */
  24. /*------------------------------------------------------------------------*/
  25. function SdInit()
  26.           STRING  svDontCare;
  27.           INT     nType;
  28.           NUMBER  hIsres;
  29.           HWND    hwndInstall;
  30.         begin
  31.  
  32.            if (bSdInit) then return TRUE; endif;
  33.  
  34.            // determine which InstallShield is operating 16 or 32 bit
  35.            GetSystemInfo( ISTYPE, nType, svDontCare );
  36.            bInstall16 = FALSE;
  37.            if (nType = 16) then
  38.              bInstall16 = TRUE;
  39.            endif;
  40.  
  41.            bSdInit = TRUE;
  42.  
  43.            // load strings
  44.            hIsres = GetModuleHandle( ISRES );
  45.            if (hIsres) then
  46.              LoadString( hIsres, SD_STR_NOTENOUGHSPACE, szSdStr_NotEnoughSpace, _MAX_STRING );
  47.            endif;
  48.  
  49.            // Restore the IS window, if it was minimized . . .
  50.            hwndInstall = GetWindowHandle( HWND_INSTALL );
  51.            if( hwndInstall ) then
  52.                 if( IsIconic( hwndInstall ) ) then
  53.                    ShowWindow( hwndInstall, SW_RESTORE );
  54.                 endif;
  55.            endif;
  56.  
  57.            // Set Checkbox style to Windows 95 style
  58.            DialogSetInfo( DLG_INFO_CHECKSELECTION, "", CHECKBOX95 );
  59.  
  60.         end;
  61.  
  62. /*------------------------------------------------------------------------*/
  63. /*                                                                        */
  64. /*   Function: SdUnInit                                                   */
  65. /*                                                                        */
  66. /*   Descrip:  This function will clean up the unneeded objects that has  */
  67. /*             possibly been created by SD functions.                     */
  68. /*   Misc:                                                                */
  69. /*                                                                        */
  70. /*------------------------------------------------------------------------*/
  71. function SdUnInit( )
  72.         begin
  73.  
  74.         end;
  75.  
  76. /*------------------------------------------------------------------------*/
  77. /*                                                                        */
  78. /*   Function: SdGeneralInit                                              */
  79. /*                                                                        */
  80. /*   Descrip:  This will handle the general initialization for the dialog */
  81. /*             main wait loop.                                            */
  82. /*   Misc:                                                                */
  83. /*                                                                        */
  84. /*------------------------------------------------------------------------*/
  85. function SdGeneralInit( szDlg, hwndDlg, nStyle, szProduct )
  86.           HWND            hwndStatic, hwndFocus;
  87.           INT             nItemID;
  88.           STRING          szClassName[ MAX_STRING ];
  89.           NUMBER          nReturn, nCurrentID;
  90.           POINTER         pLogFont, pClassName;
  91.         begin
  92.  
  93.           // ensure next-back enablement is correct
  94.           SdEnablement( hwndDlg );
  95.  
  96.           // Find out if current focus is a edit field
  97.           // If it is, select all the text in it.
  98.           hwndFocus  = GetFocus();
  99.           pClassName = AddressString( szClassName );
  100.  
  101.           if (IsWindow( hwndFocus )) then
  102.  
  103.              GetClassName( hwndFocus, pClassName, MAX_STRING );
  104.  
  105.              if (szClassName = "edit") then
  106.                if (bInstall16 = TRUE) then // 16-bit version
  107.                   nCurrentID = GetWindowWord( hwndFocus, GWW_ID );
  108.                else                        // 32-bit version
  109.                   nCurrentID = GetWindowLong( hwndFocus, GWW_ID );
  110.                endif;
  111.  
  112.                CtrlSelectText( szDlg, nCurrentID );
  113.  
  114.              endif;
  115.  
  116.           endif;
  117.  
  118.           // ensure all standard 700-724 have %p replaced
  119.           if (szProduct != "") then
  120.              SdPlugInProductName( szDlg, hwndDlg, szSdProduct, 700, 25 );
  121.           endif;
  122.  
  123.         end;
  124.  
  125. /*------------------------------------------------------------------------*/
  126. /*                                                                        */
  127. /*   Function: SdIsStdButton                                              */
  128. /*                                                                        */
  129. /*   Descrip:  Check if the use input is in the legal range               */
  130. /*                                                                        */
  131. /*   Misc:                                                                */
  132. /*                                                                        */
  133. /*------------------------------------------------------------------------*/
  134. function SdIsStdButton( nId )
  135.         begin
  136.  
  137.           if ((nId >= SD_PBUT_OK) && (nId <= SD_PBUT_BACK)) then
  138.             return TRUE;
  139.           endif;
  140.  
  141.           return FALSE;
  142.         end;
  143.  
  144. /*------------------------------------------------------------------------*/
  145. /*                                                                        */
  146. /*   Function: SdDoStdButton                                              */
  147. /*                                                                        */
  148. /*   Descrip:  Implement some special standard buttons                    */
  149. /*                                                                        */
  150. /*   Misc:                                                                */
  151. /*                                                                        */
  152. /*------------------------------------------------------------------------*/
  153. function SdDoStdButton( nId )
  154.         begin
  155.  
  156.            switch( nId )
  157.            case SD_PBUT_CANCEL: // (generated from ESC key)
  158.                 Do( EXIT );
  159.  
  160.            case SD_PBUT_EXITSETUP:
  161.                 Do( EXIT );
  162.  
  163.            case SD_PBUT_HELP:
  164.                 Do( HELP );
  165.  
  166.            default:
  167.                 return TRUE;
  168.            endswitch;
  169.  
  170.            return FALSE;
  171.         end;
  172.  
  173. /*------------------------------------------------------------------------*/
  174. /*                                                                        */
  175. /*   Function: SdEnablement                                               */
  176. /*                                                                        */
  177. /*   Descrip:  This will enable/disable the next-prev-finish buttons.     */
  178. /*                                                                        */
  179. /*   Misc:                                                                */
  180. /*                                                                        */
  181. /*------------------------------------------------------------------------*/
  182. function SdEnablement( hwndDlg )
  183.           HWND    hwndOk, hwndBack, hwndContinue, hwndExit, hwndCancel;
  184.           BOOL    bEnableNext, bEnableBack, bEnableCancel, bEnableFinish;
  185.           STRING  szTemp, szText;
  186.         begin
  187.  
  188.          hwndOk       = GetDlgItem( hwndDlg, SD_PBUT_OK );
  189.          hwndContinue = GetDlgItem( hwndDlg, SD_PBUT_CONTINUE );
  190.          hwndBack     = GetDlgItem( hwndDlg, SD_PBUT_BACK );
  191.          hwndCancel   = GetDlgItem( hwndDlg, SD_PBUT_CANCEL );
  192.          hwndExit     = GetDlgItem( hwndDlg, SD_PBUT_EXITSETUP );
  193.  
  194.          if (!IsWindow( hwndBack )) then return FALSE; endif; // no back-next
  195.  
  196.          bEnableNext   = Is( NEXTBUTTON, szTemp );
  197.          bEnableBack   = Is( BACKBUTTON, szTemp );
  198.          bEnableCancel = Is( CANCELBUTTON, szTemp );
  199.          bEnableFinish = Is( FINISHBUTTON, szTemp );
  200.  
  201.          // if finished enabled set ok and continue button text to finish
  202.  
  203.          if (bEnableFinish) then
  204.  
  205.              szText = @SETUPSTR862;     // load install program string 862
  206.  
  207.              if (IsWindow( hwndOk )) then
  208.                  SetWindowText( hwndOk, szText );
  209.              endif;
  210.  
  211.              if (IsWindow( hwndContinue )) then
  212.                  SetWindowText( hwndContinue, szText );
  213.              endif;
  214.  
  215.          endif;
  216.  
  217.          if (IsWindow( hwndOk )) then
  218.              EnableWindow( hwndOk, bEnableNext );
  219.          endif;
  220.  
  221.          if (IsWindow( hwndContinue )) then
  222.              EnableWindow( hwndContinue, bEnableNext );
  223.          endif;
  224.  
  225.          if (IsWindow( hwndBack )) then
  226.              EnableWindow( hwndBack, bEnableBack );
  227.          endif;
  228.  
  229.          if (IsWindow( hwndCancel )) then
  230.              EnableWindow( hwndCancel, bEnableCancel );
  231.          endif;
  232.  
  233.          if (IsWindow( hwndExit )) then
  234.              EnableWindow( hwndExit, bEnableCancel );
  235.          endif;
  236.  
  237.          return TRUE;
  238.         end;
  239.  
  240. /*------------------------------------------------------------------------*/
  241. /*                                                                        */
  242. /*   Function: SdSetStatic                                                */
  243. /*                                                                        */
  244. /*   Descrip:  Set text in the static fields( 80x and 85x ).              */
  245. /*                                                                        */
  246. /*   Misc:                                                                */
  247. /*                                                                        */
  248. /*------------------------------------------------------------------------*/
  249. function SdSetStatic( szDlg, nControlID, szText )
  250.         begin
  251.  
  252.            CtrlSetText( szDlg, nControlID, szText );
  253.  
  254.         end;
  255.  
  256. /*------------------------------------------------------------------------*/
  257. /*                                                                        */
  258. /*   Function: SdPlugInProductName                                        */
  259. /*                                                                        */
  260. /*   Descrip:  The function plugs the product name defined in             */
  261. /*             SdProductName() into %P found in the static message.       */
  262. /*             It will search for the first nMax controls only.           */
  263. /*   Misc:                                                                */
  264. /*                                                                        */
  265. /*------------------------------------------------------------------------*/
  266. function SdPlugInProductName( szDlg, hwndDlg, szProduct, nItemStart, nMax )
  267.           HWND    hwndProduct;
  268.           INT     nItemID;
  269.           NUMBER  nMsgLength, i, nPos;
  270.           STRING  svTextBuf[MAX_STRING], szTemp[MAX_STRING], szTemp1[MAX_STRING];
  271.           BOOL    bProduct;
  272.         begin
  273.  
  274.            nItemID     = nItemStart; // The item IDs start from 701 or 751
  275.            hwndProduct = GetDlgItem( hwndDlg, nItemID );
  276.  
  277.  
  278.            for i = 0 to nMax
  279.  
  280.               if (hwndProduct) then
  281.  
  282.                  bProduct = FALSE;
  283.                  CtrlGetText( szDlg, nItemID, svTextBuf );
  284.  
  285.                  // Find the %P
  286.                  nPos =  StrFind( svTextBuf,  "%P" );
  287.                  nMsgLength = StrLength ( svTextBuf );
  288.  
  289.                  // while the %P exists keep finding and replaced it with product Name
  290.                  while ( nPos >= 0 )
  291.  
  292.                      bProduct = TRUE;     //  We find %P
  293.                      StrSub( szTemp , svTextBuf , 0, nPos );
  294.                      szTemp = szTemp + szProduct;
  295.                      nPos = nPos + 2;   //  Skip "%P" as we replaced with product name
  296.                      nMsgLength = nMsgLength - nPos;
  297.                      StrSub( szTemp1 , svTextBuf ,nPos , nMsgLength   );
  298.                      svTextBuf = szTemp +  szTemp1;
  299.                      nPos =  StrFind( svTextBuf,  "%P" );
  300.                      nMsgLength = StrLength ( svTextBuf );
  301.  
  302.                  endwhile;
  303.  
  304.                  if ( bProduct ) then
  305.                     CtrlSetText( szDlg, nItemID, svTextBuf );
  306.                  endif;
  307.  
  308.               endif;
  309.  
  310.               nItemID = nItemID + 1;
  311.               hwndProduct = GetDlgItem( hwndDlg, nItemID );
  312.  
  313.            endfor;
  314.  
  315.         end;
  316.  
  317. /*------------------------------------------------------------------------*/
  318. /*                                                                        */
  319. /*   Function: SdDiskSpace                                                */
  320. /*                                                                        */
  321. /*   Descrip:  This function will show the SdDiskSpace Dialog showing user*/
  322. /*             disk space information.                                    */
  323. /*   Misc:                                                                */
  324. /*                                                                        */
  325. /*------------------------------------------------------------------------*/
  326. function SdDiskSpace( svDir, szDiskSpace, szReqSpace, bChange )
  327.           NUMBER  nDiskSpace, nMsg, nAvailableSpace;
  328.           LIST    listDrives;
  329.           HWND    hwndDlg;
  330.           BOOL    bDone, bRemoveSlash;
  331.           STRING  svCurDrive, szDlg, szDir, svOrigPath, szTemp;
  332.         begin
  333.  
  334.            szDlg = "Disk Space";
  335.  
  336.            // get original path and drives
  337.            StrSub( svCurDrive, svDir, 0, 1 );
  338.  
  339.            bRemoveSlash = FALSE;
  340.            szTemp = svDir ^ "temp.txt";
  341.            ParsePath( svOrigPath, szTemp, PATH );
  342.            if (svOrigPath != svDir) then // determine if \ existed at end of string
  343.              bRemoveSlash = TRUE;
  344.            endif;
  345.            szTemp = svDir ^ "temp.txt";
  346.            ParsePath( svOrigPath, szTemp, DIRECTORY );
  347.            if (bRemoveSlash) then
  348.               StrRemoveLastSlash( svOrigPath );
  349.            endif;
  350.  
  351.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_DISKSPACE ) = DLG_ERR) then
  352.               return -1;
  353.            endif;
  354.  
  355.            bDone = FALSE;
  356.  
  357.            while (bDone = FALSE)
  358.  
  359.               nMsg = WaitOnDialog( szDlg );
  360.  
  361.               switch (nMsg)
  362.               case DLG_INIT:
  363.                    hwndDlg = CmdGetHwndDlg( szDlg );
  364.  
  365.                    // get drive list
  366.                    listDrives = ListCreate( STRINGLIST );
  367.                    GetValidDrivesList( listDrives, FIXED_DRIVE | REMOTE_DRIVE | REMOVEABLE_DRIVE, 0 );
  368.                    CtrlSetList( szDlg, SD_COMBO_DRIVE, listDrives );
  369.                    ListDestroy( listDrives );
  370.  
  371.                    CtrlSetCurSel( szDlg, SD_COMBO_DRIVE, svCurDrive );
  372.                    CtrlSetText( szDlg, SD_DISKREQ, szReqSpace );
  373.  
  374.                    szDir = svCurDrive + ":\\";
  375.  
  376.                    nAvailableSpace = GetDiskSpace( szDir ) / 1024;
  377.                    NumToStr( szDiskSpace, nAvailableSpace );
  378.                    szDiskSpace = szDiskSpace + " K";
  379.                    CtrlSetText( szDlg, SD_DISKAVI, szDiskSpace );
  380.  
  381.                    SdGeneralInit( szDlg, hwndDlg, 0, szSdProduct );
  382.  
  383.               case SD_COMBO_DRIVE:
  384.                    CtrlGetCurSel( szDlg, SD_COMBO_DRIVE, svCurDrive );
  385.                    szDir = svCurDrive + ":\\";
  386.  
  387.                    nAvailableSpace = GetDiskSpace( szDir ) / 1024;
  388.                    NumToStr( szDiskSpace, nAvailableSpace );
  389.                    szDiskSpace = szDiskSpace + " K";
  390.                    CtrlSetText( szDlg, SD_DISKAVI, szDiskSpace );
  391.  
  392.               case SD_PBUT_OK:
  393.                    if (StrFind( svDir, svCurDrive ) != 0 ) then
  394.                        svDir = svCurDrive + ":\\" ^ svOrigPath;
  395.                    endif;
  396.  
  397.                    bDone = TRUE;
  398.                    bChange = TRUE;
  399.  
  400.               case SD_PBUT_CANCEL:
  401.                    bDone = TRUE;
  402.                    bChange = FALSE;
  403.  
  404.               case DLG_CLOSE:
  405.                    bDone = TRUE;
  406.                    bChange = FALSE;
  407.  
  408.               endswitch;
  409.  
  410.            endwhile;
  411.  
  412.            EndDialog( szDlg );
  413.            ReleaseDialog( szDlg );
  414.  
  415.         end;
  416.  
  417. /*------------------------------------------------------------------------*/
  418. /*                                                                        */
  419. /*   Function: SdError                                                    */
  420. /*                                                                        */
  421. /*   Descrip:  This function handles some exceptional errors              */
  422. /*                                                                        */
  423. /*   Misc:                                                                */
  424. /*                                                                        */
  425. /*------------------------------------------------------------------------*/
  426. function SdError( nCode, szMsg )
  427.         begin
  428.  
  429.           switch (nCode)
  430.           case -1:
  431.                SprintfBox( SEVERE, "Error", "In function '%s':\n" +
  432.                            "Unable to create dialog.\n" +
  433.                            "Make sure the _ISRES.DLL is in _SYS.CAB.", szMsg );
  434.           endswitch;
  435.  
  436.         end;
  437.  
  438. /*------------------------------------------------------------------------*/
  439. /*                                                                        */
  440. /*   Function: SdCloseDlg                                                 */
  441. /*                                                                        */
  442. /*   Descrip:  This function will attempt to close a dialog and do        */
  443. /*             standard pushbutton checking.                              */
  444. /*   Misc:                                                                */
  445. /*                                                                        */
  446. /*------------------------------------------------------------------------*/
  447. function SdCloseDlg( hwndDlg, nResult, bDone )
  448.         begin
  449.  
  450.           if (GetDlgItem(hwndDlg, SD_PBUT_EXITSETUP)) then
  451.              Do(EXIT);
  452.           elseif (GetDlgItem(hwndDlg, SD_PBUT_CANCEL)) then
  453.              nResult = CANCEL;
  454.              bDone   = TRUE;
  455.           else
  456.              nResult = CANCEL;
  457.              bDone   = TRUE;
  458.           endif;
  459.  
  460.         end;
  461.  
  462. /*------------------------------------------------------------------------*/
  463. /*                                                                        */
  464. /*   Function: SdGetTextExtent                                            */
  465. /*                                                                        */
  466. /*   Descrip:  This function will retrieve size in pixels base on the     */
  467. /*             device context and string passed in                        */
  468. /*             (WIN16 and WIN32 compatible)                               */
  469. /*   Misc:                                                                */
  470. /*                                                                        */
  471. /*------------------------------------------------------------------------*/
  472. function SdGetTextExtent( hdc, szString, nSize )
  473.           INT     nResult;
  474.           STRING  szTemp;
  475.           _sdSIZE SIZE;
  476.           POINTER pSize;
  477.         begin
  478.  
  479.           pSize = AddressStruct( SIZE );
  480.           GetTextExtentPoint( hdc, szString, nSize, pSize );
  481.           StructGetP( pSize, "_sdSIZE", "cx", nResult, szTemp );
  482.  
  483.           return nResult;
  484.         end;
  485.  
  486. /*------------------------------------------------------------------------*/
  487. /*                                                                        */
  488. /*   Function: SdMakeName                                                 */
  489. /*                                                                        */
  490. /*   Descrip:  This dialog will make the name for the silent/record       */
  491. /*             data key.                                                  */
  492. /*   Misc:                                                                */
  493. /*                                                                        */
  494. /*------------------------------------------------------------------------*/
  495. function SdMakeName( szAppKey, szDlg, szTitle, nCount )
  496.         begin
  497.  
  498.           Sprintf( szAppKey, "%s-%ld", szDlg, nCount );
  499.           nCount++;
  500.  
  501.         end;
  502.  
  503. /*------------------------------------------------------------------------*/
  504. /*                                                                        */
  505. /*   Function: SdRemoveEndSpace                                           */
  506. /*                                                                        */
  507. /*   Descrip:  This dialog will remove spaces from the end and beginning  */
  508. /*             of the string.                                             */
  509. /*   Misc:                                                                */
  510. /*                                                                        */
  511. /*------------------------------------------------------------------------*/
  512. function SdRemoveEndSpace( szString )
  513.           NUMBER nLen, nValue, nFirstLastSpace, nTarget, i;
  514.           BOOL   bNonSpaceFound;
  515.           STRING szTemp;
  516.         begin
  517.  
  518.           nLen            = StrLength( szString );
  519.           nTarget         = 0;
  520.           bNonSpaceFound  = FALSE;
  521.           nFirstLastSpace = 0;
  522.  
  523.           for i = 0 to nLen - 1
  524.             GetByte( nValue, szString, i );
  525.             if (nValue = 32) then // if space
  526.                if (!nFirstLastSpace) then
  527.                   nFirstLastSpace = nTarget;
  528.                endif;
  529.                if (bNonSpaceFound) then
  530.                  SetByte( szTemp, nTarget, 32 );
  531.                  nTarget++;
  532.                endif;
  533.             else
  534.                bNonSpaceFound  = TRUE;
  535.                nFirstLastSpace = 0;
  536.                SetByte( szTemp, nTarget, nValue );
  537.                nTarget++;
  538.             endif;
  539.           endfor;
  540.  
  541.           // clear out last space to null terminator
  542.           if (nFirstLastSpace) then
  543.             SetByte( szTemp, nFirstLastSpace, 0 );
  544.           endif;
  545.  
  546.           szString = szTemp;
  547.  
  548.         end;
  549.  
  550. /*------------------------------------------------------------------------*/
  551. /*  function: SdGetUserCompanyInfo( svName, svCompany )                   */
  552. /*                                                                        */
  553. /*  descrip:  This dialog will get the name and company name of the       */
  554. /*            Windows registered owner.                                   */
  555. /*                                                                        */
  556. /*  Misc:                                                                 */
  557. /*                                                                        */
  558. /*------------------------------------------------------------------------*/
  559. function  SdGetUserCompanyInfo( svName, svCompany )
  560.           STRING szRegKey;
  561.           STRING svDontCare;
  562.           NUMBER nvType, nvSize, nOS;
  563.           LONG hUser;
  564.        begin
  565.           svName = "";
  566.           svCompany = "";
  567.           GetSystemInfo( OS, nOS, svDontCare );
  568.           if ( ( nOS = IS_WINDOWS95 ) &&  ( !bInstall16 ) ) then
  569.              RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
  570.              szRegKey = "\\Software\\Microsoft\\Windows\\CurrentVersion";
  571.           elseif ( ( nOS = IS_WINDOWSNT ) && ( !bInstall16 ) ) then
  572.              RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
  573.              szRegKey = "\\Software\\Microsoft\\Windows NT\\CurrentVersion";
  574.           else
  575.              hUser = GetModuleHandle("USER");
  576.              LoadString(hUser, 514, svName, 255);
  577.              LoadString(hUser, 515, svCompany, 255);
  578.              return TRUE;
  579.           endif;
  580.  
  581.           if ( !bInstall16 ) then
  582.              if( RegDBKeyExist( szRegKey ) >= 0 ) then
  583.  
  584.                 if ( RegDBGetKeyValueEx( szRegKey, "RegisteredOwner",
  585.                            nvType, svName, nvSize ) >= 0 ) then
  586.                 endif;
  587.  
  588.  
  589.                 if ( RegDBGetKeyValueEx( szRegKey, "RegisteredOrganization",
  590.                            nvType, svCompany, nvSize ) >= 0 ) then
  591.                 endif;
  592.  
  593.              endif;
  594.           endif;
  595.           RegDBSetDefaultRoot( HKEY_CLASSES_ROOT );
  596.        end;
  597.  
  598.  
  599.  
  600. /*------------------------------------------------------------------------*/
  601. /*  function: SdCreateComponentView                                       */
  602. /*                   ( hwndDlg, nStaticID, szComponents, szTargetDir )    */
  603. /*                                                                        */
  604. /*  descrip:  This routine will create and initialize the view object.    */
  605. /*            It will check to see if some predefined controls exist.     */
  606. /*            If they do, they are linked to the view.                    */
  607. /*                                                                        */
  608. /*  Misc:                                                                 */
  609. /*                                                                        */
  610. /*------------------------------------------------------------------------*/
  611. function SdCreateComponentView( hwndDlg, nStaticID, szComponents, szTargetDir )
  612.          NUMBER hwndStatic;
  613.          NUMBER nComponentView;
  614.       begin
  615.  
  616.          nComponentView = ComponentViewCreate( hwndDlg, nStaticID );
  617.  
  618.          if (nComponentView = 0) then
  619.              return 0;
  620.          endif;
  621.  
  622.          ComponentViewCreateWindow( nComponentView );
  623.  
  624.          ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_COMPONENT, 0,  szComponents );
  625.          ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_MEDIA, 0,  MEDIA );
  626.  
  627.          hwndStatic = GetDlgItem( hwndDlg, SD_SPACEAVI );
  628.          if( hwndStatic ) then
  629.              ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_SIZEAVAIL, SD_SPACEAVI, "" );
  630.          endif;
  631.  
  632.          hwndStatic = GetDlgItem( hwndDlg, SD_SPACEREQ );
  633.          if( hwndStatic ) then
  634.              ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_SIZETOTAL, SD_SPACEREQ, "" );
  635.          endif;
  636.  
  637.          hwndStatic = GetDlgItem( hwndDlg, SD_STA_MSG2 );
  638.          if( hwndStatic ) then
  639.              ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_DESCRIPTION, SD_STA_MSG2, "" );
  640.          endif;
  641.  
  642.          hwndStatic = GetDlgItem( hwndDlg, SD_PBUT_CHANGE );
  643.          if( hwndStatic ) then
  644.              ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_CHANGE, SD_PBUT_CHANGE, "" );
  645.          endif;
  646.  
  647.  
  648.          if( szTargetDir != "" ) then
  649.              ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_TARGETLOCATION, 0, szTargetDir );
  650.          endif;
  651.  
  652.  
  653.          return nComponentView;
  654.  
  655.       end;
  656.  
  657. /*------------------------------------------------------------------------*/
  658. /*  function: SdIsShellExplorer( )                                                */
  659. /*                                                                        */
  660. /*  descrip:  This routine determines the target operationg system.       */
  661. /*            SdIsShellExplorer returns TRUE if Windows95 or Windows NT   */
  662. /*            4.0 is running, FALSE otherwise.                            */
  663. /*                                                                        */
  664. /*  Misc:                                                                 */
  665. /*                                                                        */
  666. /*------------------------------------------------------------------------*/
  667. function SdIsShellExplorer()
  668.    NUMBER  nvResult;
  669.    STRING  svResult;
  670.  
  671. begin
  672.  
  673. // Determine the target system's operating system.
  674.    GetSystemInfo( OS, nvResult, svResult );
  675.  
  676.    if (nvResult =  IS_WINDOWSNT) then
  677.       // Check to see if the shell being used is EXPLORER shell.
  678.       if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
  679.             if (nvResult >= 4) then
  680.                return TRUE;
  681.             endif;
  682.       endif;
  683.    elseif (nvResult = IS_WINDOWS95 ) then
  684.       return TRUE;
  685.    endif;
  686.  
  687.    return FALSE;
  688. end;
  689.  
  690.  /*------------------------------------------------------------------------*/
  691.  /*                                                                        */
  692.  /*   Function: SdComponentDlgCheckSpace                                   */
  693.  /*                                                                        */
  694.  /*   Descrip:  This funciton checks the free space and required space.    */
  695.  /*                                                                        */
  696.  /*   Misc:                                                                */
  697.  /*                                                                        */
  698.  /*------------------------------------------------------------------------*/
  699. function SdComponentDlgCheckSpace( szComponents, szDlg, svDir )
  700.    NUMBER nFreeSpace, nReqSpace;
  701.       begin
  702.  
  703.          nReqSpace  = ComponentTotalSize( MEDIA, szComponents, TRUE, TRUE );
  704.  
  705.          nFreeSpace = GetDiskSpace( svDir );
  706.  
  707.          if ( nReqSpace < nFreeSpace ) then 
  708.             return TRUE;
  709.          endif;
  710.  
  711.          return FALSE;
  712.       end;
  713.