home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDREGUX.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  7.8 KB  |  188 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    : sdregux.rul                                               */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdRegisterUserEx      */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdRegisterUserEx                                           */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will ask user for registration infomation.     */
  22.  /*                                                                        */
  23.  /*   Misc:                                                                */
  24.  /*                                                                        */
  25.  /*------------------------------------------------------------------------*/
  26. function SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial )
  27.  
  28.         STRING  szDlg, szTemp;
  29.         BOOL    bDone;
  30.         NUMBER  nId, nMessage, nTemp;
  31.         HWND    hwndDlg;
  32.  
  33.         begin
  34.  
  35.            szDlg     = SD_DLG_REGISTERUSEREX;
  36.            nSdDialog = SD_NDLG_REGISTERUSEREX;
  37.  
  38.           // record data produced by this dialog
  39.           if (MODE=SILENTMODE) then
  40.             SdMakeName( szAppKey, szDlg, szTitle, nSdRegisterUserEx );
  41.             SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  42.             if ((nId != BACK) && (nId != CANCEL)) then
  43.                SilentReadData( szAppKey, "szName", DATA_STRING, svName, nTemp );
  44.                SilentReadData( szAppKey, "szCompany", DATA_STRING, svCompany, nTemp );
  45.                SilentReadData( szAppKey, "szSerial", DATA_STRING, svSerial, nTemp );
  46.             endif;
  47.  
  48.             return nId;
  49.           endif;
  50.  
  51.            // ensure general initialization is complete
  52.            if (!bSdInit) then
  53.               SdInit();
  54.            endif;
  55.  
  56.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_REGISTERUSEREX ) = DLG_ERR) then
  57.                return -1;
  58.            endif;
  59.  
  60.            // Loop in dialog until the user selects a standard button
  61.            bDone = FALSE;
  62.  
  63.            while (!bDone)
  64.  
  65.               nId = WaitOnDialog( szDlg );
  66.  
  67.               switch(nId)
  68.               case DLG_INIT:
  69.                    if( szMsg != "" ) then
  70.                        SdSetStatic( szDlg, SD_STA_MSG, szMsg );
  71.                    endif;
  72.  
  73.                    if( ( svName = "" ) && ( svCompany = "" ) ) then
  74.                        SdGetUserCompanyInfo( svName, svCompany );
  75.                        SdRemoveEndSpace( svName );
  76.                        SdRemoveEndSpace( svCompany );
  77.                    endif;
  78.                    CtrlSetText( szDlg, SD_EDIT_NAME, svName );
  79.                    CtrlSetText( szDlg, SD_EDIT_COMPANY, svCompany );
  80.                    CtrlSetText( szDlg, SD_EDIT_SERIAL, svSerial );
  81.  
  82.                    hwndDlg = CmdGetHwndDlg( szDlg );
  83.                    SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
  84.  
  85.                    if(szTitle != "") then
  86.                        SetWindowText(hwndDlg, szTitle);
  87.                    endif;
  88.  
  89.                    SdRegExEnableButton( hwndDlg, NEXT, svName,
  90.                                         svCompany, svSerial );
  91.  
  92.               case SD_EDIT_NAME:
  93.                    nMessage = CtrlGetSubCommand( szDlg );
  94.                    if( nMessage = EDITBOX_CHANGE ) then
  95.                        CtrlGetText( szDlg, SD_EDIT_NAME, svName );
  96.                    endif;
  97.  
  98.                    SdRegExEnableButton( hwndDlg, NEXT, svName,
  99.                                         svCompany, svSerial );
  100.  
  101.               case SD_EDIT_COMPANY:
  102.                    nMessage = CtrlGetSubCommand( szDlg );
  103.                    if( nMessage = EDITBOX_CHANGE ) then
  104.                        CtrlGetText( szDlg, SD_EDIT_COMPANY, svCompany );
  105.                    endif;
  106.  
  107.                    SdRegExEnableButton( hwndDlg, NEXT, svName,
  108.                                         svCompany, svSerial );
  109.  
  110.               case SD_EDIT_SERIAL:
  111.                    nMessage = CtrlGetSubCommand( szDlg );
  112.                    if( nMessage = EDITBOX_CHANGE ) then
  113.                        CtrlGetText( szDlg, SD_EDIT_SERIAL, svSerial );
  114.                    endif;
  115.  
  116.                    SdRegExEnableButton( hwndDlg, NEXT, svName,
  117.                                         svCompany, svSerial );
  118.  
  119.               case NEXT:
  120.                    nId    = NEXT;
  121.                    bDone  = TRUE;
  122.  
  123.               case BACK:
  124.                    nId    = BACK;
  125.                    bDone  = TRUE;
  126.  
  127.               case DLG_ERR:
  128.                    SdError( -1, "SdRegisterUserEx" );
  129.                    nId    = -1;
  130.                    bDone  = TRUE;
  131.  
  132.               case DLG_CLOSE:
  133.                    SdCloseDlg( hwndDlg, nId, bDone );
  134.  
  135.               default:
  136.                    // check standard handling
  137.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  138.                        bDone = TRUE;
  139.                    endif;
  140.               endswitch;
  141.  
  142.            endwhile;
  143.  
  144.            EndDialog( szDlg );
  145.            ReleaseDialog( szDlg );
  146.  
  147.            SdUnInit( );
  148.  
  149.            // record data produced by this dialog
  150.            SdMakeName( szAppKey, szDlg, szTitle, nSdRegisterUserEx );
  151.            SilentWriteData( szAppKey, "szName", DATA_STRING, svName, 0 );
  152.            SilentWriteData( szAppKey, "szCompany", DATA_STRING, svCompany, 0 );
  153.            SilentWriteData( szAppKey, "szSerial", DATA_STRING, svSerial, 0 );
  154.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  155.  
  156.            return nId;
  157.  
  158.        end;
  159.  
  160.  
  161.  /*------------------------------------------------------------------------*/
  162.  /*                                                                        */
  163.  /*   Function: SdRegEnableButton                                          */
  164.  /*                                                                        */
  165.  /*   Descrip:  This funciton will enable or disable a certain button in   */
  166.  /*             SdRegisterUserEx dialog.                                   */
  167.  /*   Misc:                                                                */
  168.  /*                                                                        */
  169.  /*------------------------------------------------------------------------*/
  170. function SdRegExEnableButton( hwndDlg, nControlID, svName, svCompany, svSerial )
  171.          HWND hwndItem;
  172.         begin
  173.  
  174.            hwndItem = GetDlgItem( hwndDlg, nControlID );
  175.            if (!IsWindow( hwndItem)) then return FALSE; endif;
  176.  
  177.            SdRemoveEndSpace( svCompany );
  178.            SdRemoveEndSpace( svName );
  179.            SdRemoveEndSpace( svSerial );
  180.  
  181.            if(svName = "" || svCompany = "" || svSerial = "") then
  182.               EnableWindow( hwndItem, FALSE);
  183.            else
  184.               EnableWindow( hwndItem, TRUE);
  185.            endif;
  186.  
  187.         end;
  188.