home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDSMSG.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  4.5 KB  |  118 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    : sdsmsg.rul                                                */
  10.  /*                                                                       */
  11.  /*   Purpose : This file contains the code for the SdShowMsg             */
  12.  /*             script dialog function.                                   */
  13.  /*                                                                       */
  14.  /*=======================================================================*/
  15.  
  16.  /*------------------------------------------------------------------------*/
  17.  /*                                                                        */
  18.  /*   Function: SdShowMsg                                                  */
  19.  /*                                                                        */
  20.  /*   Descrip:  This dialog will show user a message during a              */
  21.  /*             time consuming process.                                    */
  22.  /*   Misc:                                                                */
  23.  /*                                                                        */
  24.  /*------------------------------------------------------------------------*/
  25. function SdShowMsg( szMsg, bShow )
  26.           STRING  szDlg, szWidth;
  27.           HWND    hwndDlg, hwndStatic;
  28.           BOOL    bDone;
  29.           NUMBER  nId, nMessage;
  30.           NUMBER  hdc, hFont;
  31.           INT     nWinWidth, nWinHeight, nDx, nDy;
  32.           INT     nTop, nBottom;
  33.           _sdRECT rect;
  34.           POINTER pRect;
  35.         begin
  36.  
  37.            szDlg     = SD_DLG_SHOWMSG;
  38.            nSdDialog = SD_NDLG_SHOWMSG;
  39.  
  40.            if (MODE=SILENTMODE) then return 0; endif;
  41.  
  42.            // ensure general initialization is complete
  43.            if (!bSdInit) then
  44.                 SdInit();
  45.            endif;
  46.  
  47.            if (bShow = FALSE) then
  48.               bSdShowMsgUsed = FALSE;
  49.               EndDialog( szDlg );
  50.               ReleaseDialog( szDlg );
  51.               return;
  52.            endif;
  53.  
  54.            if (bSdShowMsgUsed) then
  55.              return; // already visible
  56.            endif;
  57.  
  58.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_SHOWMSG ) = DLG_ERR) then
  59.                return -1;
  60.            endif;
  61.  
  62.            // Loop in dialog until the user selects a standard button
  63.            bDone = FALSE;
  64.  
  65.            nId = WaitOnDialog( szDlg );
  66.  
  67.            if( nId = DLG_ERR ) then
  68.                SdError( -1, "SdShowMsg" );
  69.                return -1;
  70.            endif;
  71.  
  72.            if( nId = DLG_INIT ) then
  73.                 hwndDlg = CmdGetHwndDlg( szDlg );
  74.                 SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
  75.                 if( szMsg != "" ) then
  76.                     CtrlSetText( szDlg, SD_STA_MSG, szMsg );
  77.                 else
  78.                     ShowWindow( hwndDlg, WM_SHOW );
  79.                     return;
  80.                 endif;
  81.  
  82.  
  83.                 hwndStatic = GetDlgItem( hwndDlg, SD_STA_MSG );
  84.  
  85.                 hdc   = GetDC(hwndStatic);
  86.                 hFont = SendMessage(hwndStatic, WM_GETFONT, 0, 0 );
  87.  
  88.                 SelectObject( hdc, hFont );
  89.  
  90.                 GetExtents( nDx, nDy );
  91.                 pRect = AddressStruct( rect );
  92.                 GetWindowRect( hwndDlg, pRect );
  93.  
  94.                 StructGet( rect, "_sdRECT", "top", nTop, szWidth );
  95.                 StructGet( rect, "_sdRECT", "bottom", nBottom, szWidth );
  96.  
  97.  
  98.                 nWinHeight = nBottom - nTop;
  99.  
  100.                 nWinWidth = SdGetTextExtent(hdc, szMsg, StrLength(szMsg));
  101.  
  102.                 nWinWidth = nWinWidth + nWinHeight + nWinHeight/2 ;
  103.  
  104.                 MoveWindow( hwndDlg, (nDx-nWinWidth)/2 ,
  105.                             (nDy-nWinHeight)/2, nWinWidth, nWinHeight, TRUE );
  106.  
  107.                 ReleaseDC( hwndStatic, hdc);
  108.  
  109.                 ShowWindow( hwndDlg, WM_SHOW );
  110.  
  111.                 bSdShowMsgUsed = TRUE;
  112.  
  113.            endif;
  114.  
  115.            return;
  116.  
  117.         end;
  118.