[comp.windows.ms.programmer] Custom "cursors"

iam@waikato.ac.nz (Ian McDonald) (04/02/91)

I am writing an audio editor for Microsoft Windows.  For each audio window
there are two "cursors".  I want to be able to click on each cursor and then
drag it around (in similar style to a scroll bar dragging).

I am using Microsoft C and the SDK but hope to change to Borland C++ once it is
available in New Zealand.

I was wondering how to tackle these "cursors".  Is it best to create a new type
of resource or best to draw a graphic item on and watch the mouse messages or
should I make it a (very small) window??

Any help would be very much appreciated.
-- 
-------------------------------------------------------------------------
Ian McDonald  |                                           
52 Cook Street|                                             /  /\  /\
Hamilton      |   This space free for advertising !!       /  /  \/  \
New Zealand   |                                           /  /        \
+64-71-563438 |   I can receive mail but can't reply to it.  

epperson@adobe.COM (Mark Epperson) (04/02/91)

In article <1991Apr2.102934.3290@waikato.ac.nz> iam@waikato.ac.nz (Ian McDonald) writes:
>I am writing an audio editor for Microsoft Windows.  For each audio window
>there are two "cursors".  I want to be able to click on each cursor and then
>drag it around (in similar style to a scroll bar dragging).
>
>I am using Microsoft C and the SDK but hope to change to Borland C++ once it is
>available in New Zealand.
>
>I was wondering how to tackle these "cursors".  Is it best to create a new type
>of resource or best to draw a graphic item on and watch the mouse messages or
>should I make it a (very small) window??

One way to do this to erase the "cursor" that you drew on the screen and 
change the GWC_HCURSOR field in the window to a cursor (loaded from a resource
with LoadCursor()).  This will cause windows to draw that cursor sa soon
as you move the mouse, replacing the bitmap "cursor" which you have erased.  
The redraw your cursor and change the GWC_HCURSOR field back when you get
the WM_LBUTTONUP message.

- Mark Epperson

gpsteffl@sunee.waterloo.edu (Glenn Steffler) (04/02/91)

In article <1991Apr2.102934.3290@waikato.ac.nz> iam@waikato.ac.nz (Ian McDonald) writes:
>I am writing an audio editor for Microsoft Windows.  For each audio window
>there are two "cursors".  I want to be able to click on each cursor and then
>drag it around (in similar style to a scroll bar dragging).

A good solution (i.e. one that I will recommend but not sanction as a 
relief from world hunger) would be to integrate the cursors as a part
of a window definition used to display an audio resource.  The window
function would handle the mouse down (capture mouse and do the appropriate
work on mouse moves) and wait for mouse up.  Keep the current cursor
position in some window extra bytes, and integrate the cursors in the
paint message.

I don't recommend the separate windows (all of one bit wide) as they may not
appear in front of the data if the data is the same colour (I suppose
you can control that) and the windows must be moved every time the 
audio window is moved.  Talk about having your cake eating it and 
then having your cake and eating it...I'm not sure what I mean here.  Anyway,
just say *NO* to extra windows!! :-)

>Ian McDonald  |                                           
(I had to follow up here as you said you could not reply to my mail, and
 I would thus not be sure you got it, get it?)

-- 
Windows Sumo Wrestler                "Bo doesn't know software" - George Brett
  --(Windows 3.0, a combination of modern moodring technology and voodoo)--
"I guess she had a way, of making every night seem bright as day"
`I Don't Believe In Love`   -Queensryche (Oper. Mindcrime)     Glenn Steffler