home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / MSC_WIND.ZIP / WINDOWS.DOC < prev    next >
Encoding:
Text File  |  1987-12-06  |  6.9 KB  |  213 lines

  1.                      WINDOWS FOR MICROSOFT C
  2.  
  3.                           INTRODUCTION
  4.  
  5.     These routines were written using Microsoft C version 5.00 to 
  6. implement text windows on the IBM (or compatible) monochrome 
  7. adapter, color graphics adapter, or EGA adapter (they have not 
  8. been tested in a VGA environment).  The routines make use of the 
  9. graphics routines in the newest version of Microsoft C.  All 
  10. required function declarations, include statements, and global 
  11. variable definitions are contained in the windows.h file.  
  12.  
  13. NOTE:  The set_text_mode routine must be called before any other 
  14. routine in this library.  This routine automatically configures 
  15. your program to address either the monochrome or color adapter 
  16. (whichever is present).
  17.  
  18.     Feel free to use these routines whenever and wherever.  If you have
  19. any comments, corrections, or suggestions, contact me here under
  20. user-id 75216.2063.
  21.  
  22. ANDY ECKHARDT
  23.  
  24.  
  25.                      USE OF WINDOW ROUTINES
  26.  
  27.     Using the file placement scheme recommended by Microsoft, the 
  28. files required for linking in these routines should be placed as 
  29. follows:
  30.  
  31.                File                          Library
  32.  
  33.             windows.h                       \include
  34.             windows.lib                     \lib
  35.  
  36.  
  37.     Linking these routines is accomplished with the following 
  38. command:
  39.  
  40.             cl yourpgm /link windows
  41.  
  42.  
  43.                      LIMITATIONS AND CHANGES
  44.  
  45.      These routines can only be used for text output to the 
  46. windows created.  THEY WILL NOT WORK FOR GRAPHICS OUTPUT.
  47.  
  48. The set_text_mode routine must be called before any other routine 
  49. in this library.  This routine automatically configures your 
  50. program to address either the monochrome or color adapter 
  51. (whichever is present).
  52.  
  53.      The maximum number of windows is preset to 15.  In order to 
  54. change this to another value, change the MAX_WINDOW_NUMBER 
  55. definition in windows.h.  The value used should be the number of 
  56. windows required + 1 (the first window saved is always the screen 
  57. before any windows are drawn).
  58.  
  59.      Keep in mind that drawing a window with a border actually 
  60. uses 2 of the available windows.  The resulting window space 
  61. available for output will be 4 columns and 2 rows smaller than 
  62. the corner values specified in the makebxwindow routine.  This 
  63. allows the window output to scroll normally without erasing the 
  64. border.
  65.  
  66.      If used with a monochrome monitor, the windows and borders 
  67. will automatically be set to white on black.  The makewindow() 
  68. routine can be changed to the desired colors if this is not 
  69. acceptable.
  70.  
  71.  
  72. __________________________________________________________________
  73.  
  74.                          WINDOW ROUTINES
  75.  
  76. __________________________________________________________________
  77.  
  78. void set_text_mode()
  79.  
  80.     This routine automatically selects the highest video 
  81. operating mode and configures the program to use either 
  82. monochrome or color when creating windows.  
  83.  
  84. NOTES:
  85.  
  86. The mode selected by this routine will be stored in the global 
  87. variable video_mode_set which can be interrogated by your 
  88. program.  This is a short type with one of the values shown for 
  89. text modes in the graph.h header file.
  90.  
  91. EXAMPLE:
  92.  
  93.     #include <graph.h>
  94.     #include <windows.h>
  95.  
  96.     main()
  97.       {
  98.       set_text_mode();
  99.       }
  100. __________________________________________________________________
  101.  
  102. int makebxwindow(up_row,up_col,down_row,down_col,fore_color,
  103.   back_color,border_fore,border_back)
  104.   short up_row           /*upper left row of window*/
  105.   short up_col           /*upper left column of window*/
  106.   short down_row         /*lower right row of window*/
  107.   short down_col         /*lower right column of window*/
  108.   short fore_color       /*text color for window output*/
  109.   short back_color       /*background color for window output*/
  110.   short border_fore      /*color of double lines in the border*/
  111.   short border_back      /*background color of the border*/
  112.  
  113.  
  114.     This routine creates a window with a double-lined border 
  115. around it.  The window area available for output will be 2 rows 
  116. and 4 columns smaller than the upper-left and lower-right corner 
  117. values specified.  This allows output to the window to scroll 
  118. without erasing the border.  When used with a monochrome monitor, 
  119. the border will be white and the background will be black.
  120.  
  121. NOTES:  Keep in mind that this routine takes 2 of the available 
  122. screens.  When erasing a boxed window, you must either call 
  123. unmakebxwindow() once or unmakewindow() twice.
  124.  
  125. RETURN VALUES:  This routine will edit the upper_left and 
  126. lower_right corner values used in the call to ensure there is 
  127. room for the window and that the window is properly configured.  
  128. A return value of 0 indicates these edits were not passed and the 
  129. window was not created.  A return value of 1 indicates successful 
  130. completion.
  131.  
  132. EXAMPLE:
  133.  
  134.  
  135.     #include <graph.h>
  136.     #include <windows.h>
  137.  
  138.     main()
  139.       {
  140.       makebxwindow(5,5,20,60,YELLOW,BLACK,RED,BLUE);
  141.       }
  142.  
  143. __________________________________________________________________
  144.  
  145.  
  146. int makewindow(up_row,up_col,down_row,down_col,fore_color,
  147.   back_color)
  148.   short up_row           /*upper left row of window*/
  149.   short up_col           /*upper left column of window*/
  150.   short down_row         /*lower right row of window*/
  151.   short down_col         /*lower right column of window*/
  152.   short fore_color       /*text color for window output*/
  153.   short back_color       /*background color for window output*/
  154.  
  155.     This routine creates a window with no border around it.  The 
  156. window area available for output will be the upper-left and 
  157. lower-right corner values specified.  When used with a monochrome 
  158. monitor, the text will be white and the background will be black.
  159.  
  160. NOTES:  Use the unmakewindow() routine to erase the window 
  161. created.
  162.  
  163. RETURN VALUES:  This routine will edit the upper_left and 
  164. lower_right corner values used in the call to ensure there is 
  165. room for the window and that the window is properly configured.  
  166. A return value of 0 indicates these edits were not passed and the 
  167. window was not created.  A return value of 1 indicates successful 
  168. completion.
  169.  
  170. EXAMPLE:
  171.  
  172.  
  173.     #include <graph.h>
  174.     #include <windows.h>
  175.  
  176.     main()
  177.       {
  178.       makewindow(5,5,20,60,YELLOW,BLACK);
  179.       }
  180.  
  181. __________________________________________________________________
  182.  
  183. void unmakebxwindow()
  184.  
  185.     This routine erases a boxed window and restores the screen to 
  186. its condition prior to the box being drawn.
  187.  
  188. EXAMPLE:
  189.   
  190.     #include <graph.h>
  191.     #include <windows.h>
  192.  
  193.     main()
  194.       {
  195.       unmakebxwindow();
  196.       }
  197. __________________________________________________________________
  198.  
  199. void unmakewindow()
  200.  
  201.     This routine erases an unboxed window and restores the screen 
  202. to its condition prior to the box being drawn.
  203.  
  204. EXAMPLE:
  205.   
  206.     #include <graph.h>
  207.     #include <windows.h>
  208.  
  209.     main()
  210.       {
  211.       unmakewindow();
  212.       }
  213.