Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - procentry() install a procedure to execute upon a key sequence http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 procentry()         Install a procedure to execute upon a key sequence
------------------------------------------------------------------------------
 Declaration
   tsr.hdr

 Syntax
   func logical procentry extern
   param       untyped xProcedure, ;
         const char    cKeyString, ;
         value uint    uCallType

 Arguments
   xProcedure is the function to install.

   cKeyString is a string specifying a hot key sequence.

   uCallType is the call type.

 Return
   A logical indicating the success of operation. A common failure is
   due to an invalid cKeyString.

 Description
   The procentry() function installs a resident procedure to be
   executed whenever the keypresses specified by cKeyString are
   recognized. The installed procedure is activated after the
   activateprocs() or tsr() procedure is executed.

   The procentry() function does not terminate the program. The
   tsr() procedure exits and makes the program resident. A program
   may have several entry points, each initialized through the
   procentry() procedure.

   cKeyString is a character string specifying the keys that activate the
   procedure xProcedure. It has the following format:

   "<key><key>...<key>"

   The '<' and '>' characters are required. Refer to the TSR table for valid
   character strings for NyString.

   Some examples on how to call procentry() with key sequences:
      procentry( TestFunc, "<Ctrl><E>" )
      procentry( TestFunc, "<F10>" )
      procentry( TestFunc, "<Leftshift><Ctrl><Alt><F>" )
      procentry( TestFunc, "<A>" )

   uCallType specifies when it is safe to invoke the installed
   procedure. This is necessary to define because DOS could be in the
   middle of a disk operation when the procedure is called, leaving DOS
   in an unstable state. See the TSR table for possible values.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   proc Test1 static
   ? "Routine 1"
   endproc
   
   proc Test2 static
   ? "Routine 2"
   endproc
   
   proc Test_procentry
   if procentry( Test1, "<Alt><Z>", TSR_CALL_DOS )
      if procentry( Test2, "<Alt><X>", TSR_CALL_DOS )
         activateprocs()
         ? "Press Alt-Z and Alt-X to invoke hot key routines, or Esc to exit"
         do while inkey() != K_ESC
            // here execute more code
         enddo
      endif
   endif
   endproc

   proc main
   Test_procentry()
   endproc

See Also: TSR table activateprocs()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson