home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April (Special) / Chip-Special_1997-04_cd.bin / canon / bj364 / bj364d1.exe / BJL.BIN / SOURCE.ZIP / BJL_INST.C < prev    next >
C/C++ Source or Header  |  1996-05-22  |  24KB  |  707 lines

  1. // ========================================================================================
  2. //    Installer for BJ Printer Setup Utility Program
  3. //    DOS Base
  4. //    BJ Printer (such as the A250 and A5311)
  5. //
  6. //    1. Version 1.00 [August 18, '95]       : Tsukasa Jackie AIBA    : create new
  7. //    2. Version 1.01 [September 21, '95]    : Tsukasa Jackie AIBA    : add A240
  8. //    3. Version 1.02 [September 26, '95]    : Tsukasa Jackie AIBA    : mono display
  9. //    4. Version 1.10 [April 30, '96]        : Tsukasa Jackie AIBA    : Added BJC-80/240/4200/4550
  10. //      5. Version 1.11 [April 29, '96]         : Srinivas Krishnamurti  : Bug fixes
  11. //      6. Version 1.12 [April 30, '96]         : Srinivas Krishnamurti  : Added routine myhandler() to fix bug
  12. //    7. Version 1.13 [May 15, '96]          : Srinivas Krishnamurti  : Added code to remove new help file
  13. //
  14. //    Copyright Canon Information Systems, Inc. 1995
  15. // ========================================================================================
  16.  
  17. /*
  18.     BJL_INST.c
  19.  
  20.     C-scape for DOS version 4.0.1. Software
  21.     Copyright (c) 1992 by Liant Software Corporation.
  22.     ALL RIGHTS RESERVED.
  23.  
  24.     This program is installer for A250 setup utility how to use a mouse with C-scape for DOS version 4.0.1.
  25.  
  26.     There are 5 windows.
  27.     Window 0 is a software title.
  28.     Window 1 is an exit, status, send, default and about menu.
  29.     Window 5 is a help menu.
  30.  
  31.     You can select windows by moving the mouse over the desired window.
  32.     When you are finished you can quit by pressing ESC or by 
  33.     clicking the mouse on the field that says "exit".
  34.  
  35. */
  36.  
  37. // ***********************************************************************
  38. //        include standard headers
  39. // ***********************************************************************
  40.  
  41. #include    <stdio.h>
  42. #include    <string.h>
  43. #include    <time.h>            // for popdecl.h
  44.  
  45. #include    <sys\types.h>
  46. #include    <sys\stat.h>
  47. #include    <dos.h>
  48. #include    <memory.h>
  49. #include    <stdlib.h>
  50. #include    <io.h>
  51. #include    <conio.h>
  52. #include    <fcntl.h>
  53. #include    <direct.h>
  54. #include    <errno.h>
  55.  
  56. // ***********************************************************************
  57. //        include original headers
  58. // ***********************************************************************
  59.  
  60. #include    "..\h\cscape.h"
  61. #include    "..\h\ostdlib.h"        // for exit(), otolower()
  62. #include    "..\h\popdecl.h"        // for popups
  63. #include    "..\h\scancode.h"       // for event codes
  64. #include    "..\h\cmwinobj.h"       // for bcwin_Class
  65. #include    "..\h\dpref.h"
  66. #include    "..\h\ogldecl.h"
  67.  
  68. #include    "bjl_let.h"
  69.  
  70. // ***********************************************************************
  71. //  function name   : void __far *myhandler(unsigned, unsigned, unsigned __far *)
  72. //  function        : Interrupt handler for disk usuage
  73. //  input           : deverror, errcode, devhdr
  74. //  output          : void
  75. // ***********************************************************************
  76. void __far myhandler(unsigned deverror, unsigned errcode, unsigned __far *devhdr)
  77. {
  78.     if (deverror & 0X8000)
  79.         if ((errcode & 0XFF) == 2)
  80.         {
  81.             _hardresume(_HARDERR_FAIL);
  82.         }
  83.     
  84. }
  85.  
  86. // ***********************************************************************
  87. //  function name   : int main(int argc, char **argv)
  88. //  function        : BJ Printer Setup Utility
  89. //  input           : int        argc
  90. //                  : char        **argv
  91. //  output          : 1                            // failure
  92. //                  : 0                            // success
  93. // ***********************************************************************
  94. int main(int argc, char **argv)
  95. {
  96.     menu_type   menu_0,    menu_1,    menu_5;        //
  97.  
  98.     int         fh,    i,    tmp_drive,    current_drive;
  99.     char        dir[OFILE_MAXSPEC + 1],    dir_org[OFILE_MAXSPEC + 1],    dir_tmp[OFILE_MAXSPEC + 10];
  100.     char        search_file[] = "INSTALL.EXE";
  101.     char        monitor_ng[OFILE_MAXSPEC + 9];
  102.     
  103.     strcpy(dir, "C:\\BJ");
  104.     strcpy(dir_org, "A:\\");
  105.  
  106. // Get original drive and path before installation procedure started
  107.     olddrive = _getdrive();
  108.     _getdcwd(olddrive, path, _MAX_PATH);
  109.     
  110.  
  111. // Check drive
  112.  
  113.     if(_chdrive(3) != FILE_ERROR)
  114.         tmp_drive = 1;
  115.     else
  116.     {
  117.         if(_chdrive(1) != FILE_ERROR)
  118.             tmp_drive = 0;
  119.     }
  120.  
  121. // Start display (monitor check)
  122.  
  123.     system("cls");
  124.     if((argc == 2) && (otolower(argv[1][1]) == 't'))
  125.         colors = SVGA_COLOR;
  126.     else
  127.         colors = CO_COLOR;
  128.  
  129. //
  130.     dp_SetApplName(" bjl_inst ");                        // Open the display
  131.     dp_SetWindowName(" Installer for BJ Printer Setup Utility ");
  132.     argc = dp_PickArgs(argc, argv);
  133.  
  134.                                     // Use background character win to make a nice background
  135.     if(colors == CO_COLOR)
  136.     {
  137.         if(disp_Init(def_ModeGraphics, bcwin_Class))
  138.             ogl_Init(def_MiniOGL);                       // Initialize the Oakland Graphics Library
  139.         else
  140.         {
  141.             if(!disp_Init(def_ModeText, bcwin_Class))    // Initialize the device interface for text mode
  142.             {
  143.                 printf("%s", INITFAIL_MSG);              // Initialization failure
  144.                 exit(1);
  145.                 return(1);
  146.             }
  147.         }
  148.     }
  149.     else
  150.     {
  151.         if(disp_Init(pc_ModeVGA50, bcwin_Class))
  152.             ogl_Init(def_MiniOGL);                       // Initialize the Oakland Graphics Library
  153.         else
  154.         {
  155.             if(!disp_Init(def_ModeText, bcwin_Class))    // Initialize the device interface for text mode
  156.             {
  157.                 printf("%s", INITFAIL_MSG);              // Initialization failure
  158.                 exit(1);
  159.                 return(1);
  160.             }
  161.         }
  162.     }
  163.  
  164.     bdcua_InitCombo();                // Initialize the text and graphics (use bd_cua in either mode)
  165.  
  166.                                       // Display the background
  167.     bcwin_SetChar(disp_GetBackWin(), (byte)BK_CHAR);            // a half-dense block char
  168.     win_SetAttr(disp_GetBackWin(), (byte)BK_COLOR1);
  169.     win_SetShadowAttr(disp_GetBackWin(), (byte)BK_COLOR2);
  170.     disp_Repaint();
  171.  
  172.     if(!hard_InitMouse())                             // Check the mouse driver
  173.     {
  174.         if(!opc_Verify(NULL, ERROR, 0, ERROR_MOUSE))
  175.         {
  176.             disp_Close();                             // Close down the display interface
  177.             exit(1);
  178.             return(1);
  179.         }
  180.     }
  181.     else
  182.         sedwin_MouseInit();                           // Turn on the mouse
  183.  
  184.     if((colors == CO_COLOR) & (disp_GetColors() <= 2L))            // Map colors for 2 color video modes
  185.     {
  186.         disp_MapMono(TRUE);
  187.         colors = BW_COLOR;
  188.     }
  189. //////////////////
  190. //colors = BW_COLOR;
  191. //
  192. // create the windows 0 -- Title -------------------------------------------------------------------
  193.  
  194.     menu_0 = menu_Open();
  195.     menu_Printf(menu_0, WINDOW_0, NULL);
  196.  
  197.     window_0 = sed_Open(menu_0);
  198.     switch(colors)
  199.     {
  200.         case BW_COLOR:                                          // Monochrome
  201.             sed_SetColors(window_0, WHITE_BLACK, WHITE_BLACK, WHITE_BLUE);
  202.             break;
  203.         case SVGA_COLOR:                                        // Super VGA
  204.             sed_SetColors(window_0, RED_WHITE, RED_WHITE, WHITE_RED);
  205.             break;
  206.         default:
  207.         case CO_COLOR:                                          // Graphics
  208.             sed_SetColors(window_0, RED_WHITE, RED_WHITE, WHITE_RED);
  209.             break;
  210.     }
  211.  
  212.     sed_SetBorderFeature(window_0, BD_TOP);
  213.     sed_SetPosition(window_0, 2, 16);
  214.     sed_SetHeight(window_0, 1);
  215.     sed_SetWidth(window_0, 50);
  216.     sed_SetShadow(window_0, 0);
  217.  
  218. // create the windows 5 ----------------------------------------------------------------------------
  219.  
  220.     menu_5 = menu_Open();
  221.     menu_Printf(menu_5, WINDOW_5_1, NULL);
  222.     menu_Printf(menu_5, WINDOW_5_2, NULL);
  223.     menu_Printf(menu_5, WINDOW_5_3, NULL);
  224.     menu_Printf(menu_5, WINDOW_5_4, NULL);
  225.     menu_Printf(menu_5, WINDOW_5_5, NULL);
  226.  
  227.     window_5 = sed_Open(menu_5);
  228.     switch(colors)
  229.     {
  230.         case BW_COLOR:                                              // Monochrome
  231.             sed_SetColors(window_5, BLACK_WHITE, WHITE_BLACK, WHITE_BLUE);
  232.             break;
  233.         case SVGA_COLOR:                                            // Super VGA
  234.             sed_SetColors(window_5, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  235.             break;
  236.         default:
  237.         case CO_COLOR:                                              // Graphics
  238.             sed_SetColors(window_5, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  239.             break;
  240.     }
  241.  
  242.     sed_SetBorder(window_5, bd_cua);
  243.     sed_SetBorderFeature(window_5, BD_OUTLINE | BD_PROMPT | BD_TOP);
  244.     sed_SetPosition(window_5, 21, 11);
  245.     sed_SetHeight(window_5, 6);
  246.     sed_SetWidth(window_5, 58);
  247.     sed_SetShadow(window_5, 0);
  248.  
  249. // -------------------------------------------------------------------------------------------------
  250.  
  251.     sed_Repaint(window_0);
  252.     sed_Repaint(window_5);
  253.  
  254. // #########     Main loop Start     ##########
  255.  
  256. // create the windows 1 -- check source drive and directory ---------------------------------------------------------------
  257.  
  258. Reinstall:
  259.  
  260.     while(1)
  261.     {
  262.         menu_1 = menu_Open();
  263.  
  264.         menu_Printf(menu_1, WINDOW_s_1, dir_org, &string_funcs, WINDOW_1_2);
  265.         menu_Printf(menu_1, MENU_0_OK, NULL, &gmenu_funcs, MENU_0_OK_H, OKAY_STR);
  266.         menu_Printf(menu_1, MENU_0_CA, NULL, &gmenu_funcs, MENU_0_CA_H, CANCEL_STR);
  267.  
  268.         window_1 = sed_Open(menu_1);
  269.         switch(colors)
  270.         {
  271.             case BW_COLOR:                                                  // Monochrome
  272.                 sed_SetColors(window_1, BLACK_WHITE, WHITE_BLACK, WHITE_BLACK);
  273.                 break;
  274.             case SVGA_COLOR:                                                // Super VGA
  275.                 sed_SetColors(window_1, BLACK_BROWN, BROWN_BLACK, BLACK_WHITE);
  276.                 break;
  277.             default:
  278.             case CO_COLOR:                                                  // Graphics
  279.                 sed_SetColors(window_1, YELLOW_BLACK, YELLOW_GRAY, BLACK_YELLOW);
  280.                 break;
  281.         }
  282.  
  283.         sed_SetBorder(window_1, bd_cua);
  284.         sed_SetBorderFeature(window_1, BD_TITLE | BD_OUTLINE | BD_TOP | BD_PROMPT | BD_MOVE);
  285.         sed_SetBorderTitle(window_1, WINDOW_1_TITLE);
  286.         sed_SetPosition(window_1, 6, 4);
  287.         sed_SetHeight(window_1, 5);
  288.         sed_SetWidth(window_1, 70);
  289.         sed_SetShadow(window_1, 1);
  290.         sed_SetShadowAttr(window_1, BK_COLOR3);
  291.  
  292.         // Attach a mouse handler to the sed
  293.         win_SetMouse(window_1, winmou_All);
  294.         win_SetMouseFeature(window_1, MOUF_TRACK);
  295.  
  296.         sedlist[0] = window_1;
  297.         sed_SetSpecial(window_1, spc_Jump);
  298.         sed_SetAux(window_1, aux_Top);
  299.  
  300.         sed_Repaint(window_1);
  301.         if(sed_Go(window_1) == CANCEL)
  302.         {
  303.             sed_Close(window_1);
  304.             EndDisplay();             // quit = TRUE;
  305.         }
  306.         sed_Close(window_1);
  307.  
  308. // to fix ptr #217 in BJ v3.6.  If the source drive is invalid (meaning there is
  309. // no disk in drive A or B), now it pops up a message instead of letting DOS show
  310. // its own error message (that ABORT, RETRY, FAIL message).  SK; 4/30/96
  311.         _harderr(myhandler); 
  312.         if(_chdrive(current_drive=(toupper(dir_org[0])-0x40)) == FILE_ERROR)
  313.             opc_Prompt(NULL, ERROR, 0, ERROR_DRIVE);
  314.         else
  315.         {
  316. //            _chdir(dir_org);
  317.  
  318. // to fix ptr #218 in BJ v3.6.  If the source directory is invalid, now it pops 
  319. // a message indicating that the source directory is invalid.  SK; 4/29/96  
  320.               if (_chdir(dir_org) != 0)
  321.               {
  322.                 opc_Prompt(NULL, ERROR, 0, ERROR_DIR);
  323.               }                
  324.               else 
  325.               {
  326.                 _searchenv(search_file,".",dir_tmp);
  327.                 if(*dir_tmp == (byte)NULL)
  328.                     opc_Prompt(NULL, ERROR, 0, ERROR_FILE8);
  329.                 else
  330.                     break;
  331.             }
  332.         }   
  333.     }
  334.  
  335.     if(tmp_drive)
  336.         system("copy bjl.bin c:\\bjl.exe");
  337.     else
  338.         system("copy bjl.bin a:\\bjl.exe");
  339.  
  340. // -------------------------------------------------------------------------------------------------
  341.  
  342.     while(1)
  343.     {
  344.  
  345. Retry:
  346.         disp_Repaint();
  347.  
  348. // create the windows 1 -- Installer ---------------------------------------------------------------
  349.  
  350.         menu_1 = menu_Open();
  351.  
  352.         menu_Printf(menu_1, WINDOW_1_1, dir, &string_funcs, WINDOW_1_2);
  353.         menu_Printf(menu_1, MENU_0_OK, NULL, &gmenu_funcs, MENU_0_OK_H, OKAY_STR);
  354.         menu_Printf(menu_1, MENU_0_CA, NULL, &gmenu_funcs, MENU_0_CA_H, CANCEL_STR);
  355.  
  356.         window_1 = sed_Open(menu_1);
  357.         switch(colors)
  358.         {
  359.             case BW_COLOR:                                              // Monochrome
  360.                 sed_SetColors(window_1, BLACK_WHITE, WHITE_BLACK, WHITE_BLACK);
  361.                 break;
  362.             case SVGA_COLOR:                                            // Super VGA
  363.                 sed_SetColors(window_1, BLACK_CYAN, CYAN_BLACK, BLACK_WHITE);
  364.                 break;
  365.             default:
  366.             case CO_COLOR:                                              // Graphics
  367.                 sed_SetColors(window_1, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
  368.                 break;
  369.         }
  370.  
  371.         sed_SetBorder(window_1, bd_cua);
  372.         sed_SetBorderFeature(window_1, BD_TITLE | BD_OUTLINE | BD_TOP | BD_PROMPT | BD_MOVE);
  373.         sed_SetBorderTitle(window_1, WINDOW_1_TITLE);
  374.         sed_SetPosition(window_1, 6, 4);
  375.         sed_SetHeight(window_1, 5);
  376.         sed_SetWidth(window_1, 70);
  377.         sed_SetShadow(window_1, 1);
  378.         sed_SetShadowAttr(window_1, BK_COLOR3);
  379.  
  380.         // Attach a mouse handler to the sed
  381.         win_SetMouse(window_1, winmou_All);
  382.         win_SetMouseFeature(window_1, MOUF_TRACK);
  383.  
  384. // -------------------------------------------------------------------------------------------------
  385.  
  386.         sedlist[0] = window_1;
  387.         sed_SetSpecial(window_1, spc_Jump);
  388.         sed_SetAux(window_1, aux_Top);
  389.  
  390.         sed_Repaint(window_1);
  391.         if(sed_Go(window_1) == CANCEL)
  392.         {
  393.             sed_Close(window_1);
  394.             _close(fh);
  395.             _chdrive(toupper(dir[0])-0x40);
  396.             _chdir(dir);
  397.             system("cd ..");
  398.             _rmdir(dir);
  399.             if(tmp_drive)
  400.                 system("del c:\\bjl.exe");
  401.             else
  402.                 system("del a:\\bjl.exe");
  403.             EndDisplay();             // quit = TRUE;
  404.         }
  405.         sed_Close(window_1);
  406.  
  407. // create the windows 1 -- Make dir ---------------------------------------------------------------
  408.  
  409.         for(i=0;dir[i]>' ';i++);
  410.         dir[i] = (byte)NULL;
  411.  
  412.         switch(i)
  413.         {
  414.             case 0:
  415.             case 1:
  416.                 opc_Prompt(NULL, ERROR, 0, ERROR_DRIVE);
  417.                 goto Retry;
  418.             case 2:
  419.                 if( dir[1] == ':')
  420.                 {
  421.                     dir[2] = '\\';
  422.                     dir[3] = (byte)NULL;
  423.                     ++i;
  424.                 }
  425.                 else
  426.                 {
  427.                     opc_Prompt(NULL, ERROR, 0, ERROR_DRIVE);
  428.                     goto Retry;
  429.                 }
  430.                 break;
  431.         }
  432.  
  433.         if(_chdrive(toupper(dir[0])-0x40) == FILE_ERROR)
  434.         {
  435.             opc_Prompt(NULL, ERROR, 0, ERROR_DRIVE);
  436.             goto Retry;
  437.         }
  438.  
  439.         system("cd \\");
  440.         if(_chdir(dir) == FILE_ERROR)
  441.         {
  442.             menu_1 = menu_Open();
  443.  
  444.             menu_Printf(menu_1, WINDOW_1_3);
  445.             menu_Printf(menu_1, MENU_1_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
  446.             menu_Printf(menu_1, MENU_1_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
  447.  
  448.             window_1 = sed_Open(menu_1);
  449.             switch(colors)
  450.             {
  451.                 case BW_COLOR:                                              // Monochrome
  452.                     sed_SetColors(window_1, BLACK_WHITE, BLACK_WHITE, WHITE_BLACK);
  453.                     break;
  454.                 case SVGA_COLOR:                                            // Super VGA
  455.                     sed_SetColors(window_1, BLACK_CYAN, CYAN_BLACK, BLACK_WHITE);
  456.                     break;
  457.                 default:
  458.                 case CO_COLOR:                                              // Graphics
  459.                     sed_SetColors(window_1, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
  460.                     break;
  461.             }
  462.  
  463.             sed_SetBorder(window_1, bd_cua);
  464.             sed_SetBorderFeature(window_1, BD_OUTLINE | BD_TOP | BD_PROMPT | BD_MOVE);
  465.             sed_SetPosition(window_1, 6, 18);
  466.             sed_SetHeight(window_1, 4);
  467.             sed_SetWidth(window_1, 42);
  468.             sed_SetShadow(window_1, 1);
  469.             sed_SetShadowAttr(window_1, BK_COLOR3);
  470.  
  471.             // Attach a mouse handler to the sed
  472.             win_SetMouse(window_1, winmou_All);
  473.             win_SetMouseFeature(window_1, MOUF_TRACK);
  474.  
  475. // -------------------------------------------------------------------------------------------------
  476.  
  477.             sedlist[0] = window_1;
  478.             sed_SetSpecial(window_1, spc_Jump);
  479.             sed_SetAux(window_1, aux_Top);
  480.  
  481.             sed_Repaint(window_1);
  482.             if(sed_Go(window_1) == CANCEL)
  483.             {
  484.                 sed_Close(window_1);
  485.                 _chdrive(toupper(dir[0])-0x40);
  486.                 _chdir(dir);
  487.                 system("cd ..");
  488.                 _rmdir(dir);
  489.                 goto Retry;
  490.             }
  491.             sed_Close(window_1);
  492.  
  493.             if(_mkdir(dir) == FILE_ERROR)
  494.             {
  495. //                opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
  496.                 opc_Prompt(NULL, ERROR, 0, ERROR_DIR);     // SK, 5/22/96 - to fix ptr#241 in BJ V3.6
  497.                 goto Retry;
  498.             }
  499.             else
  500.                 _chdir(dir);
  501.         }
  502.  
  503.         if(colors == SVGA_COLOR)
  504.         {
  505.             memcpy(monitor_ng, "monitor\n", 8);
  506.             memcpy(monitor_ng+8, dir, i);
  507.             i = i+8;
  508.         }
  509.         else
  510.         {
  511.             monitor_ng[0] = (byte)NULL;
  512.             memcpy(monitor_ng, dir, i);
  513.         }
  514. //
  515.         _close(fh);
  516.         remove(INI_FILE);
  517.  
  518.         if((fh = _open(INI_FILE, _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE)) == FILE_ERROR)
  519.         {
  520.             opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
  521.             disp_Close();                                // Close down the display interface
  522.             exit(1);
  523.             return(1);
  524.         }
  525.  
  526.         if(_write(fh, monitor_ng, i) == FILE_ERROR)
  527.         {
  528.             opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
  529.             _close(fh);
  530.             goto Retry;
  531.         }
  532.         _close(fh);
  533.  
  534.         if(tmp_drive)
  535.             system("copy c:\\bjl.exe .");
  536.         else
  537.             system("copy a:\\bjl.exe .");
  538.  
  539.         disp_Repaint();
  540.  
  541.         if((fh = _open("bjl.exe", _O_RDONLY)) == FILE_ERROR)
  542.         {
  543.             opc_Prompt(NULL, ERROR, 0, ERROR_FILE7);
  544.             system("cd ..");
  545.             _rmdir(dir);
  546.             _close(fh);
  547.         }
  548.         else
  549.             break;
  550.     }
  551.     _close(fh);
  552.  
  553.     system("echo off");
  554.     disp_Repaint();
  555.     remove("bjsetup.exe");
  556.     remove("bjsetup.hlp");
  557.     remove("bjsetup1.hlp");
  558.     remove("bjsetup2.hlp");
  559.     remove("bjsetup3.hlp");
  560.     remove("bjsetup4.hlp");
  561.     remove("bjsetup5.hlp");
  562.     remove("bjsetup6.hlp");
  563.     remove("bjsetup7.hlp");   // sk, 5/15/96 - new help file for B380IF
  564.     remove("bjsetup.ini");
  565.     disp_Repaint();
  566.     hard_Pause(200);
  567.     system("bjl");
  568.     disp_Repaint();
  569.     remove("bjl.exe");
  570.     if(tmp_drive)
  571.         system("del c:\\bjl.exe");
  572.     else
  573.         system("del a:\\bjl.exe");
  574.     system("echo on");
  575.  
  576.     disp_Repaint();
  577.     if((fh = _open("bjsetup.exe", _O_RDONLY)) == FILE_ERROR)
  578.     {
  579.         opc_Prompt(NULL, ERROR, 0, ERROR_FILE7);
  580.         system("cd ..");
  581.         _rmdir(dir);
  582.         _close(fh);
  583.  
  584.         disp_Repaint();
  585.         goto Reinstall;
  586.     }
  587.     _close(fh);
  588.     if((fh = _open("bjsetup.ini", _O_RDONLY)) == FILE_ERROR)
  589.     {
  590.         opc_Prompt(NULL, ERROR, 0, ERROR_FILE7);
  591.         system("cd ..");
  592.         _rmdir(dir);
  593.         _close(fh);
  594.  
  595.         disp_Repaint();
  596.         goto Reinstall;
  597.     }
  598.     _close(fh);
  599.  
  600. // create the windows 1 -- Success Display -------------------------------------------------------------
  601.  
  602.     disp_Repaint();
  603.  
  604.     menu_1 = menu_Open();
  605.  
  606.     menu_Printf(menu_1, WINDOW_2_1);
  607.     menu_Printf(menu_1, MENU_2_OK, NULL, &menu_funcs);
  608.  
  609.     window_1 = sed_Open(menu_1);
  610.     switch(colors)
  611.     {
  612.         case BW_COLOR:                                              // Monochrome
  613.             sed_SetColors(window_1, BLACK_WHITE, BLACK_WHITE, WHITE_BLACK);
  614.             break;
  615.         case SVGA_COLOR:                                            // Super VGA
  616.             sed_SetColors(window_1, GREEN_WHITE, GREEN_BLACK, BLACK_WHITE);
  617.             break;
  618.         default:
  619.         case CO_COLOR:                                              // Graphics
  620.             sed_SetColors(window_1, GREEN_BLACK, GREEN_GRAY, BLACK_GREEN);
  621.             break;
  622.     }
  623.  
  624.     sed_SetBorder(window_1, bd_cua);
  625.     sed_SetBorderFeature(window_1, BD_OUTLINE | BD_TOP | BD_PROMPT | BD_MOVE);
  626.     sed_SetPosition(window_1, 6, 22);
  627.     sed_SetHeight(window_1, 4);
  628.     sed_SetWidth(window_1, 34);
  629.     sed_SetShadow(window_1, 1);
  630.     sed_SetShadowAttr(window_1, BK_COLOR3);
  631.  
  632.     // Attach a mouse handler to the sed
  633.     win_SetMouse(window_1, winmou_All);
  634.     win_SetMouseFeature(window_1, MOUF_TRACK);
  635.  
  636.     sed_Repaint(window_1);
  637.     sed_Go(window_1);
  638.     sed_Close(window_1);
  639.  
  640. // #########     Main loop End     ##########
  641.  
  642.     EndDisplay();
  643. }
  644.  
  645. // ***********************************************************************
  646. //  function name   : int EndDisplay(void)
  647. //  function        : Exit this program
  648. //  input           : void
  649. //  output          : 0
  650. // ***********************************************************************
  651. int EndDisplay()
  652. {
  653.     sed_Close(window_0);                // close the windows
  654.     sed_Close(window_5);
  655.  
  656.     win_Close(disp_GetBackWin());       // Close the background window
  657.     disp_SetAttr(WHITE_BLACK);
  658.     disp_Repaint();
  659.  
  660.     disp_Close();                       // shut down the display
  661.     
  662.     _chdrive(olddrive);                    // change drive back to the original saved at the beginning; SK 4/30/96
  663.     _chdir(path);                        // change path back to the original; SK 4/30/96
  664.     exit(0);
  665.     return(0);
  666. }
  667.  
  668. // ***********************************************************************
  669. //  function name   : boolean spc_Jump(sed_type sed, int scancode)
  670. //  function        : Tab key's jump next window
  671. //  input           : sed_type         sed
  672. //                  : int             scancode
  673. //  output          : TRUE
  674. //                  : FALSE
  675. // ***********************************************************************
  676. boolean spc_Jump(sed_type sed, int scancode)
  677. {
  678.     switch(scancode)
  679.     {
  680.         case TAB:
  681.             if(sed_GetFieldNo(sed_GetWin(sedlist[0])) == 2)
  682.                 sed_GotoFirstField(sed_GetWin(sedlist[0]));
  683.             else
  684.                 sed_IncField(sed_GetWin(sedlist[0]));
  685.             return(TRUE);
  686.  
  687.         case SHFT_TAB:
  688.             if(sed_GetFieldNo(sed_GetWin(sedlist[0])) == 0)
  689.                 sed_GotoLastField(sed_GetWin(sedlist[0]));
  690.             else
  691.                 sed_DecField(sed_GetWin(sedlist[0]));
  692.             return(TRUE);
  693.  
  694. // ---------------------------------------------------------------------------------
  695.  
  696.         case MOU_NOFIELD:
  697.             return(TRUE);            // Keep mouse events from exiting program
  698.  
  699.         case ESC:
  700.             sed_GotoLastField(sed_GetWin(sedlist[0]));
  701.             kb_Stuff(ENTER);
  702.             return(TRUE);
  703.  
  704.     }
  705.     return(FALSE);
  706. }
  707.