Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  
  Windows sends each event to an application in the form of a
  message.  Each message is either put into a message queue,
  maintained automatically by Windows, or sent immediately to a
  window procedure (it may be a dialog procedure, as a dialog is
  just a kind of window).
  
  In Clip-4-Win applications you have a choice of 3 mechanisms
  to handle messages.
  
  1. Let Clip-4-Win try to handle them for you, in which case
  the messages are handled by an internal window procedure.
  Later, you may get Clip-4-Win events.  See below for more
  detail.
  
  2. Intercept some messages yourself for immediate processing,
  but otherwise let Clip-4-Win deal with them.  You do this
  using window subclassing.
  
  3. Do it all yourself, using the "traditional" Windows
  combination of a GetMessage(), TranslateMessage(),
  DispatchMessage() loop, and window procedures.
  
  These are in increasing order of difficulty, especially for
  those who didn't understand number 3!  Most people should
  start with number 1.  Some window subclassing is quite easy.
  Whether you want to use mechanism 3 really depends on your
  abilities.  You certainly want to know Windows well, and/or
  get some good books.
  
  You can move code from mechanism to mechanism quite easily, as
  they're all variations on the same theme.
  
  The rest of this section deals with mechanism number 1.  The
  next section is about window subclassing.  You should
  definitely read both.  Mechanism 3 is impossible to cover
  properly in a manual of this size.
  
  Using mechanism 1, Clip-4-Win automatically retrieves messages
  whenever it can and deals with all the ones it can do itself.
  This not only makes your application simpler, but also speeds
  things up, as the Clipper code you would need to deal with
  these messages would be much slower than the Clip-4-Win code.
  
  Other events are put into a queue maintained by Clip-4-Win,
  and made available to your application.  You can check this
  queue using the ChkEvent() function, but you can also use
  Clipper's INKEY() and other functions.  This lets you keep
  much existing code.  However, you should plan to move to using
  ChkEvent(), so that you can deal with any of the events that
  have to be ignored by INKEY() and its friends.
  
  The event queue stores each event and any further data
  associated with that event.  Windows sends an event and its
  data in a standard form, which can be a bit confusing due to
  the naming convention used and the way values are sometimes
  packed together.  Clip-4-Win provides functions to access the
  data, and also helps with the unpacking.  Even so, you should
  know the format used by Windows to send messages, if only to
  help you understand some of the function names used by Clip-4-
  Win.
  
  The message sent by Windows is made up of the following items
  of data, whose names can be chosen by the developer, but are
  conventionally as shown:
  
       data item      data type      meaning
  
       hWnd           window handle  the window the event relates to
  
       msg            16-bit number  the message number (one of the
                                     WM_* values in WINDOWS.CH)
  
       wParam         16-bits of data   additional data
  
       lParam         32-bits of data   additional data
  
  The wParam and lParam values may be various data types,
  depending on the message.  They always appear to Clipper as
  numerics, though.
  
  
  Clip-4-Win always makes these values available, even when it
  provides decoded versions of them.  The msg value will have
  been used to determine the event number (i.e. one of the
  EVENT_* values).  Sometimes the other parameters are also used
  to decide the event number.
  
  The most recent event your Clipper application has retrieved
  (e.g. using the ChkEvent() function) can be retrieved again
  using the _LastEvent() function.
  
  The parameters of the message from Windows are available from
  the functions _LasthWnd(), _LastMsg(), _LastwParam() and
  _LastlParam().  The high and low 16-bit values of lParam are
  available from the functions _LastHilParam() and
  _LastLolParam().
  
  Clip-4-Win also provides the functions MouseX(), MouseY(),
  MouseRow(), MouseCol() and _LastExtra().  (The latter is
  mainly for internal use.)
  
  The ChkEvent() function is supplied in source form to allow
  customisation, should you wish it.  You will see its main
  purpose is to fetch an event, if there is one, using the
  _ChkEvent() function, and handle menu selections immediately.
  (You are not expected to change that particular section of
  code.)
  
  Remember, in all cases the window handle is available from the
  function _LasthWnd().  If you only have one window (as in
  many applications), you may not find this function of much
  use.
  
  The following events are currently defined (see WINDOWS.CH):

                     (see part 2)




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