home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / textview / docs / textview.prn < prev    next >
Encoding:
Text File  |  1991-06-16  |  149.0 KB  |  2,752 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                                        The
  18.                                        The
  19.                                        The
  20.                                      TextView
  21.                                      TextView
  22.                                      TextView
  23.                                        DLL
  24.                                        DLL
  25.                                        DLL
  26.  
  27.  
  28.                                    Version 1.00
  29.                                    Version 1.00
  30.                                    Version 1.00
  31.  
  32.  
  33.  
  34.                                  The TextView DLL
  35.                                  The TextView DLL
  36.                                  The TextView DLL
  37.  
  38.  
  39.        I
  40.        I
  41.        INTRODUCTION TO 
  42.         NTRODUCTION TO 
  43.         NTRODUCTION TO T
  44.                        T
  45.                        TEXT
  46.                         EXT
  47.                         EXTV
  48.                            V
  49.                            VIEW
  50.                             IEW
  51.                             IEW
  52.  
  53.  
  54.        Thank you for using the  TextView
  55.                                 TextView
  56.                                 TextView system. The author  hopes that it
  57.        will prove to be a powerful and useful tool to Windows applications
  58.        writers, providing  a facility  that is  both useful  in  the final
  59.        application, and helpful in the development phase.
  60.  
  61.        This manual covers all aspects  of the system. It  assumes that you
  62.        are  an   experienced  Windows   application  developer,   and  are
  63.        conversant with the use of the Windows API.
  64.  
  65.        The author is always interested  to hear any reports  about how you
  66.        find TextView,  what  further  facilities  you  would  like  it  to
  67.        include, and  any  problems you  may  find when  using  it. Contact
  68.        addresses are given later in this manual.
  69.  
  70.  
  71.           What is TextView?
  72.           What is TextView?
  73.           What is TextView?
  74.  
  75.           TextView
  76.           TextView
  77.           TextView is a system that provides  a Windows 3 application with
  78.           the ability to write lines of text to  a window with the minimum
  79.           of effort.   TextView
  80.                        TextView
  81.                        TextView itself  handles  all  the  many  operations
  82.           needed to manage the  window displaying the text;  you need only
  83.           call the function that writes the text,  in exactly the same way
  84.           as you would call printf
  85.                             printf
  86.                             printf in a DOS application.
  87.  
  88.           You can create as many  TextView
  89.                                   TextView
  90.                                   TextView windows as you require, and  all
  91.           will operate independently.  TextView
  92.                                        TextView
  93.                                        TextView windows can  be resized by
  94.           the user,  minimized,  maximized and  scrolled  horizontally and
  95.           vertically with no work needed by the application. They can also
  96.           have  File menus  that  notify  the  application  when the  user
  97.           requests that the window contents be written to disk.
  98.  
  99.           TextView
  100.           TextView
  101.           TextView windows can, of course, be used for an infinite variety
  102.           of purposes. One possibility is to use TextView
  103.                                                  TextView
  104.                                                  TextView to provide a way
  105.           of outputting tracing and debugging  information when developing
  106.           an application. Included with  the system are the  sources for a
  107.           demonstration application that contain a flexible tracing system
  108.           that may be incorporated into your own code.
  109.  
  110.           TextView
  111.           TextView
  112.           TextView is supplied as a  Dynamic Link Library  or DLL. In this
  113.           form it is not added to the application's code at link time, but
  114.           instead is  bound  to  it  dynamically  by Windows  whenever  an
  115.           application needing it  is run. All  applications using  TextView
  116.                                                                    TextView
  117.                                                                    TextView
  118.           will share the same  code segments, making it  very efficient in
  119.           memory utilisation.
  120.  
  121.  
  122.           What you need to use TextView
  123.           What you need to use TextView
  124.           What you need to use TextView
  125.  
  126.           In order  to  use  TextView
  127.                              TextView
  128.                              TextView you  will  need to  have  a  suitable
  129.           compiler that can generate  Windows 3 code, such  as Microsoft C
  130.           6.0. The TextView
  131.                    TextView
  132.                    TextView functions follow the same conventions  as used
  133.           in the Windows API,  and their descriptions later  in this guide
  134.           use the  same layout  as in  the Microsoft  Windows Programmer's
  135.           Reference.
  136.  
  137.  
  138.                                       Page 
  139.                                       Page 
  140.                                       Page 1
  141.                                            1
  142.                                            1
  143.  
  144.  
  145.  
  146.                                  The TextView DLL
  147.                                  The TextView DLL
  148.                                  The TextView DLL
  149.  
  150.  
  151.           Distribution and Use of TextView
  152.           Distribution and Use of TextView
  153.           Distribution and Use of TextView
  154.  
  155.           TextView
  156.           TextView
  157.           TextView is Copyright (c)  Alan Phillips 1991. It  may be freely
  158.           distributed by anyone,  to anyone.  Apart from  reasonable media
  159.           and  handling   costs,  no   charge  may   be  levied   for  its
  160.           distribution. It  may be  stored on  Bulletin Board  systems and
  161.           other archives so long as all  the files comprising the original
  162.           distribution are  included. It  may  be repackaged  to  suit the
  163.           storage conventions in use for the  system concerned. It may not
  164.           be distributed as part of commercial  disk libraries without the
  165.           prior agreement of the author.
  166.  
  167.           TextView
  168.           TextView
  169.           TextView may  be  freely  used  in  any  non-commercial  Windows
  170.           application.  Authors  of  such  applications  may  include  the
  171.           TextView
  172.           TextView
  173.           TextView DLL with the products either  with or without the other
  174.           files  comprising  the  full  distribution  set.  However,  such
  175.           application should  include  in their  documentation  (or should
  176.           display in their About dialog box or in their  online help) that
  177.           they are using TextView
  178.                          TextView
  179.                          TextView, and should list the author's copyright.
  180.  
  181.           The demonstration sources  supplied with  TextView
  182.                                                     TextView
  183.                                                     TextView may be  freely
  184.           adapted and included in other applications as required.
  185.  
  186.           Authors of ShareWare or commercial products may not use  TextView
  187.                                                                    TextView
  188.                                                                    TextView
  189.           without the author's written permission.
  190.  
  191.  
  192.           Disclaimer
  193.           Disclaimer
  194.           Disclaimer
  195.  
  196.           TextView
  197.           TextView
  198.           TextView is  distributed  on an  as is  basis.  No  guarantee is
  199.           offered,  and   none  should   be  inferred,   of   its  correct
  200.           functionality, nor of  its suitability for  any task whatsoever.
  201.           The  author  accepts  no  liability  for   any  loss  or  damage
  202.           whatsoever caused  as  a  result  of  using   TextView
  203.                                                         TextView
  204.                                                         TextView  with  any
  205.           application, whether written by the user or a third party.
  206.  
  207.           TextView
  208.           TextView
  209.           TextView is  written  as  a  private  activity  by  the  author,
  210.           unconnected in any way with his  employment at the University of
  211.           Lancaster.
  212.  
  213.  
  214.           Contacting the Author
  215.           Contacting the Author
  216.           Contacting the Author
  217.  
  218.           The author may be  contacted c/o  The Computer Centre,  Lancaster
  219.                                             The Computer Centre,  Lancaster
  220.                                             The Computer Centre,  Lancaster
  221.           University, Lancaster LA1  4YW, United Kingdom
  222.           University, Lancaster LA1  4YW, United Kingdom
  223.           University, Lancaster LA1  4YW, United Kingdom . Electronic mail
  224.           may be addressed to one of the following addresses:
  225.  
  226.                  alan@uk.ac.lancaster
  227.                  alan@uk.ac.lancaster
  228.                  alan@uk.ac.lancaster     JANET network
  229.                                           JANET network
  230.                                           JANET network
  231.                  alan@lancaster.ac.uk
  232.                  alan@lancaster.ac.uk
  233.                  alan@lancaster.ac.uk     Internet or BITNET
  234.                                           Internet or BITNET
  235.                                           Internet or BITNET
  236.                  alan%uk.ac.lancaster@ukc
  237.                  alan%uk.ac.lancaster@ukc
  238.                  alan%uk.ac.lancaster@ukc UUCP network
  239.                                           UUCP network
  240.                                           UUCP network
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.                                       Page 
  251.                                       Page 
  252.                                       Page 2
  253.                                            2
  254.                                            2
  255.  
  256.  
  257.  
  258.                                  The TextView DLL
  259.                                  The TextView DLL
  260.                                  The TextView DLL
  261.  
  262.  
  263.        I
  264.        I
  265.        INSTALLING 
  266.         NSTALLING 
  267.         NSTALLING T
  268.                   T
  269.                   TEXT
  270.                    EXT
  271.                    EXTV
  272.                       V
  273.                       VIEW
  274.                        IEW
  275.                        IEW
  276.  
  277.  
  278.        There are three components to the  TextView
  279.                                           TextView
  280.                                           TextView system. The DLL itself,
  281.        textview.dll
  282.        textview.dll
  283.        textview.dll, should  be  copied  to  your  Windows directory.  The
  284.        model-independent import library  textview.lib
  285.                                          textview.lib
  286.                                          textview.lib should be  copied to
  287.        one of the directories named in your LIB
  288.                                             LIB
  289.                                             LIB environment variable - the
  290.        directory containing your Windows SDK libraries  or your C compiler
  291.        libraries would normally  be suitable.  The header  file  textview.h
  292.                                                                  textview.h
  293.                                                                  textview.h
  294.        should be copied  to one of  the directories named  in your  INCLUDE
  295.                                                                     INCLUDE
  296.                                                                     INCLUDE
  297.        environment variable  -  the  directory  containing your   windows.h
  298.                                                                   windows.h
  299.                                                                   windows.h
  300.        header file would be suitable.
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.                                       Page 
  349.                                       Page 
  350.                                       Page 3
  351.                                            3
  352.                                            3
  353.  
  354.  
  355.  
  356.                                  The TextView DLL
  357.                                  The TextView DLL
  358.                                  The TextView DLL
  359.  
  360.  
  361.        U
  362.        U
  363.        USING 
  364.         SING 
  365.         SING T
  366.              T
  367.              TEXT
  368.               EXT
  369.               EXTV
  370.                  V
  371.                  VIEW
  372.                   IEW
  373.                   IEW
  374.  
  375.  
  376.        The TextView
  377.            TextView
  378.            TextView DLL extends the Windows API with  a number of specific
  379.        functions, which you call from your  application. All the functions
  380.        have names  beginning  with   TV
  381.                                      TV
  382.                                      TV,  to  avoid  clashes  with  Windows
  383.        functions, those in your application or in other DLLs.
  384.  
  385.        All the functions  use the Pascal  calling convention, and  must be
  386.        declared FAR
  387.                 FAR
  388.                 FAR. Full function prototypes are contained in the include
  389.        file textview.h
  390.             textview.h
  391.             textview.h; including this  in your source  will automatically
  392.        select the right calling mode, and  will also perform any necessary
  393.        casts to far pointers.
  394.  
  395.        You must take two additional steps when building your application:
  396.  
  397.             - Include the TextView
  398.                           TextView
  399.                           TextView import library textview.lib
  400.                                                   textview.lib
  401.                                                   textview.lib in the list
  402.               of libraries that you name for the linker to scan.
  403.  
  404.             - Make  sure  you  declare  sufficient   stack  size  in  your
  405.               application's .DEF
  406.                             .DEF
  407.                             .DEF file. As  a rough  guide, try  increasing
  408.               the size by 2Kbytes over what your application itself uses.
  409.  
  410.        You  must  not  use  the  Windows   LoadLibrary
  411.                                            LoadLibrary
  412.                                            LoadLibrary  and  GetProcAddress
  413.                                                              GetProcAddress
  414.                                                              GetProcAddress
  415.        functions to link  TextView routines  at run-time. This  is because
  416.        some of the  functions are actually  within the import  library and
  417.        must be statically-linked.
  418.  
  419.        The  sections  below   describe  how   to  use   TextView
  420.                                                         TextView
  421.                                                         TextView  in  your
  422.        application. The text assumes that you're familiar with the Windows
  423.        API and with how to program  Windows applications: there is general
  424.        information  on  this  in  the  documentation   supplied  with  the
  425.        Microsoft Windows Software  Developer's Kit,  and in  several other
  426.        published books.
  427.  
  428.        Besides this manual, there is a  comprehensively-commented set of C
  429.        source routines supplied  in the  distribution set. These  show you
  430.        how you can use  TextView
  431.                         TextView
  432.                         TextView to add a  dynamic tracing utility to  your
  433.        application, which provides  you with  a very  powerful development
  434.        aid that enables you to  keep a log of  your application's activity
  435.        that can be scrolled back and consulted when necessary.
  436.  
  437.  
  438.           A Summary of TextView Usage
  439.           A Summary of TextView Usage
  440.           A Summary of TextView Usage
  441.  
  442.           Although  it  offers   your  application   powerful  facilities,
  443.           TextView
  444.           TextView
  445.           TextView's API is very straightforward, and  has been written to
  446.           parallel closely  the way  you use  the Windows  API.  The basic
  447.           concepts of how the system works are these:
  448.  
  449.  
  450.              The TextView Window
  451.              The TextView Window
  452.              The TextView Window
  453.  
  454.              A window created by TextView
  455.                                  TextView
  456.                                  TextView is an ordinary  overlapped window
  457.              that belongs to  your application. Within  certain limits you
  458.              have full control over the appearance  of the window: you can
  459.              allow the user to resize  it or not, supply  it with maximize
  460.              and minimize boxes, and so on.
  461.  
  462.                                       Page 
  463.                                       Page 
  464.                                       Page 4
  465.                                            4
  466.                                            4
  467.  
  468.  
  469.  
  470.                                  The TextView DLL
  471.                                  The TextView DLL
  472.                                  The TextView DLL
  473.  
  474.  
  475.              Creation of a TextView
  476.                            TextView
  477.                            TextView window is done with the  TVCreateWindow
  478.                                                              TVCreateWindow
  479.                                                              TVCreateWindow
  480.              function, which  looks  similar to  the  Windows  CreateWindow
  481.                                                                CreateWindow
  482.                                                                CreateWindow
  483.              function. The major difference is that  for a TextView
  484.                                                            TextView
  485.                                                            TextView window
  486.              the message loop  is handled within  the DLL and  not by your
  487.              application, so that you do not need to concern yourself with
  488.              managing the window. TextView
  489.                                   TextView
  490.                                   TextView will look after aspects such as
  491.              text scrolling on your behalf.
  492.  
  493.              Although your application  does not supply  the message loop,
  494.              it can  still  interact  fully  with  the window.  A  set  of
  495.              functions allow you to test  what state the window  in and to
  496.              change that  state, and  to  destroy the  window  when you've
  497.              finished with it.
  498.  
  499.              If you  choose,  you  can  specify  that  a   TextView
  500.                                                            TextView
  501.                                                            TextView  window
  502.              displays a  File menu with  Save, Save As and  Print options.
  503.              You do not see clicks on these menu items directly, since you
  504.              do not  supply  the message  loop,  but you  can  arrange for
  505.              TextView
  506.              TextView
  507.              TextView to call back  into a routine in  your application to
  508.              notify you when menu items are selected.
  509.  
  510.  
  511.              How Text is Stored
  512.              How Text is Stored
  513.              How Text is Stored
  514.  
  515.              TextView
  516.              TextView
  517.              TextView maintains  the lines  written  to each  window  in a
  518.              cyclic buffer  held  in an  area  of memory  private  to that
  519.              window. Each window operates independently of the others, and
  520.              the only practical limit  to the total amount  of data stored
  521.              will be how much memory your system has available.
  522.  
  523.              When you  create  a  window  by  calling   TVCreateWindow
  524.                                                         TVCreateWindow
  525.                                                         TVCreateWindow  you
  526.              specify the  maximum number  of  lines that  each  window can
  527.              store, up  to  a limit  of  4096 lines.  Specifying  a larger
  528.              number requires TextView
  529.                              TextView
  530.                              TextView to allocate more control  memory for
  531.              the window, so you should not  request a larger capacity that
  532.              you need.
  533.  
  534.              Whenever a line is written, TextView
  535.                                          TextView
  536.                                          TextView stores the contents in
  537.              dynamically-allocated memory. When the window contains the
  538.              specified maximum number of lines, the next to be written
  539.              will replace the oldest line, and so on. A line can be up to
  540.              512 characters long.
  541.  
  542.  
  543.              Scrolling
  544.              Scrolling
  545.              Scrolling
  546.  
  547.              When you create  a  TextView
  548.                                  TextView
  549.                                  TextView window  it will  be in  automatic
  550.              scrolling state.  In this  state  TextView
  551.                                                TextView
  552.                                                TextView will  automatically
  553.              move existing lines of text up  to make room as  new ones are
  554.              written, without your application needing to be aware of what
  555.              is happening. Old  lines, of  course, will disappear  off the
  556.              top of  the window,  but they  will remain  stored  in memory
  557.              until the  window  reaches  its  set  capacity and  they  are
  558.              overwritten with new lines of text.
  559.  
  560.              If the  user wishes  to look  at older  messages that  are no
  561.              longer visible  in the  window, he  can put  the  window into
  562.              manual scrolling  state.  TextView
  563.                                        TextView
  564.                                        TextView will  draw  horizontal and
  565.  
  566.                                       Page 
  567.                                       Page 
  568.                                       Page 5
  569.                                            5
  570.                                            5
  571.  
  572.  
  573.  
  574.                                  The TextView DLL
  575.                                  The TextView DLL
  576.                                  The TextView DLL
  577.  
  578.  
  579.              vertical scroll bars on the window  (you may select either or
  580.              both) and the user may  use them to scroll  around the stored
  581.              text. You can specify when  you create the window  that it is
  582.              to have a Scrolling menu to enable the user  to select manual
  583.              scrolling mode, or you may choose  to control the window from
  584.              your own application using the TVSetScrollMode
  585.                                             TVSetScrollMode
  586.                                             TVSetScrollMode function.
  587.  
  588.              When the  window is  in manual  scroll mode  it is  unable to
  589.              display any text  written to it.  However, it will  count the
  590.              number of messages  lost should  this occur,  and will  add a
  591.              line itself to  the window to  warn the user  when the window
  592.              returns to automatic scroll mode.
  593.  
  594.  
  595.           Registering a TextView Window Class
  596.           Registering a TextView Window Class
  597.           Registering a TextView Window Class
  598.  
  599.           As  with  the  Windows  CreateWindow
  600.                                   CreateWindow
  601.                                   CreateWindow  function,  you  must  have
  602.           registered a  suitable  window class  before  you  can create  a
  603.           TextView
  604.           TextView
  605.           TextView window using  TVCreateWindow
  606.                                  TVCreateWindow
  607.                                  TVCreateWindow. Since most of the  details
  608.           of the window class have to be  supplied by TextView
  609.                                                       TextView
  610.                                                       TextView itself, you
  611.           must call a  TextView
  612.                        TextView
  613.                        TextView function  TVRegisterClass
  614.                                           TVRegisterClass
  615.                                           TVRegisterClass to do  this, and
  616.           must not use the ordinary Windows technique.
  617.  
  618.           When you call  TVRegisterClass
  619.                          TVRegisterClass
  620.                          TVRegisterClass you specify  four arguments:  for
  621.           example
  622.  
  623.                TVRegisterClass(hInstance,"TV_WINCLASS",
  624.                TVRegisterClass(hInstance,"TV_WINCLASS",
  625.                TVRegisterClass(hInstance,"TV_WINCLASS",
  626.                               LoadIcon(hInstance,"TV_WINICON"),
  627.                               LoadIcon(hInstance,"TV_WINICON"),
  628.                               LoadIcon(hInstance,"TV_WINICON"),
  629.                               GetStockObject(WHITE_BRUSH));
  630.                               GetStockObject(WHITE_BRUSH));
  631.                               GetStockObject(WHITE_BRUSH));
  632.  
  633.           will  register   a  class   using  an   icon  defined   in  your
  634.           application's resource area, and will use a white background for
  635.           the window.
  636.  
  637.           The function  will  return  FALSE
  638.                                       FALSE
  639.                                       FALSE if  it  fails to  register  the
  640.           window class, or if you pass incorrect arguments.
  641.  
  642.  
  643.           Creating a TextView Window
  644.           Creating a TextView Window
  645.           Creating a TextView Window
  646.  
  647.           Creating a Window with  TextView
  648.                                   TextView
  649.                                   TextView is closely analogous to how  you
  650.           use Windows' own  CreateWindow
  651.                             CreateWindow
  652.                             CreateWindow function. The routine you call  is
  653.           TVCreateWindow
  654.           TVCreateWindow
  655.           TVCreateWindow, and many of  the arguments you need  to pass are
  656.           have exact CreateWindow
  657.                      CreateWindow
  658.                      CreateWindow equivalents.
  659.  
  660.           The  lpClassName,  lpWindowTitle,  X,  Y,  nWidth,   nHeight  and
  661.           hInstance arguments are used in the same way as the  CreateWindow
  662.                                                                CreateWindow
  663.                                                                CreateWindow
  664.           arguments of  the same  name. The  one restriction  is  that the
  665.           window  class  you  specify  with  lpClassName  must  have  been
  666.           registered with the TVRegisterClass
  667.                               TVRegisterClass
  668.                               TVRegisterClass function.
  669.  
  670.           The remaining  arguments are  specific to  TextView and  have no
  671.           CreateWindow
  672.           CreateWindow
  673.           CreateWindow equivalents.
  674.  
  675.           hFont specifies a handle to the font  that you want text written
  676.           in the window to appear in. If you specify the argument as  NULL
  677.                                                                       NULL
  678.                                                                       NULL,
  679.           TextView
  680.           TextView
  681.           TextView will use  the system font;  otherwise, you can  use any
  682.           font created with the CreateFont
  683.                                 CreateFont
  684.                                 CreateFont function.
  685.  
  686.                                       Page 
  687.                                       Page 
  688.                                       Page 6
  689.                                            6
  690.                                            6
  691.  
  692.  
  693.  
  694.                                  The TextView DLL
  695.                                  The TextView DLL
  696.                                  The TextView DLL
  697.  
  698.  
  699.           The  dWflags argument  specifies a  series of  bit settings  that
  700.           describe the appearance  you want the  window to take,  and what
  701.           facilities it provides. These are described in detail below.
  702.  
  703.           The nTabSize value specifies how you want tabs to be expanded in
  704.           lines written to the window. You  give the value as  a number of
  705.           characters; TextView multiplies this by the width of the average
  706.           character in the selected font to  calculate the actual spacing.
  707.           If you give a value of zero, tabs will be expanded to a width of
  708.           8 characters.
  709.  
  710.           The  nMaxLines argument  tells TextView  how many  lines of  text
  711.           should be stored with the window (note that this is not the size
  712.           of the actual  window, but the  size of its  data storage area).
  713.           You can set this value to be from 128 to 4096. If you write more
  714.           lines than  this  to  the  window,  the  oldest  lines  will  be
  715.           progressively overwritten.
  716.  
  717.           The lpMenuHandler argument is the procedure  instance address of
  718.           a  function  within   your  application   that  is   to  receive
  719.           notification  of  things  happening  in  the   window.  This  is
  720.           discussed in more detail below in  the section on  Receiving Menu
  721.           Notifications. The  value you  pass as  this argument  must have
  722.           been obtained by using the  MakeProcInstance
  723.                                       MakeProcInstance
  724.                                       MakeProcInstance function. Depending
  725.           on the values  you have specifies  in the  dwFlags argument, you
  726.           may be allowed to give a NULL
  727.                                    NULL
  728.                                    NULL value.
  729.  
  730.           The return value from  TVCreateWindow
  731.                                  TVCreateWindow
  732.                                  TVCreateWindow is a normal window  handle,
  733.           which you use  in other  TextView
  734.                                    TextView
  735.                                    TextView functions.  You can  also pass
  736.           this handle  to  Windows  functions  to  manipulate the  window;
  737.           however you  should  avoid calling  DestroyWindow
  738.                                               DestroyWindow
  739.                                               DestroyWindow to  close  it.
  740.           Instead, use the  TextView
  741.                             TextView
  742.                             TextView equivalent  TVDestroyWindow
  743.                                                  TVDestroyWindow
  744.                                                  TVDestroyWindow, which is
  745.           guaranteed to work in future releases.
  746.  
  747.  
  748.              The dwFlags Argument
  749.              The dwFlags Argument
  750.              The dwFlags Argument
  751.  
  752.              This argument  is a  collection  of bit  settings  that tells
  753.              TextView
  754.              TextView
  755.              TextView details of  how you want  the window to  appear, and
  756.              what facilities it should support.
  757.  
  758.              The  TVS_MAXIMIZE
  759.                   TVS_MAXIMIZE
  760.                   TVS_MAXIMIZE,   TVS_MINIMIZE
  761.                                   TVS_MINIMIZE
  762.                                   TVS_MINIMIZE  and  TVS_SYSMENU
  763.                                                      TVS_SYSMENU
  764.                                                      TVS_SYSMENU  settings
  765.              correspond directly to  dwStyle settings in CreateWindow
  766.                                                          CreateWindow
  767.                                                          CreateWindow, and
  768.              control whether  the window  has a  maximize box,  a minimize
  769.              box, and a system menu.
  770.  
  771.              The  TVS_NOCLOSE
  772.                   TVS_NOCLOSE
  773.                   TVS_NOCLOSE setting  can be  used  to disable  the  close
  774.              option  in  the  system  menu;  if   you  select  this,  your
  775.              application must destroy the window, as the user will have no
  776.              way to  do so.  If  you specify  a  system menu,  and  do  not
  777.              disable the close option, you must supply a procedure address
  778.              with the  lpMenuHandler argument so  that TextView
  779.                                                        TextView
  780.                                                        TextView can notify
  781.              your application when the user closes the window.
  782.  
  783.              The  TVS_NORESIZE
  784.                   TVS_NORESIZE
  785.                   TVS_NORESIZE setting  allows  you to  create  the  window
  786.              without a thick "resizing"  frame. The user will  not be able
  787.              to alter the size of  the window other than  by minimizing or
  788.              maximizing it.
  789.  
  790.                                       Page 
  791.                                       Page 
  792.                                       Page 7
  793.                                            7
  794.                                            7
  795.  
  796.  
  797.  
  798.                                  The TextView DLL
  799.                                  The TextView DLL
  800.                                  The TextView DLL
  801.  
  802.  
  803.              TVS_HSCROLL
  804.              TVS_HSCROLL
  805.              TVS_HSCROLL and TVS_VSCROLL
  806.                              TVS_VSCROLL
  807.                              TVS_VSCROLL specify whether the window  is to
  808.              show horizontal and vertical scroll bars  if the user or your
  809.              application puts  it into  manual scroll  mode. If  you don't
  810.              include either of the settings, manual  scroll mode cannot be
  811.              selected, and the user will be unable  to scroll back to look
  812.              at text no longer in the window.
  813.  
  814.              TVS_TIMESTAMP
  815.              TVS_TIMESTAMP
  816.              TVS_TIMESTAMP controls whether TextView is  to timestamp text
  817.              written to the window. If  you specify it, all  lines will be
  818.              prefixed with the current  Windows time (that  is, the number
  819.              of milliseconds  since  Windows  started,  obtained from  the
  820.              GetCurrentTime
  821.              GetCurrentTime
  822.              GetCurrentTime function). Timestamping messages can be useful
  823.              if you are  using TextView  to trace the  path taken  by your
  824.              application in response to external events.
  825.  
  826.              The other settings all control what  menu items should appear
  827.              in the window's menu bar.  TVS_SCROLLMENU
  828.                                         TVS_SCROLLMENU
  829.                                         TVS_SCROLLMENU selects a  Scrolling
  830.              menu item, which will let the  user switch between manual and
  831.              automatic scroll  modes. You  can  use this  setting  only if
  832.              you've  also  given   either  or  both   of  TVS_HSCROLL
  833.                                                           TVS_HSCROLL
  834.                                                           TVS_HSCROLL  and
  835.              TVS_VSCROLL
  836.              TVS_VSCROLL
  837.              TVS_VSCROLL. If  you  specify a  procedure  address with  the
  838.              lpMenuHandler argument,  your  application  will be  notified
  839.              when the user clicks these menu items.
  840.  
  841.              TVS_FILESAVE
  842.              TVS_FILESAVE
  843.              TVS_FILESAVE, TVS_FILESAVEAS
  844.                            TVS_FILESAVEAS
  845.                            TVS_FILESAVEAS  and  TVS_FILEPRINT
  846.                                                 TVS_FILEPRINT
  847.                                                 TVS_FILEPRINT specify  that
  848.              the window is to have a File menu, which should include  Save,
  849.              Save As  and  Print options  respectively.   You can  use  the
  850.              three  settings  independently.  If  you  use  any  of  these
  851.              settings  you  must  specify  a  procedure  address   in  the
  852.              lpMenuHandler argument to receive notification when the items
  853.              are clicked.
  854.  
  855.  
  856.           Writing Text to a TextView Window
  857.           Writing Text to a TextView Window
  858.           Writing Text to a TextView Window
  859.  
  860.           Once a TextView
  861.                  TextView
  862.                  TextView window is created, writing text  to it is simply
  863.           done with the TVOutputText
  864.                         TVOutputText
  865.                         TVOutputText function. This takes three arguments:
  866.  
  867.                hWnd        This is the handle to the TextView
  868.                                                      TextView
  869.                                                      TextView window.
  870.  
  871.                lpBuffer    This is a  long pointer to  a buffer containing
  872.                            the line you wish to write.
  873.  
  874.                nSize       This is the number of characters in the buffer.
  875.                            If you  set  this value  to  zero,  TVOutputText
  876.                                                                TVOutputText
  877.                                                                TVOutputText
  878.                            will  assume  the  text  is  a  zero-terminated
  879.                            string and will write it out completely.
  880.  
  881.           You can write up to 512 bytes in a line,  less the length of the
  882.           timestamp details if  you used  the TVS_TIMESTAMP
  883.                                               TVS_TIMESTAMP
  884.                                               TVS_TIMESTAMP option in  the
  885.           dwFlags argument to  TVCreateWindow
  886.                                TVCreateWindow
  887.                                TVCreateWindow. If you supply a longer  line
  888.           than that, TextView
  889.                      TextView
  890.                      TextView will truncate it.
  891.  
  892.           What happens to  the text  depends on the  current state  of the
  893.           TextView
  894.           TextView
  895.           TextView window  you are  writing it  to.  If the  window  is in
  896.           automatic scroll mode, it will be displayed in the window, which
  897.           will be scrolled up  by one line  if necessary to  make room for
  898.           it. The text will be  written in the colour  last specified with
  899.  
  900.                                       Page 
  901.                                       Page 
  902.                                       Page 8
  903.                                            8
  904.                                            8
  905.  
  906.  
  907.  
  908.                                  The TextView DLL
  909.                                  The TextView DLL
  910.                                  The TextView DLL
  911.  
  912.  
  913.           the  TVSetTextColor
  914.                TVSetTextColor
  915.                TVSetTextColor function  (or in  black, if  you haven't  set
  916.           another colour).
  917.  
  918.           If the  window  is  in  manual scroll  mode, the  text  will  be
  919.           discarded. TextView
  920.                      TextView
  921.                      TextView will record  the fact that  a line has  been
  922.           lost, and when the user (or your application) returns the window
  923.           to automatic  scroll  mode will  add  a line  itself  noting the
  924.           number of  lines that  have ben  lost.  If the  window  has been
  925.           suspended with a call  to TVSuspendWindow
  926.                                     TVSuspendWindow
  927.                                     TVSuspendWindow, or you  are currently
  928.           calling the  TVReturnData
  929.                        TVReturnData
  930.                        TVReturnData function to read  back the data  stored
  931.           in the window,  the text will  also be discarded.  Here, though,
  932.           TextView
  933.           TextView
  934.           TextView will not record the fact.
  935.  
  936.           If you choose,  you can  determine the status  of the  window by
  937.           calling the   TVGetWindowStatus
  938.                         TVGetWindowStatus
  939.                         TVGetWindowStatus function,  and  so  avoid  making
  940.           calls to TVOutputText
  941.                    TVOutputText
  942.                    TVOutputText at inappropriate moments.
  943.  
  944.  
  945.           Receiving Menu Notifications
  946.           Receiving Menu Notifications
  947.           Receiving Menu Notifications
  948.  
  949.           A  TextView
  950.              TextView
  951.              TextView window  is  an  independent  entity,  all  of  whose
  952.           functions are controlled  within the  TextView
  953.                                                 TextView
  954.                                                 TextView DLL  itself. Your
  955.           application does not  provide the  message loop for  the window,
  956.           and is normally unaware of what the user is doing to the window:
  957.           TextView
  958.           TextView
  959.           TextView handles  window resizing,  scrolling, iconizing  and so
  960.           on.
  961.  
  962.           However, you may wish to make your application aware of what the
  963.           window is doing for one of two reasons. Firstly, you may wish to
  964.           allow the user to control the window from either its own menu or
  965.           from the application's menu - for example, you  might include in
  966.           your application's menu the  ability for the user  to switch the
  967.           TextView
  968.           TextView
  969.           TextView window between manual and automatic scrolling. In order
  970.           to keep the application's menu state in line with the window, it
  971.           will be necessary  for the  application to be  informed whenever
  972.           the  state  is  changed   using  the  window's   own  menu.  The
  973.           application will probably also wish to be informed when the user
  974.           closes the window with the  Close option in its  System menu, so
  975.           that it can keep track of which windows are still active.
  976.  
  977.           The second reason is that some services  must be provided by the
  978.           application. TextView  allows  you to  specify  that the  window
  979.           should possess a File menu with options such as  Save and  Print,
  980.           but it  does  not itself  handle  these  functions. Instead,  it
  981.           notifies the  application  when  one  of  these  menu  items  is
  982.           clicked, so that it may then perform the required operations.
  983.  
  984.           All these examples of  menu notifications are done  via the  menu
  985.           handler routine  specified  when  you  create  the  window  with
  986.           TVCreateWindow
  987.           TVCreateWindow
  988.           TVCreateWindow. Whenever the user clicks a  menu item (including
  989.           the Close option in the  System menu) the TextView
  990.                                                     TextView
  991.                                                     TextView DLL will call
  992.           this routine, passing it the handle of the window concerned, and
  993.           a code indicating the menu item.
  994.  
  995.           Your code can then take  what action it wishes.  For example, if
  996.           the user clicked on File Save As , you might run a dialog  to ask
  997.           the user  for a  file  name, open  it,  and then  copy  the data
  998.  
  999.  
  1000.                                       Page 
  1001.                                       Page 
  1002.                                       Page 9
  1003.                                            9
  1004.                                            9
  1005.  
  1006.  
  1007.  
  1008.                                  The TextView DLL
  1009.                                  The TextView DLL
  1010.                                  The TextView DLL
  1011.  
  1012.  
  1013.           currently in the window to the file using the  TVSaveWindowToFile
  1014.                                                          TVSaveWindowToFile
  1015.                                                          TVSaveWindowToFile
  1016.           function.
  1017.  
  1018.           The example sources  contained in  the distribution  set contain
  1019.           examples of how  you use menu  notification. The code  keeps the
  1020.           main window's menu in line with the current state of the window,
  1021.           graying some items when the window is destroyed and checking the
  1022.           relevant scroll state selections.
  1023.  
  1024.  
  1025.           Saving Data in a Window to File
  1026.           Saving Data in a Window to File
  1027.           Saving Data in a Window to File
  1028.  
  1029.           TextView
  1030.           TextView
  1031.           TextView allows you to save the  contents of a window  to a file
  1032.           on disk at  any time. There  are two techniques  for doing this,
  1033.           depending on  how  much processing  of  the data  you  wish your
  1034.           application to do before it is written.
  1035.  
  1036.           If you application created the window  and specified a  File menu
  1037.           with File Save or File Save As options, it will be notified when
  1038.           they are clicked,  as described above,  but you can,  of course,
  1039.           initiate a  file  save at  any  time and  not  solely when  this
  1040.           occurs.
  1041.  
  1042.           The first  technique  for  saving  the  data  is  the  simplest.
  1043.           TextView
  1044.           TextView
  1045.           TextView provides a function TVSaveWindowToFile
  1046.                                        TVSaveWindowToFile
  1047.                                        TVSaveWindowToFile which will write
  1048.           a range of lines to a file exactly as they as stored, and if you
  1049.           don't need to process the data yourself this will be the easiest
  1050.           option. Your application will need to  determine the name of the
  1051.           file to be written, probably by giving the  user a dialog box to
  1052.           choose it,  and open  the file  for  writing; then  it  can call
  1053.           TVSaveWindowToFile
  1054.           TVSaveWindowToFile
  1055.           TVSaveWindowToFile.
  1056.  
  1057.           For example, if the name of the file is stored in  file_name
  1058.                                                              file_name
  1059.                                                              file_name, you
  1060.           could use code  like this to  save all  the data stored  for the
  1061.           window:
  1062.  
  1063.                int
  1064.                int
  1065.                int    hFile;
  1066.                       hFile;
  1067.                       hFile;        /* handle to file */
  1068.                                     /* handle to file */
  1069.                                     /* handle to file */
  1070.  
  1071.                ...
  1072.                ...
  1073.                ...
  1074.  
  1075.                hFile = _lcreat(file_name,0);
  1076.                hFile = _lcreat(file_name,0);
  1077.                hFile = _lcreat(file_name,0);
  1078.                TVSaveWindowToFile(hWnd,hFile,0,-1,0L);
  1079.                TVSaveWindowToFile(hWnd,hFile,0,-1,0L);
  1080.                TVSaveWindowToFile(hWnd,hFile,0,-1,0L);
  1081.  
  1082.           Specifying the start line as 0 and the  number of lines to write
  1083.           as -1 causes all the stored data  to be saved. The demonstration
  1084.           program sources in the distribution set  show you this technique
  1085.           in use.
  1086.  
  1087.           The second technique for  saving data allows you  to process the
  1088.           lines before they are  written. You can  obtain successive lines
  1089.           from the window by calling the  TVReturnData
  1090.                                           TVReturnData
  1091.                                           TVReturnData function, described
  1092.           in a following section, perform the  actions required, and write
  1093.           to the file yourself.
  1094.  
  1095.           If you wish to  save only the  data that is  actually visible in
  1096.           the window, you can use the TVGetWindowStatus
  1097.                                       TVGetWindowStatus
  1098.                                       TVGetWindowStatus function to obtain
  1099.           the required line numbers, as shown here:
  1100.  
  1101.  
  1102.                                      Page 
  1103.                                      Page 
  1104.                                      Page 10
  1105.                                           10
  1106.                                           10
  1107.  
  1108.  
  1109.  
  1110.                                  The TextView DLL
  1111.                                  The TextView DLL
  1112.                                  The TextView DLL
  1113.  
  1114.  
  1115.                TVWSTATUS
  1116.                TVWSTATUS
  1117.                TVWSTATUS  status;
  1118.                           status;
  1119.                           status;          /* window status details */
  1120.                                            /* window status details */
  1121.                                            /* window status details */
  1122.                int
  1123.                int
  1124.                int        hFile;
  1125.                           hFile;
  1126.                           hFile;           /* handle to file */
  1127.                                            /* handle to file */
  1128.                                            /* handle to file */
  1129.  
  1130.                ...
  1131.                ...
  1132.                ...
  1133.  
  1134.                /* Get details of the window */
  1135.                /* Get details of the window */
  1136.                /* Get details of the window */
  1137.  
  1138.                TVGetWindowStatus(hWnd,&status);
  1139.                TVGetWindowStatus(hWnd,&status);
  1140.                TVGetWindowStatus(hWnd,&status);
  1141.  
  1142.                /* Open the file and write the data that is visible now */
  1143.                /* Open the file and write the data that is visible now */
  1144.                /* Open the file and write the data that is visible now */
  1145.  
  1146.                hFile
  1147.                hFile
  1148.                hFile  = _lcreat(file_name,0);
  1149.                       = _lcreat(file_name,0);
  1150.                       = _lcreat(file_name,0);
  1151.                TVSaveWindowToFile(hWnd,hFile,status.nTopLine,
  1152.                TVSaveWindowToFile(hWnd,hFile,status.nTopLine,
  1153.                TVSaveWindowToFile(hWnd,hFile,status.nTopLine,
  1154.                                            status.nRows,0L);
  1155.                                            status.nRows,0L);
  1156.                                            status.nRows,0L);
  1157.  
  1158.           Giving the number of lines to  be written as the  number of rows
  1159.           in the window ensures that  all the visible data  is written. If
  1160.           the window is  not actually full,  the function will  adjust the
  1161.           number requested itself.
  1162.  
  1163.  
  1164.           Printing Data in a Window
  1165.           Printing Data in a Window
  1166.           Printing Data in a Window
  1167.  
  1168.           TextView
  1169.           TextView
  1170.           TextView  does  not  itself  provide  facilities  to  print  the
  1171.           contents of a window to file. If you wish your application to do
  1172.           this, you will need  to use the  TVReturnData
  1173.                                            TVReturnData
  1174.                                            TVReturnData function described
  1175.           below to read back the window's contents, and handle the printer
  1176.           yourself.
  1177.  
  1178.           If you  create the  window  to have  a  File menu  with  a  Print
  1179.           option,  TextView
  1180.                    TextView
  1181.                    TextView will  notify  your application  when  the  user
  1182.           requests a print action by clicking it.
  1183.  
  1184.  
  1185.           Reading Back the Contents of a TextView Window
  1186.           Reading Back the Contents of a TextView Window
  1187.           Reading Back the Contents of a TextView Window
  1188.  
  1189.           Your application can call the  TextView
  1190.                                          TextView
  1191.                                          TextView DLL at any  time to read
  1192.           back the  data  stored  with  any   TextView
  1193.                                               TextView
  1194.                                               TextView  window,  using  the
  1195.           TVReturnData
  1196.           TVReturnData
  1197.           TVReturnData function.
  1198.  
  1199.           The initial  call to  TVReturnData
  1200.                                 TVReturnData
  1201.                                 TVReturnData nominates  a buffer  that you
  1202.           wish to use to receive the contents of the window, one line at a
  1203.           time. You  also  specify the  address  of  a  callback function;
  1204.           TextView
  1205.           TextView
  1206.           TextView will copy  the text  of one line  into your  buffer and
  1207.           call this function to allow you  to process it, repeatedly until
  1208.           either every  line  has been  processed,  or  you terminate  the
  1209.           sequence.
  1210.  
  1211.           For example, the callback function might be declared like this:
  1212.  
  1213.                int
  1214.                int
  1215.                intFAR
  1216.                   FAR
  1217.                   FAR PASCAL
  1218.                       PASCAL
  1219.                       PASCAL  data_handler(HWND hWnd, LPSTR lpBuffer,
  1220.                               data_handler(HWND hWnd, LPSTR lpBuffer,
  1221.                               data_handler(HWND hWnd, LPSTR lpBuffer,
  1222.                                            int nCount, BOOL nTruncated)
  1223.                                            int nCount, BOOL nTruncated)
  1224.                                            int nCount, BOOL nTruncated)
  1225.  
  1226.                {
  1227.                {
  1228.                {
  1229.                   /* Make sure we didn't lose any bit of the line */
  1230.                   /* Make sure we didn't lose any bit of the line */
  1231.                   /* Make sure we didn't lose any bit of the line */
  1232.  
  1233.                   if ( nTruncated )
  1234.                   if ( nTruncated )
  1235.                   if ( nTruncated )
  1236.                   {
  1237.                   {
  1238.                   {
  1239.  
  1240.                                      Page 
  1241.                                      Page 
  1242.                                      Page 11
  1243.                                           11
  1244.                                           11
  1245.  
  1246.  
  1247.  
  1248.                                  The TextView DLL
  1249.                                  The TextView DLL
  1250.                                  The TextView DLL
  1251.  
  1252.  
  1253.                       /* Buffer was too short, so a line has been cut
  1254.                       /* Buffer was too short, so a line has been cut
  1255.                       /* Buffer was too short, so a line has been cut
  1256.                       *  short. Warn the user and abort the process
  1257.                       *  short. Warn the user and abort the process
  1258.                       *  short. Warn the user and abort the process
  1259.                       */
  1260.                       */
  1261.                       */
  1262.  
  1263.                       MessageBox(NULL,"Buffer too short",NULL,
  1264.                       MessageBox(NULL,"Buffer too short",NULL,
  1265.                       MessageBox(NULL,"Buffer too short",NULL,
  1266.                                  MB_ICONSTOP | MB_TASKMODAL);
  1267.                                  MB_ICONSTOP | MB_TASKMODAL);
  1268.                                  MB_ICONSTOP | MB_TASKMODAL);
  1269.                       return(0);
  1270.                       return(0);
  1271.                       return(0);
  1272.                   }
  1273.                   }
  1274.                   }
  1275.  
  1276.                   /* Got all the line, so process it */
  1277.                   /* Got all the line, so process it */
  1278.                   /* Got all the line, so process it */
  1279.  
  1280.                   process_line(lpBuffer);
  1281.                   process_line(lpBuffer);
  1282.                   process_line(lpBuffer);
  1283.  
  1284.                   /* And return non-zero to get the next line */
  1285.                   /* And return non-zero to get the next line */
  1286.                   /* And return non-zero to get the next line */
  1287.  
  1288.                   return(1);
  1289.                   return(1);
  1290.                   return(1);
  1291.  
  1292.                }
  1293.                }
  1294.                }
  1295.  
  1296.           This routine will be called once  for every line of  text in the
  1297.           window. It checks that no data was lost  due to the buffer being
  1298.           too small,  and if  it was  it terminates  the read  of  data by
  1299.           returning a value  of zero  to the  DLL. If  not, it  calls some
  1300.           routine called  process_file
  1301.                           process_file
  1302.                           process_file to  do something  to the  data, and
  1303.           returns a non-zero  value requesting  the DLL  to pass  the next
  1304.           line to it.
  1305.  
  1306.           While your application is engaged in  reading back lines of text
  1307.           from a window, any calls to TVOutputText
  1308.                                       TVOutputText
  1309.                                       TVOutputText to add more text to it,
  1310.           and most  of  the  functions  controlling  the window,  will  be
  1311.           disabled.
  1312.  
  1313.           The example sources supplied in the distribution give you a full
  1314.           example of how to use TVReturnData
  1315.                                 TVReturnData
  1316.                                 TVReturnData. In this case, they read back
  1317.           the data from one window and make a copy of it in another.
  1318.  
  1319.  
  1320.           Destroying a TextView Window
  1321.           Destroying a TextView Window
  1322.           Destroying a TextView Window
  1323.  
  1324.           A  TextView
  1325.              TextView
  1326.              TextView window  may be  destroyed in  one of  two ways.  Your
  1327.           application may simply call the  TVDestroyWindow
  1328.                                            TVDestroyWindow
  1329.                                            TVDestroyWindow function, which
  1330.           will remove  the  window from  the  screen and  release  all its
  1331.           memory resources. This may be done at any time.
  1332.  
  1333.           Alternatively, if you specified in the  TVCreateWindow
  1334.                                                   TVCreateWindow
  1335.                                                   TVCreateWindow call that
  1336.           the window was to  have a System  Menu, and did  not inhibit the
  1337.           Close option, the user may close the window directly by clicking
  1338.           that option. In this case,  TextView
  1339.                                       TextView
  1340.                                       TextView will remove the window from
  1341.           the screen and release the memory  resources used by the window.
  1342.           It will then  notify your application  that the window  has been
  1343.           destroyed by  calling the  menu handler  function,  passing it  a
  1344.           code of TVMI_CLOSE
  1345.                   TVMI_CLOSE
  1346.                   TVMI_CLOSE.
  1347.  
  1348.           You should not use the normal  Windows DestroyWindow
  1349.                                                  DestroyWindow
  1350.                                                  DestroyWindow function to
  1351.           destroy a  TextView  window as  this  may  be incompatible  with
  1352.           future releases.
  1353.  
  1354.  
  1355.  
  1356.                                      Page 
  1357.                                      Page 
  1358.                                      Page 12
  1359.                                           12
  1360.                                           12
  1361.  
  1362.  
  1363.  
  1364.                                  The TextView DLL
  1365.                                  The TextView DLL
  1366.                                  The TextView DLL
  1367.  
  1368.  
  1369.           Control Functions
  1370.           Control Functions
  1371.           Control Functions
  1372.  
  1373.           TextView
  1374.           TextView
  1375.           TextView provides  your  application  with  a  range of  control
  1376.           functions  that  control  the  operation  of   its  windows,  as
  1377.           described below:
  1378.  
  1379.  
  1380.              Setting Text and Background Colour
  1381.              Setting Text and Background Colour
  1382.              Setting Text and Background Colour
  1383.  
  1384.              By default, text  will be displayed  in a  TextView
  1385.                                                         TextView
  1386.                                                         TextView window in
  1387.              black. The TVSetTextColor
  1388.                         TVSetTextColor
  1389.                         TVSetTextColor function allows you to  specify any
  1390.              RGB value to be used for  subsequent output. The  TVSetBKColor
  1391.                                                                TVSetBKColor
  1392.                                                                TVSetBKColor
  1393.              function allows you to set the text background colour.
  1394.  
  1395.  
  1396.              Setting the Scroll State
  1397.              Setting the Scroll State
  1398.              Setting the Scroll State
  1399.  
  1400.              If you  specify  the  TVS_SCROLLMENU
  1401.                                    TVS_SCROLLMENU
  1402.                                    TVS_SCROLLMENU setting  in  the  dwFlags
  1403.              argument to TVCreateWindow
  1404.                          TVCreateWindow
  1405.                          TVCreateWindow, the window will have  a  Scrolling
  1406.              menu that will permit  the user to switch  between manual and
  1407.              automatic scroll modes at will.
  1408.  
  1409.              If you wish, your  application can force  a particular scroll
  1410.              state itself with  the  TVSetScrollState
  1411.                                      TVSetScrollState
  1412.                                      TVSetScrollState function.  If you  do
  1413.              not specify a Scrolling menu, this is the  only way to change
  1414.              scroll modes.
  1415.  
  1416.  
  1417.              Suspending Text Output
  1418.              Suspending Text Output
  1419.              Suspending Text Output
  1420.  
  1421.              At some point  in your application  you may wish  to suppress
  1422.              output to a  TextView
  1423.                           TextView
  1424.                           TextView window. One  way of doing  so would, of
  1425.              course, be to  set a global  flag in your  application's data
  1426.              segment  that  is   checked  by  every   routine  that  calls
  1427.              TVOutputText
  1428.              TVOutputText
  1429.              TVOutputText,  and   this   technique     is   used  in   the
  1430.              demonstration application to activate or disable tracing.
  1431.  
  1432.              An alternative that does not involve a  global flag is to use
  1433.              the  TVSuspendWindow
  1434.                   TVSuspendWindow
  1435.                   TVSuspendWindow function.  When  a window  is  marked  as
  1436.              suspended, TVOutputText
  1437.                         TVOutputText
  1438.                         TVOutputText functions as normal, but  the text is
  1439.              discarded.
  1440.  
  1441.  
  1442.              Temporarily Inhibiting Window Updates
  1443.              Temporarily Inhibiting Window Updates
  1444.              Temporarily Inhibiting Window Updates
  1445.  
  1446.              Writing text  to  a  window,  particularly  if  the  existing
  1447.              contents must be scrolled  to make room, can  be an expensive
  1448.              operation in terms  of processor  power. If  your application
  1449.              has to write a large number of lines  to a TextView
  1450.                                                         TextView
  1451.                                                         TextView window at
  1452.              one time, it  will be considerably  slowed while the  data is
  1453.              scrolled up through the display.
  1454.  
  1455.              The TVSetRedraw 
  1456.                  TVSetRedraw 
  1457.                  TVSetRedraw function 
  1458.                                       
  1459.                                        allows you to configure a window  so
  1460.              that text lines are stored  as normal, but the  window is not
  1461.              updated as they are received, letting you write the data with
  1462.              TVOutputText
  1463.              TVOutputText
  1464.              TVOutputText very rapidly.  Then, when  you have  written all
  1465.              the lines, you  can tell  TextView
  1466.                                        TextView
  1467.                                        TextView to  update the  window: it
  1468.  
  1469.  
  1470.                                      Page 
  1471.                                      Page 
  1472.                                      Page 13
  1473.                                           13
  1474.                                           13
  1475.  
  1476.  
  1477.  
  1478.                                  The TextView DLL
  1479.                                  The TextView DLL
  1480.                                  The TextView DLL
  1481.  
  1482.  
  1483.              will display only the  final windowfull of  lines, which will
  1484.              involve no scrolling.
  1485.  
  1486.              The demonstration program supplied with TextView
  1487.                                                      TextView
  1488.                                                      TextView lets you see
  1489.              the effect  of suppressing  window updates:  the  Write Batch
  1490.              menu option  writes 200  lines to  the window,  scrolling for
  1491.              each  one;  the  Write  Batch  Fast  option  disables  window
  1492.              updating, writes 200 lines and then updates the window.
  1493.  
  1494.  
  1495.              Clearing a Window
  1496.              Clearing a Window
  1497.              Clearing a Window
  1498.  
  1499.              The TVResetWindow
  1500.                  TVResetWindow
  1501.                  TVResetWindow will destroy all data stored  for a window,
  1502.              and it will  be redrawn  empty. The window  will be  set into
  1503.              automatic scroll mode, and  the text colour used  will be set
  1504.              to be black.
  1505.  
  1506.  
  1507.           Information Functions
  1508.           Information Functions
  1509.           Information Functions
  1510.  
  1511.           You can find out  the exact status  of a  TextView
  1512.                                                     TextView
  1513.                                                     TextView window at  any
  1514.           time by calling the  TVGetWindowStatus
  1515.                                TVGetWindowStatus
  1516.                                TVGetWindowStatus routine. This  fills in a
  1517.           TVWSTATUS
  1518.           TVWSTATUS
  1519.           TVWSTATUS struct that you supply; the  details of the format are
  1520.           shown in the Data Types and Structures section.
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.                                      Page 
  1557.                                      Page 
  1558.                                      Page 14
  1559.                                           14
  1560.                                           14
  1561.  
  1562.  
  1563.  
  1564.                                  The TextView DLL
  1565.                                  The TextView DLL
  1566.                                  The TextView DLL
  1567.  
  1568.  
  1569.        F
  1570.        F
  1571.        FUNCTIONS 
  1572.         UNCTIONS 
  1573.         UNCTIONS D
  1574.                  D
  1575.                  DIRECTORY
  1576.                   IRECTORY
  1577.                   IRECTORY
  1578.  
  1579.  
  1580.        This chapter contains an alphabetical list  of functions comprising
  1581.        the TextView
  1582.            TextView
  1583.            TextView system. The  specifications are laid  out in the  same
  1584.        way as  those  in  the  Microsoft  Windows  Programmer's  reference
  1585.        Manual.
  1586.  
  1587.        All TextView
  1588.            TextView
  1589.            TextView functions use the Pascal calling  convention, and must
  1590.        be declared  FAR
  1591.                     FAR
  1592.                     FAR. Including the  header file  textview.h
  1593.                                                      textview.h
  1594.                                                      textview.h in sources
  1595.        using these interfaces will declare their prototypes automatically,
  1596.        and will ensure that they are being correctly used.
  1597.  
  1598.        Applications that make  use  TextView
  1599.                                     TextView
  1600.                                     TextView routines must  be linked  with
  1601.        the TextView
  1602.            TextView
  1603.            TextView import library textview.lib
  1604.                                    textview.lib
  1605.                                    textview.lib.
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.                                      Page 
  1651.                                      Page 
  1652.                                      Page 15
  1653.                                           15
  1654.                                           15
  1655.  
  1656.  
  1657.  
  1658.                                  The TextView DLL
  1659.                                  The TextView DLL
  1660.                                  The TextView DLL
  1661.  
  1662.  
  1663.        TVCreateWindow
  1664.        TVCreateWindow
  1665.        TVCreateWindow
  1666.  
  1667.        Syntax
  1668.        Syntax
  1669.        Syntax       BOOL
  1670.                     BOOL
  1671.                     BOOL      TVCreateWindow
  1672.                               TVCreateWindow
  1673.                               TVCreateWindow(lpClassName, lpWindowName,  X,
  1674.                     Y,  nWidth,   nHeight,   hInstance,   hFont,   dwFlags,
  1675.                     dwUnused, nTabSize, nMaxLines, lpMenuHandler)
  1676.  
  1677.                     This function creates  a TextView
  1678.                                              TextView
  1679.                                              TextView window. Many  of the
  1680.                     arguments  are   similar  to   those  used   with   the
  1681.                     CreateWindow function, but there are some  extra values
  1682.                     appropriate  to   TextView
  1683.                                       TextView
  1684.                                       TextView,  and   some   inappropriate
  1685.                     arguments may not be specified.
  1686.  
  1687.                     TVCreateWindow
  1688.                     TVCreateWindow
  1689.                     TVCreateWindow will always create an overlapped window.
  1690.                     Option  flags  allow  the  selection  of  minimize  and
  1691.                     maximize boxes, and  whether the user  will be able  to
  1692.                     resize it by dragging its borders.
  1693.  
  1694.                     TextView
  1695.                     TextView
  1696.                     TextView allows the  application to  interact with  the
  1697.                     window in a  controlled way. All  message handling  for
  1698.                     the  window   is  performed   by  TextView
  1699.                                                       TextView
  1700.                                                       TextView,  but   the
  1701.                     application can specify that  it wished to be  notified
  1702.                     when  events  such  as  menu  item  clicks  occur.  For
  1703.                     example, this allows the window  to appear to the  user
  1704.                     as a  normal application  window complete  with a  File
  1705.                     menu, but for handling  of the corresponding  functions
  1706.                     to be done by the application.
  1707.  
  1708.                     _________
  1709.                     Parameter
  1710.                     _________
  1711.                     Parameter
  1712.                     _________
  1713.                     Parameter     ________________
  1714.                                   Type/Description
  1715.                                   ________________
  1716.                                   Type/Description
  1717.                                   ________________
  1718.                                   Type/Description
  1719.  
  1720.                     lpClassName   LPSTR
  1721.                                   LPSTR
  1722.                                   LPSTR     Points to  a  null-terminated
  1723.                                   string that  names  the  window  class.
  1724.                                   This class  must  have  been previously
  1725.                                   registered    with     a     call    to
  1726.                                   TVRegisterClass.
  1727.                                   TVRegisterClass.
  1728.                                   TVRegisterClass.
  1729.  
  1730.                     lpWindowName  LPSTR
  1731.                                   LPSTR
  1732.                                   LPSTR     Points to  a  null-terminated
  1733.                                   character string  that  represents  the
  1734.                                   window name.
  1735.  
  1736.                     X             int
  1737.                                   int
  1738.                                   int  Specifies the  initial   x-position
  1739.                                   of the window. The value is the initial
  1740.                                   x-coordinate of the  upper left corner,
  1741.                                   in screen coordinates. If  the value is
  1742.                                   CW_USEDEFAULT,  Windows   selects   the
  1743.                                   default  position   for   the  window's
  1744.                                   upper-left corner.
  1745.  
  1746.                     Y             int
  1747.                                   int
  1748.                                   int  Specifies the  initial  y-position
  1749.                                   of the window. The value is the initial
  1750.                                   y-coordinate of the  upper left corner,
  1751.                                   in screen coordinates.
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.                                      Page 
  1761.                                      Page 
  1762.                                      Page 16
  1763.                                           16
  1764.                                           16
  1765.  
  1766.  
  1767.  
  1768.                                  The TextView DLL
  1769.                                  The TextView DLL
  1770.                                  The TextView DLL
  1771.  
  1772.  
  1773.                     nWidth        int
  1774.                                   int
  1775.                                   int  Specifies the width  of the window
  1776.                                   in  device  units.  If   the  value  is
  1777.                                   CW_USEDEFAULT,   Windows    selects   a
  1778.                                   default  width   and  height   for  the
  1779.                                   window, and  the   nHeight  argument  is
  1780.                                   ignored.
  1781.  
  1782.                     nHeight       int
  1783.                                   int
  1784.                                   int  Specifies the height of the window
  1785.                                   in  device   units.  The   argument  is
  1786.                                   ignored if nWidth is CW_USEDEFAULT.
  1787.  
  1788.                     hInstance     HANDLE
  1789.                                   HANDLE
  1790.                                   HANDLE    Identifies  the  instance  of
  1791.                                   the module  to be  associated  with the
  1792.                                   window.
  1793.  
  1794.                     hFont         HFONT
  1795.                                   HFONT
  1796.                                   HFONT     Specifies  a  handle  to  the
  1797.                                   font to be used when text is written to
  1798.                                   the window. If  the value is  NULL, the
  1799.                                   system font is used.
  1800.  
  1801.                     dwFlags       DWORD
  1802.                                   DWORD
  1803.                                   DWORD     Specifies various  facilities
  1804.                                   required in the  window. It can  be any
  1805.                                   combination of the values  given in the
  1806.                                   list below.
  1807.  
  1808.                     dwUnused      DWORD
  1809.                                   DWORD
  1810.                                   DWORD     Must be zero.
  1811.  
  1812.                     nTabSize      int
  1813.                                   int
  1814.                                   int  Specifies the width of  a tab stop
  1815.                                   to be  used  when writing  text  to the
  1816.                                   window.
  1817.  
  1818.                     nMaxLines     int
  1819.                                   int
  1820.                                   int  Specifies how  many lines  of text
  1821.                                   are  to  be  stored   in  the  window's
  1822.                                   buffers. The value must  be between 128
  1823.                                   and 4096;  values  outside  this  range
  1824.                                   will be silently adjusted.
  1825.  
  1826.                     lpMenuHandler FARPROC
  1827.                                   FARPROC
  1828.                                   FARPROC   A  procedure  instance  of  a
  1829.                                   routine to  be  called  when  the  user
  1830.                                   clicks on an item in the window's menu.
  1831.                                   See the "Comments" section for details.
  1832.  
  1833.  
  1834.  
  1835.        Return Value
  1836.        Return Value
  1837.        Return Value The return value is a handle  to the new window. It  is
  1838.                     NULL if the window could not be created.
  1839.  
  1840.        Comments
  1841.        Comments
  1842.        Comments     Where the X argument is CW_USEDEFAULT,  the Y argument
  1843.                     can be one of the show-style parameters  described with
  1844.                     the ShowWindow
  1845.                         ShowWindow
  1846.                         ShowWindow function.
  1847.  
  1848.                     The address passed as  the lpMenuHandler argument must
  1849.                     be created by using the MakeProcInstance
  1850.                                             MakeProcInstance
  1851.                                             MakeProcInstance function. The
  1852.                     callback  function   must   use  the   Pascal   calling
  1853.                     convention and be declared FAR
  1854.                                                FAR
  1855.                                                FAR.
  1856.  
  1857.                     The dwFlags argument  should contain  values from  the
  1858.                     list below:
  1859.  
  1860.                                      Page 
  1861.                                      Page 
  1862.                                      Page 17
  1863.                                           17
  1864.                                           17
  1865.  
  1866.  
  1867.  
  1868.                                  The TextView DLL
  1869.                                  The TextView DLL
  1870.                                  The TextView DLL
  1871.  
  1872.  
  1873.                     TVS_FILESAVE  Specifies that the  window is to  have a
  1874.                                   File menu that will  incorporates a  Save
  1875.                                   option. If this option  is specified the
  1876.                                   lpMenuHandler argument must not be NULL.
  1877.  
  1878.                     TVS_FILESAVEASSpecifies that the  window is to  have a
  1879.                                   File menu that will  incorporates a  Save
  1880.                                   As option. If this  option is  specified
  1881.                                   the lpMenuHandler argument  must not  be
  1882.                                   NULL.
  1883.  
  1884.                     TVS_FILEPRINT Specifies that the  window is to  have a
  1885.                                   File menu that includes  a Print option.
  1886.                                   If  this   option   is   specified   the
  1887.                                   lpMenuHandler argument must not be NULL.
  1888.  
  1889.                     TVS_HSCROLL   Specifies that the  window is  to permit
  1890.                                   horizontal scrolling by the user.
  1891.  
  1892.                     TVS_MAXIMIZE  Specifies that the  window is to  have a
  1893.                                   maximize box.
  1894.  
  1895.                     TVS_MINIMIZE  Specifies that the  window is to  have a
  1896.                                   minimize box.
  1897.  
  1898.                     TVS_NOCLOSE   Specifies that the  Close option  on the
  1899.                                   window's system menu is to be inhibited.
  1900.                                   If this  option is  used the  window can
  1901.                                   only  be   destroyed   by   a  call   to
  1902.                                   TVDestroyWindow
  1903.                                   TVDestroyWindow
  1904.                                   TVDestroyWindow. This option  is ignored
  1905.                                   if TVS_SYSMENU is not specified also.
  1906.  
  1907.                     TVS_NORESIZE  Specifies that the window is not to have
  1908.                                   a  thick  frame  allowing  the  user  to
  1909.                                   resize it.
  1910.  
  1911.                     TVS_SCROLLMENU
  1912.                                   Specifies that the  window is to  have a
  1913.                                   Scroll menu, allowing the user to switch
  1914.                                   between manual and  automatic scrolling.
  1915.                                   This option  requires  one  or  both  of
  1916.                                   TVS_HSCROLL and  TVS_VSCROLL to  also be
  1917.                                   defined.
  1918.  
  1919.                                   If   this   option   is   omitted,   the
  1920.                                   application must switch  scrolling modes
  1921.                                   if   required    with    a    call    to
  1922.                                   TVSetScrollState
  1923.                                   TVSetScrollState
  1924.                                   TVSetScrollState.
  1925.  
  1926.                     TVS_SYSMENU   Specifies that the  window is to  have a
  1927.                                   system menu. If this  option is used and
  1928.                                   the TVS_NOCLOSE option is  not used, the
  1929.                                   lpMenuHandler argument must not be NULL.
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.                                      Page 
  1937.                                      Page 
  1938.                                      Page 18
  1939.                                           18
  1940.                                           18
  1941.  
  1942.  
  1943.  
  1944.                                  The TextView DLL
  1945.                                  The TextView DLL
  1946.                                  The TextView DLL
  1947.  
  1948.  
  1949.                     TVS_TIMESTAMP Specifies  that  lines  written  to  the
  1950.                                   window   are    to    automatically   be
  1951.                                   timestamped.  TextView
  1952.                                                 TextView
  1953.                                                 TextView will  prepend  the
  1954.                                   current  Windows  time  (the  number  of
  1955.                                   milliseconds since Windows  was started)
  1956.                                   to the text supplied.
  1957.  
  1958.                     TVS_VSCROLL   Specifies that the  window is  to permit
  1959.                                   vertical scrolling by the user.
  1960.  
  1961.        Callback
  1962.        Callback
  1963.        Callback     void FAR PASCAL 
  1964.                     void FAR PASCAL 
  1965.                     void FAR PASCAL MenuHandler(hWnd,nMenuItem)
  1966.                     HWND
  1967.                     HWND
  1968.                     HWND      hWnd;
  1969.                                   ;
  1970.                                   ;
  1971.                     WORD
  1972.                     WORD
  1973.                     WORD      nMenuItem;
  1974.                                        ;
  1975.                                        ;
  1976.  
  1977.                     MenuHandler is  a  place-holder  for  the  application-
  1978.                     supplied  function  name.  The  actual  name   must  be
  1979.                     exported by including it in an EXPORTS
  1980.                                                    EXPORTS
  1981.                                                    EXPORTS statement in the
  1982.                     application's module definition file.
  1983.  
  1984.                     _________
  1985.                     Parameter
  1986.                     _________
  1987.                     Parameter
  1988.                     _________
  1989.                     Parameter     ________________
  1990.                                   Type/Description
  1991.                                   ________________
  1992.                                   Type/Description
  1993.                                   ________________
  1994.                                   Type/Description
  1995.  
  1996.                     hWnd          HWND
  1997.                                   HWND
  1998.                                   HWND Identifies the  window  whose menu
  1999.                                   item has been selected
  2000.  
  2001.                     nMenuItem     WORD
  2002.                                   WORD
  2003.                                   WORD Identifies    the     menu    item
  2004.                                   concerned. The  value  will  be one  of
  2005.                                   those in the table below.
  2006.  
  2007.  
  2008.  
  2009.                     The menu handler callback function will be  informed of
  2010.                     which menu  option has  been clicked  in the  nMenuItem
  2011.                     argument. The value will  be one of  those in the  list
  2012.                     below; if the  dwFlags argument to  TVCreateWindow
  2013.                                                         TVCreateWindow
  2014.                                                         TVCreateWindow did
  2015.                     not enable a menu  item the corresponding  notification
  2016.                     value will not occur.
  2017.  
  2018.                     TVMI_AUTOSCROLL
  2019.                                   Specifies that the user  has clicked the
  2020.                                   Automatic   option   in   the   window's
  2021.                                   Scrolling  menu.   TextView   will  have
  2022.                                   already set  the  window  into automatic
  2023.                                   scrolling state  and  hidden  any scroll
  2024.                                   bars.
  2025.  
  2026.                     TVMI_CLOSE    Specifies that the user  has clicked the
  2027.                                   Close  option  on  the  window's  system
  2028.                                   menu. The window will  already have been
  2029.                                   destroyed when this event is notified.
  2030.  
  2031.                     TVMI_FILESAVE Specifies that the user  has clicked the
  2032.                                   Save option in the window's File menu.
  2033.  
  2034.                     TVMI_FILESAVEAS
  2035.                                   Specifies that the user  has clicked the
  2036.                                   Save As  option  in  the  window's   File
  2037.                                   menu.
  2038.  
  2039.  
  2040.                                      Page 
  2041.                                      Page 
  2042.                                      Page 19
  2043.                                           19
  2044.                                           19
  2045.  
  2046.  
  2047.  
  2048.                                  The TextView DLL
  2049.                                  The TextView DLL
  2050.                                  The TextView DLL
  2051.  
  2052.  
  2053.                     TVMI_FILEPRINTSpecifies that the user  has clicked the
  2054.                                   Print option in the window's File menu.
  2055.  
  2056.                     TVMI_MANUALSCROLL
  2057.                                   Specifies that the user  has clicked the
  2058.                                   Manual option in  the window's  Scrolling
  2059.                                   menu. TextView will already have set the
  2060.                                   window into  manual  scrolling  mode and
  2061.                                   drawn the required scroll bars.
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.                                      Page 
  2113.                                      Page 
  2114.                                      Page 20
  2115.                                           20
  2116.                                           20
  2117.  
  2118.  
  2119.  
  2120.                                  The TextView DLL
  2121.                                  The TextView DLL
  2122.                                  The TextView DLL
  2123.  
  2124.  
  2125.        TVDestroyWindow
  2126.        TVDestroyWindow
  2127.        TVDestroyWindow
  2128.  
  2129.        Syntax
  2130.        Syntax
  2131.        Syntax       BOOL
  2132.                     BOOL
  2133.                     BOOL      TVDestroyWindow
  2134.                               TVDestroyWindow
  2135.                               TVDestroyWindow(hWnd)
  2136.  
  2137.                     Destroys  a  window  created  with  the  TVCreateWindow
  2138.                                                              TVCreateWindow
  2139.                                                              TVCreateWindow
  2140.                     function.
  2141.  
  2142.                     _________
  2143.                     Parameter
  2144.                     _________
  2145.                     Parameter
  2146.                     _________
  2147.                     Parameter     ________________
  2148.                                   Type/Description
  2149.                                   ________________
  2150.                                   Type/Description
  2151.                                   ________________
  2152.                                   Type/Description
  2153.  
  2154.                     hWnd          HWND
  2155.                                   HWND
  2156.                                   HWND Specifies the handle to the window
  2157.                                   to be destroyed.
  2158.                                                  .
  2159.                                                  .
  2160.  
  2161.  
  2162.  
  2163.        Return Value
  2164.        Return Value
  2165.        Return Value The function  returns  TRUE
  2166.                                            TRUE
  2167.                                            TRUE if  the  window  has  been
  2168.                     destroyed.
  2169.                              .
  2170.                              .
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.                                      Page 
  2215.                                      Page 
  2216.                                      Page 21
  2217.                                           21
  2218.                                           21
  2219.  
  2220.  
  2221.  
  2222.                                  The TextView DLL
  2223.                                  The TextView DLL
  2224.                                  The TextView DLL
  2225.  
  2226.  
  2227.        TVGetWindowStatus
  2228.        TVGetWindowStatus
  2229.        TVGetWindowStatus
  2230.  
  2231.        Syntax
  2232.        Syntax
  2233.        Syntax       BOOL
  2234.                     BOOL
  2235.                     BOOL      TVGetWindowStatus
  2236.                               TVGetWindowStatus
  2237.                               TVGetWindowStatus(hWnd,lpStatusBlock)
  2238.  
  2239.                     This function returns status information for a TextView
  2240.                                                                    TextView
  2241.                                                                    TextView
  2242.                     window.
  2243.  
  2244.                     _________
  2245.                     Parameter
  2246.                     _________
  2247.                     Parameter
  2248.                     _________
  2249.                     Parameter     ________________
  2250.                                   Type/Description
  2251.                                   ________________
  2252.                                   Type/Description
  2253.                                   ________________
  2254.                                   Type/Description
  2255.  
  2256.                     hWnd          HWND
  2257.                                   HWND
  2258.                                   HWND Specifies the handle to the window
  2259.                                   concerned.
  2260.  
  2261.                     lpStatusBlock LPTVWSTATUS
  2262.                                   LPTVWSTATUS
  2263.                                   LPTVWSTATUS    A  FAR   pointer   to  a
  2264.                                   TVWSTATUS
  2265.                                   TVWSTATUS
  2266.                                   TVWSTATUS block  whose  values  will be
  2267.                                   filled in by this call.
  2268.  
  2269.  
  2270.  
  2271.        Return Value
  2272.        Return Value
  2273.        Return Value The return value will be TRUE if the call succeeded and
  2274.                     the status information was returned.
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.                                      Page 
  2315.                                      Page 
  2316.                                      Page 22
  2317.                                           22
  2318.                                           22
  2319.  
  2320.  
  2321.  
  2322.                                  The TextView DLL
  2323.                                  The TextView DLL
  2324.                                  The TextView DLL
  2325.  
  2326.  
  2327.        TVOutputText
  2328.        TVOutputText
  2329.        TVOutputText
  2330.  
  2331.        Syntax
  2332.        Syntax
  2333.        Syntax       BOOL
  2334.                     BOOL
  2335.                     BOOL      TVOutputText
  2336.                               TVOutputText
  2337.                               TVOutputText(hWnd,lpString,nCount)
  2338.  
  2339.                     Writes one line of text to a TextView
  2340.                                                  TextView
  2341.                                                  TextView window. The text
  2342.                     is stored in the window's buffer; if this  contains the
  2343.                     maximum number of lines  specified when the window  was
  2344.                     created, the oldest stored line will be replaced.
  2345.  
  2346.                     If the  TVS_TIMESTAMP
  2347.                             TVS_TIMESTAMP
  2348.                             TVS_TIMESTAMP option  was  specified  when the
  2349.                     window was created, TextView
  2350.                                         TextView
  2351.                                         TextView will prefix  the supplied
  2352.                     text with the  current Windows  time before  displaying
  2353.                     it.
  2354.  
  2355.                     Tab characters will be expanded to the  width specified
  2356.                     when the window was created.
  2357.  
  2358.                     The text will  be written using  the colour defined  by
  2359.                     the  last  call  to  TVSetTextColor
  2360.                                          TVSetTextColor
  2361.                                          TVSetTextColor,  or  in  black  by
  2362.                     default.
  2363.  
  2364.                     _________
  2365.                     Parameter
  2366.                     _________
  2367.                     Parameter
  2368.                     _________
  2369.                     Parameter     ________________
  2370.                                   Type/Description
  2371.                                   ________________
  2372.                                   Type/Description
  2373.                                   ________________
  2374.                                   Type/Description
  2375.  
  2376.                     hWnd          HWND
  2377.                                   HWND
  2378.                                   HWND Specifies the handle to the window
  2379.                                   concerned.
  2380.  
  2381.                     lpString      LPSTR
  2382.                                   LPSTR
  2383.                                   LPSTR     Points to  the  string  to be
  2384.                                   written.
  2385.  
  2386.                     nCount        int
  2387.                                   int
  2388.                                   int  Specifies the number of characters
  2389.                                   in the string. If the value is zero the
  2390.                                   string will  be  assumed  to  be  null-
  2391.                                   terminated and will  be written  in its
  2392.                                   entirety.
  2393.  
  2394.  
  2395.  
  2396.        Return Value
  2397.        Return Value
  2398.        Return Value The  return  value  will  be  TRUE
  2399.                                                   TRUE
  2400.                                                   TRUE  if  the  text  was
  2401.                     successfully displayed.
  2402.  
  2403.        Comments
  2404.        Comments
  2405.        Comments     There are three conditions in  which the text will  not
  2406.                     be displayed in the window as requested:
  2407.  
  2408.                     1. If the window has been put into suspended state with
  2409.                     a call  to TVSuspendWindow
  2410.                                TVSuspendWindow
  2411.                                TVSuspendWindow, the  call to   TVOutputText
  2412.                                                                TVOutputText
  2413.                                                                TVOutputText
  2414.                     will be silently ignored.
  2415.  
  2416.                     2. If the application  has called TVReturnData
  2417.                                                       TVReturnData
  2418.                                                       TVReturnData to read
  2419.                     back the lines stored  in the window,  and has not  yet
  2420.                     ended the call-back loop, the call to TVOutputText
  2421.                                                           TVOutputText
  2422.                                                           TVOutputText will
  2423.                     be silently ignored.
  2424.  
  2425.                     3. If the  window is  in manual scroll  mode, the  call
  2426.                     will  also  be  silently  ignored.  However,   TextView
  2427.                                                                    TextView
  2428.                                                                    TextView
  2429.                     records the number of lines lost when this  occurs, and
  2430.                     will add a line to the window itself to notify the user
  2431.                     when the window returns to automatic scroll mode.
  2432.  
  2433.  
  2434.                                      Page 
  2435.                                      Page 
  2436.                                      Page 23
  2437.                                           23
  2438.                                           23
  2439.  
  2440.  
  2441.  
  2442.                                  The TextView DLL
  2443.                                  The TextView DLL
  2444.                                  The TextView DLL
  2445.  
  2446.  
  2447.                     In all  these cases,  TVOutputText
  2448.                                           TVOutputText
  2449.                                           TVOutputText returns  a value  of
  2450.                     TRUE
  2451.                     TRUE
  2452.                     TRUE to the  caller. A  FALSE
  2453.                                             FALSE
  2454.                                             FALSE value is  used solely  to
  2455.                     indicate a system problem such as insufficient memory.
  2456.  
  2457.                     Text longer than 512 bytes will be truncated.
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                                      Page 
  2513.                                      Page 
  2514.                                      Page 24
  2515.                                           24
  2516.                                           24
  2517.  
  2518.  
  2519.  
  2520.                                  The TextView DLL
  2521.                                  The TextView DLL
  2522.                                  The TextView DLL
  2523.  
  2524.  
  2525.        TVRegisterClass
  2526.        TVRegisterClass
  2527.        TVRegisterClass
  2528.  
  2529.        Syntax
  2530.        Syntax
  2531.        Syntax       BOOL
  2532.                     BOOL
  2533.                     BOOL
  2534.                               TVRegisterClass
  2535.                               TVRegisterClass
  2536.                               TVRegisterClass(hInstance,lpClassName,hIcon,h
  2537.                     brBackground)
  2538.  
  2539.                     This  function  registers  a  window  class   that  can
  2540.                     subsequently be passed  to TVCreateWindow
  2541.                                                TVCreateWindow
  2542.                                                TVCreateWindow to  create a
  2543.                     TextView
  2544.                     TextView
  2545.                     TextView window. The use of the function is  similar to
  2546.                     that of the RegisterClass
  2547.                                 RegisterClass
  2548.                                 RegisterClass function, with the exception
  2549.                     that TextView
  2550.                          TextView
  2551.                          TextView itself will  supply most  of the details
  2552.                     required.
  2553.  
  2554.                     _________
  2555.                     Parameter
  2556.                     _________
  2557.                     Parameter
  2558.                     _________
  2559.                     Parameter     ________________
  2560.                                   Type/Description
  2561.                                   ________________
  2562.                                   Type/Description
  2563.                                   ________________
  2564.                                   Type/Description
  2565.  
  2566.                     hInstance     HANDLE
  2567.                                   HANDLE
  2568.                                   HANDLE    Specifies  the  application's
  2569.                                   instance handle.
  2570.  
  2571.                     lpClassName   LPSTR
  2572.                                   LPSTR
  2573.                                   LPSTR     Points to  a  null-terminated
  2574.                                   string containing the name  to be given
  2575.                                   to the window class.
  2576.  
  2577.                     hIcon         HICON
  2578.                                   HICON
  2579.                                   HICON     Specifies  a  handle  to  the
  2580.                                   icon  to  be  used  when  the   TextView
  2581.                                                                   TextView
  2582.                                                                   TextView
  2583.                                   window is  minimized.  It  must not  be
  2584.                                   NULL.
  2585.  
  2586.                     hbrBackground HBRUSH
  2587.                                   HBRUSH
  2588.                                   HBRUSH    Specifies      the      class
  2589.                                   background brush to  be applied  to the
  2590.                                   window. The meaning  is as  defined for
  2591.                                   the hbrBackground item of  the  WNDCLASS
  2592.                                                                   WNDCLASS
  2593.                                                                   WNDCLASS
  2594.                                   structure, with the  exception that the
  2595.                                   value must not be NULL.
  2596.  
  2597.  
  2598.  
  2599.        Return Value
  2600.        Return Value
  2601.        Return Value The function returns TRUE
  2602.                                          TRUE
  2603.                                          TRUE if the class  was registered
  2604.                     successfully.
  2605.  
  2606.        Comments
  2607.        Comments
  2608.        Comments     An error return  value of FALSE
  2609.                                               FALSE
  2610.                                               FALSE will result  both from
  2611.                     the class name already having been registered, and from
  2612.                     invalid arguments being supplied.
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.                                      Page 
  2631.                                      Page 
  2632.                                      Page 25
  2633.                                           25
  2634.                                           25
  2635.  
  2636.  
  2637.  
  2638.                                  The TextView DLL
  2639.                                  The TextView DLL
  2640.                                  The TextView DLL
  2641.  
  2642.  
  2643.        TVResetWindow
  2644.        TVResetWindow
  2645.        TVResetWindow
  2646.  
  2647.        Syntax
  2648.        Syntax
  2649.        Syntax       BOOL
  2650.                     BOOL
  2651.                     BOOL      TVResetWindow
  2652.                               TVResetWindow
  2653.                               TVResetWindow(hWnd)
  2654.  
  2655.                     This functions resets a  TextView
  2656.                                              TextView
  2657.                                              TextView window to an  'empty'
  2658.                     state. All stored text is discarded, and the  window is
  2659.                     redrawn empty. The  window will be  put into  automatic
  2660.                     scroll mode, and will be  marked as not suspended.  The
  2661.                     text colour will be set to black.
  2662.  
  2663.                     _________
  2664.                     Parameter
  2665.                     _________
  2666.                     Parameter
  2667.                     _________
  2668.                     Parameter     ________________
  2669.                                   Type/Description
  2670.                                   ________________
  2671.                                   Type/Description
  2672.                                   ________________
  2673.                                   Type/Description
  2674.  
  2675.                     hWnd          HWND
  2676.                                   HWND
  2677.                                   HWND Specifies the handle of the window
  2678.                                   concerned.
  2679.  
  2680.  
  2681.  
  2682.        Return Value
  2683.        Return Value
  2684.        Return Value The  function  will  return   TRUE
  2685.                                                   TRUE
  2686.                                                   TRUE  if  the   operation
  2687.                     succeeded.
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.                                      Page 
  2729.                                      Page 
  2730.                                      Page 26
  2731.                                           26
  2732.                                           26
  2733.  
  2734.  
  2735.  
  2736.                                  The TextView DLL
  2737.                                  The TextView DLL
  2738.                                  The TextView DLL
  2739.  
  2740.  
  2741.        TVReturnData
  2742.        TVReturnData
  2743.        TVReturnData
  2744.  
  2745.        Syntax
  2746.        Syntax
  2747.        Syntax       int
  2748.                     int
  2749.                     int
  2750.                               TVReturnData
  2751.                               TVReturnData
  2752.                               TVReturnData(hWnd,lpBuffer,nSize,lpNotifyFunc
  2753.                     )
  2754.  
  2755.                     This function  requests  TextView to  return  the  data
  2756.                     stored  in  a  TextView  window  into  an  application-
  2757.                     supplied buffer.  TextView
  2758.                                       TextView
  2759.                                       TextView will  copy successive  lines
  2760.                     into the buffer, and will call back into a notification
  2761.                     function to inform  the application that  each line  is
  2762.                     ready. The process continues until either all the lines
  2763.                     have been  returned or  the callback  function  returns
  2764.                     zero.
  2765.  
  2766.                     _________
  2767.                     Parameter
  2768.                     _________
  2769.                     Parameter
  2770.                     _________
  2771.                     Parameter     ________________
  2772.                                   Type/Description
  2773.                                   ________________
  2774.                                   Type/Description
  2775.                                   ________________
  2776.                                   Type/Description
  2777.  
  2778.                     hWnd          HWND
  2779.                                   HWND
  2780.                                   HWND Specifies the handle to the window
  2781.                                   concerned.
  2782.  
  2783.                     lpBuffer      LPSTR
  2784.                                   LPSTR
  2785.                                   LPSTR     Points to  the  application's
  2786.                                   buffer into  which  TextView
  2787.                                                       TextView
  2788.                                                       TextView will  copy
  2789.                                   successive lines.
  2790.  
  2791.                     nSize         int
  2792.                                   int
  2793.                                   int  Specifies   the   size    of   the
  2794.                                   application's buffer.
  2795.  
  2796.                     lpNotifyFunc  FARPROC
  2797.                                   FARPROC
  2798.                                   FARPROC   The        procedure-instance
  2799.                                   address of  the callback  function used
  2800.                                   to notify  the  application  when  each
  2801.                                   line has been copied into the buffer.
  2802.  
  2803.  
  2804.  
  2805.        Return Value
  2806.        Return Value
  2807.        Return Value The return value specifies  the last value returned  by
  2808.                     the callback function. Its meaning is user-defined.
  2809.  
  2810.        Comments
  2811.        Comments
  2812.        Comments     The address passed as the lpNotifyFunc argument must be
  2813.                     created by using the MakeProcInstance
  2814.                                          MakeProcInstance
  2815.                                          MakeProcInstance function.
  2816.  
  2817.                     The callback  function  must  use  the  Pascal  calling
  2818.                     convention and be declared FAR
  2819.                                                FAR
  2820.                                                FAR.
  2821.  
  2822.        Callback
  2823.        Callback
  2824.        Callback     int FAR PASCAL
  2825.                     int FAR PASCAL
  2826.                     int FAR PASCAL
  2827.                     NotifyFunc(hWnd,lpBuffer,nCount,nTruncated)
  2828.                     HWND
  2829.                     HWND
  2830.                     HWND      hWnd;
  2831.                     LPSTR
  2832.                     LPSTR
  2833.                     LPSTR     lpBuffer;
  2834.                     int
  2835.                     int
  2836.                     int       nCount;
  2837.                     BOOL
  2838.                     BOOL
  2839.                     BOOL      nTruncated;
  2840.  
  2841.                     NotifyFunc  is  a  placeholder  for  the   application-
  2842.                     supplied  function  name.  The  actual  name   must  be
  2843.                     exported by including it in an EXPORTS statement in the
  2844.                     application's module definition file.
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.                                      Page 
  2851.                                      Page 
  2852.                                      Page 27
  2853.                                           27
  2854.                                           27
  2855.  
  2856.  
  2857.  
  2858.                                  The TextView DLL
  2859.                                  The TextView DLL
  2860.                                  The TextView DLL
  2861.  
  2862.  
  2863.                     _________
  2864.                     Parameter
  2865.                     _________
  2866.                     Parameter
  2867.                     _________
  2868.                     Parameter     ________________
  2869.                                   Type/Description
  2870.                                   ________________
  2871.                                   Type/Description
  2872.                                   ________________
  2873.                                   Type/Description
  2874.  
  2875.                     hWnd          HWND
  2876.                                   HWND
  2877.                                   HWND Specifies the handle to the window
  2878.                                   concerned.
  2879.  
  2880.                     lpBuffer      LPSTR
  2881.                                   LPSTR
  2882.                                   LPSTR     Points  to  the  application-
  2883.                                   supplied buffer  that now  contains the
  2884.                                   text of a line of text from the window.
  2885.  
  2886.                     nCount        int
  2887.                                   int
  2888.                                   int  Specifies the  line  number within
  2889.                                   the window corresponding  to this call.
  2890.                                   The first line is numbered zero.
  2891.  
  2892.                     nTruncated    BOOL
  2893.                                   BOOL
  2894.                                   BOOL      This value  will  be  TRUE if
  2895.                                   the text  had  to be  truncated  to fit
  2896.                                   into the supplied buffer.
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.                                      Page 
  2941.                                      Page 
  2942.                                      Page 28
  2943.                                           28
  2944.                                           28
  2945.  
  2946.  
  2947.  
  2948.                                  The TextView DLL
  2949.                                  The TextView DLL
  2950.                                  The TextView DLL
  2951.  
  2952.  
  2953.        TVSaveWindowToFile
  2954.        TVSaveWindowToFile
  2955.        TVSaveWindowToFile
  2956.  
  2957.        Syntax
  2958.        Syntax
  2959.        Syntax       BOOL
  2960.                     BOOL
  2961.                     BOOL
  2962.                               TVSaveWindowToFile
  2963.                               TVSaveWindowToFile
  2964.                               TVSaveWindowToFile(hWnd,hFile,nStart,nLines,d
  2965.                     wFlags)
  2966.  
  2967.                     This function  writes the  data stored  for a  TextView
  2968.                                                                    TextView
  2969.                                                                    TextView
  2970.                     window into a file. It can  be called at any time,  and
  2971.                     not only in response  to the user  clicking an item  in
  2972.                     the window's File menu.
  2973.  
  2974.                     _________
  2975.                     Parameter
  2976.                     _________
  2977.                     Parameter
  2978.                     _________
  2979.                     Parameter     ________________
  2980.                                   Type/Description
  2981.                                   ________________
  2982.                                   Type/Description
  2983.                                   ________________
  2984.                                   Type/Description
  2985.  
  2986.                     hWnd          HWND
  2987.                                   HWND
  2988.                                   HWND Specifies the handle to the window
  2989.                                   concerned.
  2990.  
  2991.                     hFile         int
  2992.                                   int
  2993.                                   int  Specifies the MSDOS  handle to the
  2994.                                   file  to  which  the   data  is  to  be
  2995.                                   written. The file must have been opened
  2996.                                   for writing.
  2997.  
  2998.                     nStart        int
  2999.                                   int
  3000.                                   int  Specifies the number  of the first
  3001.                                   stored line to be  written to the file.
  3002.                                   The first line is numbered zero.
  3003.  
  3004.                     nLines        int
  3005.                                   int
  3006.                                   int  Specifies the  number of  lines to
  3007.                                   be written.  A value  of -1  will write
  3008.                                   all the  lines  stored  from the  first
  3009.                                   specified to the end of the buffer.
  3010.  
  3011.                     dwFlags       DWORD
  3012.                                   DWORD
  3013.                                   DWORD     Must be set to 0L.
  3014.  
  3015.  
  3016.  
  3017.        Return Value
  3018.        Return Value
  3019.        Return Value The function returns TRUE
  3020.                                          TRUE
  3021.                                          TRUE if the operation succeeded. A
  3022.                     value of FALSE
  3023.                              FALSE
  3024.                              FALSE indicates either that the range of lines
  3025.                     requested  was  invalid,  or  that  an  error  occurred
  3026.                     writing the  file. In  the latter  case, TextView
  3027.                                                              TextView
  3028.                                                              TextView will
  3029.                     display a message to alert the user.
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.                                      Page 
  3051.                                      Page 
  3052.                                      Page 29
  3053.                                           29
  3054.                                           29
  3055.  
  3056.  
  3057.  
  3058.                                  The TextView DLL
  3059.                                  The TextView DLL
  3060.                                  The TextView DLL
  3061.  
  3062.  
  3063.        TVSetBkColor
  3064.        TVSetBkColor
  3065.        TVSetBkColor
  3066.  
  3067.        Syntax
  3068.        Syntax
  3069.        Syntax       DWORD
  3070.                     DWORD
  3071.                     DWORD     TVSetBkColor
  3072.                               TVSetBkColor
  3073.                               TVSetBkColor(hWnd,crColor)
  3074.  
  3075.                     This function sets the background colour used when text
  3076.                     is written to a TextView
  3077.                                     TextView
  3078.                                     TextView window.
  3079.  
  3080.                     _________
  3081.                     Parameter
  3082.                     _________
  3083.                     Parameter
  3084.                     _________
  3085.                     Parameter     ________________
  3086.                                   Type/Description
  3087.                                   ________________
  3088.                                   Type/Description
  3089.                                   ________________
  3090.                                   Type/Description
  3091.  
  3092.                     hWnd          HWND
  3093.                                   HWND
  3094.                                   HWND Specifies the handle to the window
  3095.                                   concerned.
  3096.  
  3097.                     crColor       COLORREF
  3098.                                   COLORREF
  3099.                                   COLORREF  Specifies the  new background
  3100.                                   colour.
  3101.  
  3102.  
  3103.  
  3104.        Return Value
  3105.        Return Value
  3106.        Return Value The function will return the previously set  colour, or
  3107.                     -1 if an error occurs.
  3108.  
  3109.        Comments
  3110.        Comments
  3111.        Comments     TextView
  3112.                     TextView
  3113.                     TextView  does  not  record  background  colours   with
  3114.                     individual messages. As the screen is scrolled messages
  3115.                     that are written will use the text colour  defined when
  3116.                     they were  stored, but  the current background  colour
  3117.                     value.
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.                                      Page 
  3153.                                      Page 
  3154.                                      Page 30
  3155.                                           30
  3156.                                           30
  3157.  
  3158.  
  3159.  
  3160.                                  The TextView DLL
  3161.                                  The TextView DLL
  3162.                                  The TextView DLL
  3163.  
  3164.  
  3165.        TVSetRedraw
  3166.        TVSetRedraw
  3167.        TVSetRedraw
  3168.  
  3169.        Syntax
  3170.        Syntax
  3171.        Syntax       WORD
  3172.                     WORD
  3173.                     WORD      TVSetRedraw
  3174.                               TVSetRedraw
  3175.                               TVSetRedraw(hWnd,nNewState)
  3176.  
  3177.                     This function sets the redraw of a TextView
  3178.                                                        TextView
  3179.                                                        TextView window. If
  3180.                     the state is set to FALSE
  3181.                                         FALSE
  3182.                                         FALSE, lines written to the window
  3183.                     with TVOutputText
  3184.                          TVOutputText
  3185.                          TVOutputText will be stored,  but the screen will
  3186.                     not be updated until the state is changed to TRUE
  3187.                                                                  TRUE
  3188.                                                                  TRUE.
  3189.  
  3190.                     _________
  3191.                     Parameter
  3192.                     _________
  3193.                     Parameter
  3194.                     _________
  3195.                     Parameter     ________________
  3196.                                   Type/Description
  3197.                                   ________________
  3198.                                   Type/Description
  3199.                                   ________________
  3200.                                   Type/Description
  3201.  
  3202.                     hWnd          HWND
  3203.                                   HWND
  3204.                                   HWND Specifies the handle to the window
  3205.                                   concerned.
  3206.  
  3207.                     nNewState     BOOL
  3208.                                   BOOL
  3209.                                   BOOL      Specifies the new state to be
  3210.                                   set.
  3211.  
  3212.  
  3213.  
  3214.        Return Value
  3215.        Return Value
  3216.        Return Value The function will return  the previous redraw state  of
  3217.                     the window.
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.                                      Page 
  3257.                                      Page 
  3258.                                      Page 31
  3259.                                           31
  3260.                                           31
  3261.  
  3262.  
  3263.  
  3264.                                  The TextView DLL
  3265.                                  The TextView DLL
  3266.                                  The TextView DLL
  3267.  
  3268.  
  3269.        TVSetScrollState
  3270.        TVSetScrollState
  3271.        TVSetScrollState
  3272.  
  3273.        Syntax
  3274.        Syntax
  3275.        Syntax       WORD
  3276.                     WORD
  3277.                     WORD      TVSetScrollState
  3278.                               TVSetScrollState
  3279.                               TVSetScrollState(hWnd,nNewState)
  3280.  
  3281.                     This function sets  the scrolling state  of a  TextView
  3282.                                                                    TextView
  3283.                                                                    TextView
  3284.                     window.
  3285.  
  3286.                     _________
  3287.                     Parameter
  3288.                     _________
  3289.                     Parameter
  3290.                     _________
  3291.                     Parameter     ________________
  3292.                                   Type/Description
  3293.                                   ________________
  3294.                                   Type/Description
  3295.                                   ________________
  3296.                                   Type/Description
  3297.  
  3298.                     hWnd          HWND
  3299.                                   HWND
  3300.                                   HWND Specifies the handle to the window
  3301.                                   concerned.
  3302.  
  3303.                     nNewState     WORD
  3304.                                   WORD
  3305.                                   WORD Specifies the new state to be set.
  3306.                                   The value should be  TV_SCR_AUTO
  3307.                                                        TV_SCR_AUTO
  3308.                                                        TV_SCR_AUTO to set
  3309.                                   automatic scrolling,  or   TV_SCR_MANUAL
  3310.                                                              TV_SCR_MANUAL
  3311.                                                              TV_SCR_MANUAL
  3312.                                   to set manual scrolling.
  3313.  
  3314.  
  3315.  
  3316.        Return Value
  3317.        Return Value
  3318.        Return Value The function will return  the previous scrolling  state
  3319.                     of the window as  wither TV_SCR_AUTO
  3320.                                              TV_SCR_AUTO
  3321.                                              TV_SCR_AUTO or  TV_SCR_MANUAL
  3322.                                                              TV_SCR_MANUAL
  3323.                                                              TV_SCR_MANUAL.
  3324.                     It will return zero if an error occurs, or if  the call
  3325.                     to TVCreateWindow
  3326.                        TVCreateWindow
  3327.                        TVCreateWindow did not  specify one or  both of the
  3328.                     TVS_HSCROLL
  3329.                     TVS_HSCROLL
  3330.                     TVS_HSCROLL and TVS_VSCROLL
  3331.                                     TVS_VSCROLL
  3332.                                     TVS_VSCROLL options.
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.                                      Page 
  3369.                                      Page 
  3370.                                      Page 32
  3371.                                           32
  3372.                                           32
  3373.  
  3374.  
  3375.  
  3376.                                  The TextView DLL
  3377.                                  The TextView DLL
  3378.                                  The TextView DLL
  3379.  
  3380.  
  3381.        TVSetTextColor
  3382.        TVSetTextColor
  3383.        TVSetTextColor
  3384.  
  3385.        Syntax
  3386.        Syntax
  3387.        Syntax       DWORD
  3388.                     DWORD
  3389.                     DWORD     TVSetTextColor
  3390.                               TVSetTextColor
  3391.                               TVSetTextColor(hWnd,crColor)
  3392.  
  3393.                     This function sets the colour in which text  is written
  3394.                     to a TextView
  3395.                          TextView
  3396.                          TextView window.
  3397.  
  3398.                     _________
  3399.                     Parameter
  3400.                     _________
  3401.                     Parameter
  3402.                     _________
  3403.                     Parameter     ________________
  3404.                                   Type/Description
  3405.                                   ________________
  3406.                                   Type/Description
  3407.                                   ________________
  3408.                                   Type/Description
  3409.  
  3410.                     hWnd          HWND
  3411.                                   HWND
  3412.                                   HWND Specifies the handle to the window
  3413.                                   concerned.
  3414.  
  3415.                     crColor       COLORREF
  3416.                                   COLORREF
  3417.                                   COLORREF  Specifies the colour in which
  3418.                                   text is to be written.
  3419.  
  3420.  
  3421.  
  3422.        Return Value
  3423.        Return Value
  3424.        Return Value The function will return the previously set  colour, or
  3425.                     -1 if an error occurs.
  3426.  
  3427.        Comments
  3428.        Comments
  3429.        Comments     Using this function does not affect the colour  of text
  3430.                     that has already been written.
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.                                      Page 
  3469.                                      Page 
  3470.                                      Page 33
  3471.                                           33
  3472.                                           33
  3473.  
  3474.  
  3475.  
  3476.                                  The TextView DLL
  3477.                                  The TextView DLL
  3478.                                  The TextView DLL
  3479.  
  3480.  
  3481.        TVSuspendWindow
  3482.        TVSuspendWindow
  3483.        TVSuspendWindow
  3484.  
  3485.        Syntax
  3486.        Syntax
  3487.        Syntax       BOOL
  3488.                     BOOL
  3489.                     BOOL      TVSuspendWindow
  3490.                               TVSuspendWindow
  3491.                               TVSuspendWindow(hWnd,nNewState)
  3492.  
  3493.                     Sets the suspend state of a TextView
  3494.                                                 TextView
  3495.                                                 TextView window.
  3496.  
  3497.                     _________
  3498.                     Parameter
  3499.                     _________
  3500.                     Parameter
  3501.                     _________
  3502.                     Parameter     ________________
  3503.                                   Type/Description
  3504.                                   ________________
  3505.                                   Type/Description
  3506.                                   ________________
  3507.                                   Type/Description
  3508.  
  3509.                     hWnd          HWND
  3510.                                   HWND
  3511.                                   HWND Specifies the handle to the window
  3512.                                   concerned.
  3513.  
  3514.                     nNewState     BOOL
  3515.                                   BOOL
  3516.                                   BOOL      Specifies  the  state  to  be
  3517.                                   set. It should  be  TRUE
  3518.                                                       TRUE
  3519.                                                       TRUE to suspend  the
  3520.                                   window, and FALSE
  3521.                                               FALSE
  3522.                                               FALSE to desuspend it.
  3523.  
  3524.  
  3525.  
  3526.        Return Value
  3527.        Return Value
  3528.        Return Value The return value is the  previous suspend state of  the
  3529.                     window.
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.                                      Page 
  3571.                                      Page 
  3572.                                      Page 34
  3573.                                           34
  3574.                                           34
  3575.  
  3576.  
  3577.  
  3578.                                  The TextView DLL
  3579.                                  The TextView DLL
  3580.                                  The TextView DLL
  3581.  
  3582.  
  3583.        TVVersion
  3584.        TVVersion
  3585.        TVVersion
  3586.  
  3587.        Syntax
  3588.        Syntax
  3589.        Syntax       void
  3590.                     void
  3591.                     void      TVVersion
  3592.                               TVVersion
  3593.                               TVVersion(lpMark,lpVersion,lpCycle)
  3594.  
  3595.                     Returns the version identification of the TextView
  3596.                                                               TextView
  3597.                                                               TextView DLL.
  3598.                     This consists of a mark number, a version number within
  3599.                     that mark, and a  compilation cycle number within that
  3600.                     version.
  3601.  
  3602.                     _________
  3603.                     Parameter
  3604.                     _________
  3605.                     Parameter
  3606.                     _________
  3607.                     Parameter     ________________
  3608.                                   Type/Description
  3609.                                   ________________
  3610.                                   Type/Description
  3611.                                   ________________
  3612.                                   Type/Description
  3613.  
  3614.                     lpMark        LPINT
  3615.                                   LPINT
  3616.                                   LPINT     Pointer to an  int
  3617.                                                            int
  3618.                                                            int to receive
  3619.                                   the mark number.
  3620.  
  3621.                     lpVersion     LPINT
  3622.                                   LPINT
  3623.                                   LPINT     Pointer to an  int
  3624.                                                            int
  3625.                                                            int to receive
  3626.                                   the version number.
  3627.  
  3628.                     lpCycle       LPINT
  3629.                                   LPINT
  3630.                                   LPINT     Pointer to an  int
  3631.                                                            int
  3632.                                                            int to receive
  3633.                                   the cycle number.
  3634.  
  3635.  
  3636.  
  3637.        Return Value
  3638.        Return Value
  3639.        Return Value The function has no return value.
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.                                      Page 
  3677.                                      Page 
  3678.                                      Page 35
  3679.                                           35
  3680.                                           35
  3681.  
  3682.  
  3683.  
  3684.                                  The TextView DLL
  3685.                                  The TextView DLL
  3686.                                  The TextView DLL
  3687.  
  3688.  
  3689.        D
  3690.        D
  3691.        DATA 
  3692.         ATA 
  3693.         ATA T
  3694.             T
  3695.             TYPES AND 
  3696.              YPES AND 
  3697.              YPES AND S
  3698.                       S
  3699.                       STRUCTURES
  3700.                        TRUCTURES
  3701.                        TRUCTURES
  3702.  
  3703.  
  3704.        This section  describes  the data  types  and  structures that  are
  3705.        defined by  TextView
  3706.                    TextView
  3707.                    TextView. Definitions of  all the  items described here
  3708.        are contain in the header file textview.h
  3709.                                       textview.h
  3710.                                       textview.h.
  3711.  
  3712.  
  3713.           Data types
  3714.           Data types
  3715.           Data types
  3716.  
  3717.           The data types in the  following list are key  words that define
  3718.           the size and meaning  of arguments and  return values associated
  3719.           with TextView
  3720.                TextView
  3721.                TextView functions.
  3722.  
  3723.            ____
  3724.            Type
  3725.            ____
  3726.            Type
  3727.            ____
  3728.            Type                   __________
  3729.                                   Definition
  3730.                                   __________
  3731.                                   Definition
  3732.                                   __________
  3733.                                   Definition
  3734.  
  3735.            LPTVWSTATUS
  3736.            LPTVWSTATUS
  3737.            LPTVWSTATUS            Long  pointer  to  a   TVWSTATUS
  3738.                                                          TVWSTATUS
  3739.                                                          TVWSTATUS  data
  3740.                                   structure.
  3741.  
  3742.  
  3743.  
  3744.  
  3745.           Data structures
  3746.           Data structures
  3747.           Data structures
  3748.  
  3749.           This section lists data structures that are used by TextView
  3750.                                                               TextView
  3751.                                                               TextView.
  3752.  
  3753.           TVWSTATUS
  3754.           TVWSTATUS
  3755.           TVWSTATUS
  3756.  
  3757.           Status Information for a TextView Window
  3758.           Status Information for a TextView Window
  3759.           Status Information for a TextView Window
  3760.  
  3761.                  The TVWSTATUS
  3762.                      TVWSTATUS
  3763.                      TVWSTATUS structure contains  information giving  the
  3764.                  current status of a TextView
  3765.                                      TextView
  3766.                                      TextView window.
  3767.  
  3768.                  typedef struct sTVWSTATUS
  3769.                  typedef struct sTVWSTATUS
  3770.                  typedef struct sTVWSTATUS
  3771.                  {
  3772.                  {
  3773.                  {
  3774.                      DWORD
  3775.                      DWORD
  3776.                      DWORD      dwFlags;
  3777.                                 dwFlags;
  3778.                                 dwFlags;
  3779.                      int
  3780.                      int
  3781.                      int        nMaxLines;
  3782.                                 nMaxLines;
  3783.                                 nMaxLines;
  3784.                      int
  3785.                      int
  3786.                      int        nLinesStored;
  3787.                                 nLinesStored;
  3788.                                 nLinesStored;
  3789.                      BOOL
  3790.                      BOOL
  3791.                      BOOL       nSuspended;
  3792.                                 nSuspended;
  3793.                                 nSuspended;
  3794.                      BOOL
  3795.                      BOOL
  3796.                      BOOL       nReturningData;
  3797.                                 nReturningData;
  3798.                                 nReturningData;
  3799.                      BOOL
  3800.                      BOOL
  3801.                      BOOL       nRedraw;
  3802.                                 nRedraw;
  3803.                                 nRedraw;
  3804.                      WORD
  3805.                      WORD
  3806.                      WORD       nScrollState;
  3807.                                 nScrollState;
  3808.                                 nScrollState;
  3809.                      int
  3810.                      int
  3811.                      int        nTabSize;
  3812.                                 nTabSize;
  3813.                                 nTabSize;
  3814.                      int
  3815.                      int
  3816.                      int        nMessagesLost;
  3817.                                 nMessagesLost;
  3818.                                 nMessagesLost;
  3819.                      int
  3820.                      int
  3821.                      int        nRows;
  3822.                                 nRows;
  3823.                                 nRows;
  3824.                      int
  3825.                      int
  3826.                      int        nColumns;
  3827.                                 nColumns;
  3828.                                 nColumns;
  3829.                      int
  3830.                      int
  3831.                      int        nTopLine;
  3832.                                 nTopLine;
  3833.                                 nTopLine;
  3834.                      int
  3835.                      int
  3836.                      int        nNextRow;
  3837.                                 nNextRow;
  3838.                                 nNextRow;
  3839.                      COLORREF
  3840.                      COLORREF
  3841.                      COLORREF   crColor;
  3842.                                 crColor;
  3843.                                 crColor;
  3844.                      COLORREF
  3845.                      COLORREF
  3846.                      COLORREF   crBkColor;
  3847.                                 crBkColor;
  3848.                                 crBkColor;
  3849.                  } TVWSTATUS;
  3850.                  } TVWSTATUS;
  3851.                  } TVWSTATUS;
  3852.  
  3853.                  The TVWSTATUS structure has the following fields:
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.                                      Page 
  3861.                                      Page 
  3862.                                      Page 36
  3863.                                           36
  3864.                                           36
  3865.  
  3866.  
  3867.  
  3868.                                  The TextView DLL
  3869.                                  The TextView DLL
  3870.                                  The TextView DLL
  3871.  
  3872.  
  3873.                  _________
  3874.                  Parameter
  3875.                  _________
  3876.                  Parameter
  3877.                  _________
  3878.                  Parameter      ___________
  3879.                                 Description
  3880.                                 ___________
  3881.                                 Description
  3882.                                 ___________
  3883.                                 Description
  3884.  
  3885.                  dwFlags
  3886.                  dwFlags
  3887.                  dwFlags        Contains a  copy of  the  dwFlags argument
  3888.                                 passed to  the  TVCreateWindow
  3889.                                                 TVCreateWindow
  3890.                                                 TVCreateWindow  call  that
  3891.                                 created the window.
  3892.  
  3893.                  nMaxLines
  3894.                  nMaxLines
  3895.                  nMaxLines      Specifies the maximum number of lines that
  3896.                                 may be stored with the window.
  3897.  
  3898.                  nLinesStored
  3899.                  nLinesStored
  3900.                  nLinesStored   Specifies the  number  of  lines currently
  3901.                                 stored with the window.
  3902.  
  3903.                  nSuspended
  3904.                  nSuspended
  3905.                  nSuspended     Specifies whether the  window is currently
  3906.                                 in suspended state.
  3907.  
  3908.                  nReturningDat
  3909.                  nReturningDat
  3910.                  nReturningDat  Specifies whether  TextView
  3911.                                                    TextView
  3912.                                                    TextView  is  currently
  3913.                  a
  3914.                  a
  3915.                  a              servicing a  TVReturnData
  3916.                                              TVReturnData
  3917.                                              TVReturnData  call  for  this
  3918.                                 window.
  3919.  
  3920.                  nRedraw
  3921.                  nRedraw
  3922.                  nRedraw        Specifies whether  lines  written  to  the
  3923.                                 window are being displayed immediately, or
  3924.                                 are being  held until  a window  redraw is
  3925.                                 permitted.
  3926.  
  3927.                  nScrollState
  3928.                  nScrollState
  3929.                  nScrollState   Specifies the current scroll  state of the
  3930.                                 window.   The   value   will   be   either
  3931.                                 TV_SCR_AUTO
  3932.                                 TV_SCR_AUTO
  3933.                                 TV_SCR_AUTO or TV_SCR_MANUAL
  3934.                                                TV_SCR_MANUAL
  3935.                                                TV_SCR_MANUAL.
  3936.  
  3937.                  nTabSize
  3938.                  nTabSize
  3939.                  nTabSize       Specifies the  width  of  a  tab  stop, in
  3940.                                 characters.
  3941.  
  3942.                  nMessagesLost
  3943.                  nMessagesLost
  3944.                  nMessagesLost  Specifies the number of messages that have
  3945.                                 been lost by  being written  to the window
  3946.                                 while it  is in  manual scroll  state. The
  3947.                                 value is cleared whenever the scroll state
  3948.                                 is set to automatic.
  3949.  
  3950.                  nRows
  3951.                  nRows
  3952.                  nRows          Specifies the current depth of the window,
  3953.                                 in text rows.
  3954.  
  3955.                  nColumns
  3956.                  nColumns
  3957.                  nColumns       Specifies the current width of the window,
  3958.                                 in average characters.
  3959.  
  3960.                  nTopLine
  3961.                  nTopLine
  3962.                  nTopLine       Specifies the  line  number  of  the  line
  3963.                                 currently displayed  at  the  top  of  the
  3964.                                 window.
  3965.  
  3966.                  nNextRow
  3967.                  nNextRow
  3968.                  nNextRow       Specifies the window row to which the next
  3969.                                 line of  text will  be written  (the first
  3970.                                 row is  numbered  zero). If  the  value is
  3971.                                 negative, the window is full and will need
  3972.                                 to be scrolled to accept the next line.
  3973.  
  3974.                  crColor
  3975.                  crColor
  3976.                  crColor        The current text colour.
  3977.  
  3978.                  crBkColor
  3979.                  crBkColor
  3980.                  crBkColor      The current background colour.
  3981.  
  3982.  
  3983.  
  3984.                                      Page 
  3985.                                      Page 
  3986.                                      Page 37
  3987.                                           37
  3988.                                           37
  3989.  
  3990.  
  3991.  
  3992.                                  The TextView DLL
  3993.                                  The TextView DLL
  3994.                                  The TextView DLL
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.                                      Page 
  4057.                                      Page 
  4058.                                      Page 38
  4059.                                           38
  4060.                                           38
  4061.  
  4062.  
  4063.  
  4064.                                  The TextView DLL
  4065.                                  The TextView DLL
  4066.                                  The TextView DLL
  4067.  
  4068.  
  4069.        A
  4070.        A
  4071.        APPENDIX 
  4072.         PPENDIX 
  4073.         PPENDIX : T
  4074.                 : T
  4075.                 : THE 
  4076.                    HE 
  4077.                    HE D
  4078.                       D
  4079.                       DEMONSTRATION 
  4080.                        EMONSTRATION 
  4081.                        EMONSTRATION P
  4082.                                     P
  4083.                                     PROGRAM
  4084.                                      ROGRAM
  4085.                                      ROGRAM
  4086.  
  4087.  
  4088.        Supplied with the  TextView
  4089.                           TextView
  4090.                           TextView DLL in  the full  distribution set  are
  4091.        full sources for  a demonstration program  that both show  you what
  4092.        the system can do, and supplement the  information in this guide on
  4093.        how to program with it.
  4094.  
  4095.        The sources  are Copyright  (c)  Alan Phillips  1991.  However, the
  4096.        techniques shown within them may be freely used and adopted for any
  4097.        non-commercial applications.
  4098.  
  4099.  
  4100.           A real-time program trace facility
  4101.           A real-time program trace facility
  4102.           A real-time program trace facility
  4103.  
  4104.           The purpose of the demonstration program is  to show you how you
  4105.           can use  TextView
  4106.                    TextView
  4107.                    TextView to add  a real-time  tracing facility  to your
  4108.           application.
  4109.  
  4110.           Of course, there are many ways to debug  a program while you are
  4111.           developing it.  You  can  use  Microsoft's  CodeView  system  to
  4112.           monitor it; but  this is  relatively clumsy and,  until CodeView
  4113.           3.05, required you to have two monitors attached to your system.
  4114.           Even with single monitor capability, CodeView debugging can be a
  4115.           time-consuming business.
  4116.  
  4117.           If you know the area where  a bug is occurring,  you might plant
  4118.           MessageBox
  4119.           MessageBox
  4120.           MessageBox calls  at suitable  points  to stop  the  program and
  4121.           display details. This, though, is very  laborious, requiring you
  4122.           to click an OK box every time; and if your bug is  deep inside a
  4123.           loop might well be totally impractical.
  4124.  
  4125.           TextView
  4126.           TextView
  4127.           TextView lets you add a real-time trace facility to your program
  4128.           with ease.  In essence,  you can  regard  it as  giving  you the
  4129.           ability you have in  DOS programs of performing  printf
  4130.                                                            printf
  4131.                                                            printf calls to
  4132.           the screen: the  messages appear as  you write them,  and scroll
  4133.           off the top of  the screen to  make room for  new ones. However,
  4134.           with  TextView
  4135.                 TextView
  4136.                 TextView you  have a  permanent record  of as  many of  the
  4137.           lines as you  choose, and  can at any  time scroll  back through
  4138.           them.
  4139.  
  4140.           Typically, you  would  add  simple  text  output calls  to  your
  4141.           program as  you develop  it,  writing out  progress  records and
  4142.           useful values  as  you go.  The  trace
  4143.                                            trace
  4144.                                            trace routine  in  the supplied
  4145.           sources is  a basic  example of  such a  routine. Its  action is
  4146.           controlled by a simple  on or off  flag that  is settable from  a
  4147.           menu, so you  can activate  or de-activate tracing  whenever you
  4148.           want. Of course, you  could add more  sophisticated criteria, to
  4149.           allow you  to trace,  for  example, only  certain  categories of
  4150.           events or at certain debug levels.
  4151.  
  4152.  
  4153.           Running the demonstration
  4154.           Running the demonstration
  4155.           Running the demonstration
  4156.  
  4157.           To run  the  demonstration you  must  first  have installed  the
  4158.           TextView
  4159.           TextView
  4160.           TextView DLL as described  earlier. Then, you can  start it from
  4161.           the Program  Manager,  the File  Manager  or  any other  program
  4162.           launcher you may have.
  4163.  
  4164.                                      Page 
  4165.                                      Page 
  4166.                                      Page 39
  4167.                                           39
  4168.                                           39
  4169.  
  4170.  
  4171.  
  4172.                                  The TextView DLL
  4173.                                  The TextView DLL
  4174.                                  The TextView DLL
  4175.  
  4176.  
  4177.              Trace menu items
  4178.              Trace menu items
  4179.              Trace menu items
  4180.  
  4181.              All the actions  of the demonstration  program are controlled
  4182.              by options in the trace menu. Some of the options control the
  4183.              trace system's  operation;  others  simulate  an  application
  4184.              writing messages as it runs.
  4185.  
  4186.                 Start tracing
  4187.                 Start tracing
  4188.                 Start tracing
  4189.  
  4190.                 This option activates tracing. If a  trace window does not
  4191.                 already exist,  it  causes  a  call  to  TVCreateWindow
  4192.                                                          TVCreateWindow
  4193.                                                          TVCreateWindow to
  4194.                 create one. The global  tracing flag is set to on, so that
  4195.                 the trace routine becomes active.
  4196.  
  4197.                 Stop tracing
  4198.                 Stop tracing
  4199.                 Stop tracing
  4200.  
  4201.                 Sets the global  tracing flag to   off, so  that the  trace
  4202.                 routine does nothing.  The trace  window is  not affected.
  4203.                 These two options  show on  way of controlling  the system
  4204.                 from your application.
  4205.  
  4206.                 Write one message
  4207.                 Write one message
  4208.                 Write one message
  4209.  
  4210.                 Causes one call to  the trace routine to  write a message.
  4211.                 Depending on the setting of the  global tracing flag, text
  4212.                 either will or will not appear in the trace window.
  4213.  
  4214.                 Write batch
  4215.                 Write batch
  4216.                 Write batch
  4217.  
  4218.                 Writes a batch of  200 messages in a  loop, to demonstrate
  4219.                 how the TextView
  4220.                         TextView
  4221.                         TextView window scrolls.
  4222.  
  4223.                 Write batch fast
  4224.                 Write batch fast
  4225.                 Write batch fast
  4226.  
  4227.                 Writes a  batch  of 200  messages  in a  loop.  Unlike the
  4228.                 previous option,  the  TVSetRedraw
  4229.                                        TVSetRedraw
  4230.                                        TVSetRedraw function  is  called to
  4231.                 inhibit updating  of  the  TextView
  4232.                                            TextView
  4233.                                            TextView window  while  this  is
  4234.                 being done. The  effect is  that the messages  are written
  4235.                 substantially faster.
  4236.  
  4237.                 Reset trace window
  4238.                 Reset trace window
  4239.                 Reset trace window
  4240.  
  4241.                 Calls the TVResetWindow
  4242.                           TVResetWindow
  4243.                           TVResetWindow function to clear all  data stored
  4244.                 in the TextView
  4245.                        TextView
  4246.                        TextView window.
  4247.  
  4248.                 Show trace window
  4249.                 Show trace window
  4250.                 Show trace window
  4251.  
  4252.                 This option uses normal Windows API  functions to make the
  4253.                 TextView
  4254.                 TextView
  4255.                 TextView window visible,  and bring it  to the top  of the
  4256.                 screen. It shows you one case  in which you can manipulate
  4257.                 the window with normal  Windows functions as  well as with
  4258.                 TextView
  4259.                 TextView
  4260.                 TextView functions.
  4261.  
  4262.                 Show trace status
  4263.                 Show trace status
  4264.                 Show trace status
  4265.  
  4266.                 Calls  the  TVGetWindowStatus
  4267.                             TVGetWindowStatus
  4268.                             TVGetWindowStatus  function  to  display  some
  4269.                 details of what the TextView
  4270.                                     TextView
  4271.                                     TextView window is doing.
  4272.  
  4273.  
  4274.                                      Page 
  4275.                                      Page 
  4276.                                      Page 40
  4277.                                           40
  4278.                                           40
  4279.  
  4280.  
  4281.  
  4282.                                  The TextView DLL
  4283.                                  The TextView DLL
  4284.                                  The TextView DLL
  4285.  
  4286.  
  4287.                 Trace window scrolling
  4288.                 Trace window scrolling
  4289.                 Trace window scrolling
  4290.  
  4291.                 This menu  option  shows you  a  further  popup menu  item
  4292.                 containing two items:  Automatic and Manual. These let you
  4293.                 change the scrolling state of the TextView
  4294.                                                   TextView
  4295.                                                   TextView window from the
  4296.                 application's menu.
  4297.  
  4298.                 You can also change the scrolling state from the  Scrolling
  4299.                 item in  the  TextView
  4300.                               TextView
  4301.                               TextView window's   own menu.  Note  how  the
  4302.                 application uses  the menu  notification facility  to keep
  4303.                 the check marks on its  menu item in line  with the window
  4304.                 state when this is done.
  4305.  
  4306.                 Copy trace window
  4307.                 Copy trace window
  4308.                 Copy trace window
  4309.  
  4310.                 This menu item creates a second  TextView
  4311.                                                  TextView
  4312.                                                  TextView window, and uses
  4313.                 the TVReturnData
  4314.                     TVReturnData
  4315.                     TVReturnData function to  copy all  the data from  the
  4316.                 first one into it.
  4317.  
  4318.                 Kill trace window
  4319.                 Kill trace window
  4320.                 Kill trace window
  4321.  
  4322.                 This destroys  the  TextView
  4323.                                     TextView
  4324.                                     TextView window  and  deletes all  the
  4325.                 stored data.
  4326.  
  4327.  
  4328.           Source files
  4329.           Source files
  4330.           Source files
  4331.  
  4332.           The demonstration program source comprises a  number of modules,
  4333.           which are described briefly  below. For full  details you should
  4334.           consult the  actual sources,  which  contain a  large  amount of
  4335.           explanatory comment.
  4336.  
  4337.  
  4338.              main.c
  4339.              main.c
  4340.              main.c
  4341.  
  4342.              This is the entry point module for the demonstration program.
  4343.              It contains  the  message  processing  routine that  services
  4344.              messages sent to the  main window. Note, of  course, that the
  4345.              application contains no code at all to service  messages sent
  4346.              to the TextView
  4347.                     TextView
  4348.                     TextView window - the DLL handles all of this itself.
  4349.  
  4350.  
  4351.              trace.c
  4352.              trace.c
  4353.              trace.c
  4354.  
  4355.              This module contains  the routines  that service most  of the
  4356.              Trace menu items, and the  trace routine itself. This routine
  4357.              is written to  accept a  format string, such  as you  pass to
  4358.              printf, and a variable number of arguments of any type.
  4359.  
  4360.              Also in  this  module  is  the  menu handler  function.  This
  4361.              routine is called  back from  the Windows  DLL to  notify the
  4362.              application when  the user  clicks  an item  in  the  TextView
  4363.                                                                    TextView
  4364.                                                                    TextView
  4365.              window's menu.
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.                                      Page 
  4373.                                      Page 
  4374.                                      Page 41
  4375.                                           41
  4376.                                           41
  4377.  
  4378.  
  4379.  
  4380.                                  The TextView DLL
  4381.                                  The TextView DLL
  4382.                                  The TextView DLL
  4383.  
  4384.  
  4385.              copy.c
  4386.              copy.c
  4387.              copy.c
  4388.  
  4389.              This module handles the  Copy Trace Window menu item. It sets
  4390.              up a second  TextView
  4391.                           TextView
  4392.                           TextView window and  calls  TVReturnData
  4393.                                                       TVReturnData
  4394.                                                       TVReturnData to read
  4395.              the contents of the first.
  4396.  
  4397.  
  4398.              utils.c
  4399.              utils.c
  4400.              utils.c
  4401.  
  4402.              This contains a few small utility routines.
  4403.  
  4404.  
  4405.           Building the program
  4406.           Building the program
  4407.           Building the program
  4408.  
  4409.           The demonstration  sources  are  written  to  be  compiled  with
  4410.           Microsoft C 6.00A. You may need to  make adjustments if you have
  4411.           a different compiler.
  4412.  
  4413.           The makefile is written for a  UNIX-compatible make program such
  4414.           as  ndmake. If  you  use  the  Microsoft  nmake utility  in  the
  4415.           Programmer's Work Bench you will need to amend it.
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.                                      Page 
  4455.                                      Page 
  4456.                                      Page 42
  4457.                                           42
  4458.                                           42
  4459.