⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 moustrap.prn

📁 鼠标中断高级开发功能  
💻 PRN
📖 第 1 页 / 共 4 页
字号:
     We'll redefine all of our pages, buttons, and hot spots,  exactly as
     we  did the first time.   We'll also change the mouse  cursor,  this
     time  to something a bit more exciting than before,  a red plus sign
     on a green background (color 2).

     do {
             Activate_Mouse_Page(z);
             c=Get_Char_Mouse_Kbd();
             printf("Page Z: Character \"%c\"",c);

     Again, we activate page Z, and get a character from it.   This works
     exactly as it did in  the first loop using single page mode.

             DeActivate_Mouse_Page(z);
             Activate_Mouse_Page(y);
             c=Get_Char_Mouse_Kbd();
             printf("Page Y: Character \"%c\"",c);

     And  again,  we activate page Y,  and get a character from it.   The
     only difference is that we had to first deactivate page Z.

             Activate_Mouse_Page(z);
             c=Get_Char_Mouse_Kbd();
             printf("Page Y & Z: Character \"%c\"",c);

     Now we get flashy.  Without deactivate page Y, we'll reactivate page
     Z.  You will notice that the mouse can now move within a much larger
     area,  specifically  the  rectangle which circumscribes both of  the
     smaller rectangle.   Notice that if you click the left button in the
     area that is not within the boundaries of either page,  "1"  will be
     return.   This  is because the button definition says to return  "1"
     whenever page Z is active,  regardless of where the cursor is,  even
     if  it is outside the stated area of Page Z.   However,  notice that
     the  Hot  Spots of the left button in page Y,  take precedence  over
     this.   This  is  because the BUTTON definition on page Y  was  give
     after the button definition off page Z, and therefore overrules it.






                                - Page 27 -



                                                            MouseTrap Library
                                                           September 21, 1988

             DeActivate_Mouse_Page(y);

     Now,  we deactivate page Y,  leaving only page Z.   Notice that this
     does not restrict the mouse's movements, which can still more around
     the area of both pages.   The only way the shirk the window again is
     by  executing  the  Clear_Mouse_Pages()  function.   (Executing  the
     Clear_All_Mouse_Definitions  function would also to the  trick,  but
     that's  a little more dramatic than we'd like at this  point)   This
     problem should be fixed in the next release.

             }
     }


     You  should  also  remember  that,  although we  always  used  ASCII
     characters  for  return  values in the example,   ANY  character  or
     integer value, in the range of 1 to 65534, can be used.





































                                - Page 28 -



                                                            MouseTrap Library
                                                           September 21, 1988






             Chapter 5

                             Technical Specification




             This  chapter  is  provided only to those who have  paid  to
     become  registered  uses.   This was done because I assumed that  it
     would  be  of little use to anyone who didn't have the  source  code
     (which  also comes with registration).   This method also gives me a
     few extra weeks to write it.





































                                - Page 29 -



                                                            MouseTrap Library
                                                           September 21, 1988







             Chapter 6

                             Appendix



                     A.      MOUSTRAP.H
                     B.      Global Variables
                     C.      Error Codes
                     D.      Reference
                     E.      Support





































                                - Page 30 -



                                                            MouseTrap Library
                                                           September 21, 1988


             Appendix A  :   MOUSTRAP.H


             The  header file,  MOUSTRAP.H should be included in every  C
     program  which  uses the MouseTrap Library functions.   It  includes
     complete  function  prototypes  for each of  the  MouseTrap  Library
     functions.  In addition,  it defines a number of constants which are
     to be used with the functions.  These include:

             M_Overlaid_Pages    -and-    M_Single_Pages,  which are used
     with the function Define_Mouse_System.

             M_Text_Coord -and- M_Graphic_Coord,  which are used with the
     Add_Mouse_Page function, to tell which system screen coordinates are
     being given in.

             M_Left, M_Right, M_Center, -and- M_Middle, which are used to
     refer  to the mouse buttons whenever necessary.   Note that M_Center
     and  M_Middle are equivalent,  and you may use whichever holds  your
     fancy.

             M_HORIZ -and- M_VERT, which are used with Set_Mouse_Limits.

             MERROR -and- MNOERROR, (-1 and 0,  respectively),  which are
     return  by  various  functions to indicate whether or not  an  error
     occurred.  Also defined are a large number of error codes, which are
     discussed further in appendix C.

             The  macro  TC()  is used to create an integer value in  the
     form BFCC, where B is the background color, F, the foreground color,
     and CC is a character.  This value is used by Set_Mouse_Text_Cursor,
     (and  by  other  routines  outside of the  MouseTrap  Library  which
     perform  direct screen writes).   The macro require that you give it
     the character,  foreground and background color code.  The statement
     TC('A',14,5) would produce the code 5E41h, which mean the letter 'A'
     in bright Yellow on a Magenta background.

             It also declared three global variables, which are described
     in Appendix B.

             Also  defined  is the data type "mouse_t"  which is used  to
     define  vitually  every  variable used in the  MouseTrap  functions.
     Also included are the structures definitions for Pages, buttons, and
     hot spots.  I'll not should what you can use them for, but I thought
     you might be interested.

             The  last  group of lines will "force"  LINK to include  the
     proper  version of the MouseTrap library,  without being  explicitly
     told  to.    This  will  only  work with  Microsoft  C  5.1.   Other
     compliers will probable generate a warning for these lines.



                                - Page 31 -



                                                            MouseTrap Library
                                                           September 21, 1988


             Appendix B  :   Global Variables


             There  are  three global variables used with  the  MouseTrap
     Function.  They are:

             _mouse_there:   This  is initialized to 0,  meaning no mouse
     available,   and   is   set   by  calling  either   Check_Mouse   or
     Define_Mouse_System.   After  a call to either of those functions it
     is  set  to either 0,  meaning that there is STILL no mouse on  this
     system, or, 2 or 3, giving the number of buttons on the mouse. Since
     "no mouse" is zero,  and "mouse present"  is nonzero,  this variable
     can also be used as a TRUE/FALSE value.

             M_Paging_Method  :  This  simply holding the value you  used
     with   Define_Mouse_System,   and  is  either  M_Overlaid_Pages   or
     M_Single_Pages.

             M_Error  :  This holds the error code of the last error that
     occurred.    Full  description  of  the  error  codes  is  given  in
     Appendix C.
































                                - Page 32 -



                                                            MouseTrap Library
                                                           September 21, 1988


             Appendix C   :  Error Codes.

             Error  conditions are indicated by a function returning  the
     value  MERROR (-1)  with the error code given in the global variable
     M_Error.   The  error  code remains in M_Error until either  cleared
     manually by the user or altered by another error.

             The error code are:

     MNOINIT         An  attempt  was  made to use one  of  the  advanced
                     functions without first calling Define_Mouse_System

     MNOMOUSE        An attempt was made to use a function while no mouse
                     was attached to the system.

     MNOSPACE        An attempt to add a new Page,  Button,  or hot  spot
                     failed  because there was not enough available  RAM.
                     Since  these definitions use so little memory,  this
                     error should rarely occur.

     MTOOMANY        An attempt was made to define more than 16 pages  in
                     Overlaid  mode,  or more than 65536 pages in  single
                     page  mode,  or more than 65536 hot spots (in either
                     mode).  Remember,  that all hot spots defined,  even
                     those  later  deleted,  count  towards  this  limit.
                     (Deleted pages, however, do not.)

     MNOREINIT       An  attempt  was made to  call  Define_Mouse_System,
                     after pages were added. All pages (and buttons,  and
                     hot  spots)  must be removed before a second call to
                     Define_Mouse_System may be made.
                     Use Clear_All_Mouse_Definitions().

     MNOTPAGE         An  attempt was made to reference a page which  had
                      not yet been defined.

     MNOTBUTTON       An attempt was made to reference a button which had
                      not yet been defined.

     MNOTHOTSPOT      An  attempt was made to reference a hot spot  which
                      had not yet been defined.

     MBUTTONRET       An  attempt was made to tied a hot spot  to  button
                      which already has it's own return value.

     MNOACTIVE        An attempt was made to call Read_Mouse with no page
                      active .






                                - Page 33 -



                                                            MouseTrap Library
                                                           September 21, 1988


             Appendix D  :   Reference


     Much of the information used to create this manual was taken from:

     Mouse System Corporation,  GOptimouse Reference Manual,  version 4.0H,
     Copyright 1984, 1985.

     Cort, Nigel. "GHow to Handle a Mouse,  part 1H."  The C Gazette.  2:4,
     March 1988.

     Cort, Nigel. "GHow to Handle a Mouse,  part 2.H"  The C Gazette.  3:1,
     Summer 1988








































                                - Page 34 -



                                                            MouseTrap Library
                                                           September 21, 1988


             Appendix E   :  Support

     James  M.  Curran  is the author of the MouseTrap Functions  and  is
     solely  responsible  for  it's  content.   Any  comments,   problem,
     suggestions, marriage proposals, or death threats stemming from this
     library should be directed to him at:
                             James M. Curran
                             24 Greendale Road
                             Cedar Grove, NJ 07009-1313

     Don't forget the "M."  since the family is just swarming with "James
     Curran"'s

     He can also be reached via Compuserve at [72261,655].

     And  for  the  more  adventurous,  he's also a  regular  on  several
     northern New Jersey BBS's under the handle "The Perfect Stranger"


     Special  Note  for  version 1.0:   Due to the painfully  short  time
     between  the  original  inspiration for this,  and my leaving  on  a
     European  trip (which,  I assume will do much to help me forget said
     pain), this entire project was written, debugged,  and documented in
     10 days (while still working at the day job).  Obviously,  there HAS
     to be some bugs lurking out there somewhere, if not in the functions
     themselves,  in  this documentation (there are,  by the  way,  three
     functions in the library that are not described here).  Any feedback
     from  users  will be of great assistance in putting out version  1.1
     when I get back.
























                                - Page 35 -


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -