From: Steven Vere
Subject: function to read cursor (mouse) position in Harlequin Lispworks for Windows?
Date: 
Message-ID: <71kvvf$j6l@sjx-ixn8.ix.netcom.com>
   I recently transferred some Lisp software from Harlequin Lispworks
on the DEC Alpha to Lispworks for Windows running on a Pentium II.  On
the Alpha under OSF/1 I used the function call (xlib:query-pointer
<pane>) to give me the x,y coordinates of the cursor (mouse) on a
graphics pane.  I can't find the function to do this in the Lispworks
for Windows system.  Can someone please tell me the name of the
function which will do this?  It has to give the mouse position WITHOUT
clicking the mouse button.  I already know how to get the mouse
position if I click a mouse button.

Thanks very much.

Steven Vere
From: Marc Battyani
Subject: Re: function to read cursor (mouse) position in Harlequin Lispworks for Windows?
Date: 
Message-ID: <3A250CCC2747917D.2A83AA75F0B753F5.F2812C60E134B521@library-proxy.airnews.net>
Steven Vere wrote in message <··········@sjx-ixn8.ix.netcom.com>...
>   I recently transferred some Lisp software from Harlequin Lispworks
>on the DEC Alpha to Lispworks for Windows running on a Pentium II.  On
>the Alpha under OSF/1 I used the function call (xlib:query-pointer
><pane>) to give me the x,y coordinates of the cursor (mouse) on a
>graphics pane.  I can't find the function to do this in the Lispworks
>for Windows system.  Can someone please tell me the name of the
>function which will do this?  It has to give the mouse position WITHOUT
>clicking the mouse button.  I already know how to get the mouse
>position if I click a mouse button.
>
>Thanks very much.
>
>Steven Vere

Try this in :

;; typedef struct tagPOINT { LONG x ; LONG y ; } POINT , *PPOINT , NEAR
*NPPOINT , FAR *LPPOINT ;
(fli:define-c-struct :point
  (x :long)
  (y :long)
  )

(fli:define-c-typedef :lppoint (:pointer :point))

;; BOOL GetCursorPos ( LPPOINT lpPoint ) ;
(fli:define-foreign-function (get-cursor-pos "GetCursorPos") ((lppoint
:lppoint))
 :langage :c
 :calling-convention :stdcall
 :result-type (:boolean :long)
 :module "user32.dll")

(defun get-cursor-pos ()
  (fli:with-dynamic-foreign-objects ()
     (let ((pt (fli:allocate-dynamic-foreign-object :type :point)))
       (%get-cursor-pos pt)
       (values (fli:foreign-slot-value pt 'x) (fli:foreign-slot-value pt
'y)))))

CL-USER 5 > (get-cursor-pos)
1257
625

CL-USER 6 > (get-cursor-pos)
37
21

Hope this helps.
You could also statically allocate and keep foreign structure :point.

Marc Battyani
Context Free Ltd