From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Get hWnd for CWGraph object

I'm interested in using a custom cursor while the mouse is over a CWGraph
object. One way that I've been told I can do it is to use the windows messages
TrackMouseEvent and WM_MOUSEMOVE to determine if the cursor is over the graph.
In order to use these API, I need to have the hWnd of the CWGraph object.
How can I get the hWnd and is there a better way of determining if the cursor
is over the graph?
0 Kudos
Message 1 of 4
(3,763 Views)
You might try this (it seemed to work OK for updating a text box as to the
mouse position):

set the mouse track mode when you load the form,
CWGraph1.TrackMode = cwGTrackAllEvents

in event CWGraph1_MouseMove(), change the mouse cursor to what you want it
to be when the mouse is over the graph

in event Form_MouseMove(), change the mouse cursor to what you want it to
be when the mouse is over the rest of the form

Hope this helps,
Dave

"MarkD" wrote:
>>I'm interested in using a custom cursor while the mouse is over a CWGraph>object.
One way that I've been told I can do it is to use the windows messages>TrackMouseEvent
and WM_MOUSEMOVE to determine if the cursor is over the graph.> In order
to use these API, I need to have the hWnd of the CWG
raph object.> How can
I get the hWnd and is there a better way of determining if the cursor>is
over the graph?
0 Kudos
Message 2 of 4
(3,763 Views)
Dave,
This will not work properly if the cursor is changed while over the graph and then
moved quickly to another control in the form. It passes over the exposed form before any
Form_MouseMove messages are generated.
Thanks for your help though.

Are there any more suggestions?

Mark D.

Dave Auyer wrote:

> You might try this (it seemed to work OK for updating a text box as to the
> mouse position):
>
> set the mouse track mode when you load the form,
> CWGraph1.TrackMode = cwGTrackAllEvents
>
> in event CWGraph1_MouseMove(), change the mouse cursor to what you want it
> to be when the mouse is over the graph
>
> in event Form_MouseMove(), change the mouse cursor to what you want it to
> be when the mouse is over the rest of the form
>
> Hope this hel
ps,
> Dave
>
> "MarkD" wrote:
> >>I'm interested in using a custom cursor while the mouse is over a CWGraph>object.
> One way that I've been told I can do it is to use the windows messages>TrackMouseEvent
> and WM_MOUSEMOVE to determine if the cursor is over the graph.> In order
> to use these API, I need to have the hWnd of the CWGraph object.> How can
> I get the hWnd and is there a better way of determining if the cursor>is
> over the graph?
0 Kudos
Message 3 of 4
(3,763 Views)
Mark,

I just had one more thought. You can set the MousePointer property of almost
everything on the from, but unfortunately the CWGraph object doesn't have
this property. You might try putting a frame on the form, and putting a
new CWGraph object in the frame. Then in the Form_Load procedure you could
assign:

Form1.MousePointer = 1
Frame1.MousePointer = 2 'or whatever you wanted

Then it looks like the mouse pointer will be changed whenever its over the
frame (which you might be able to size just slightly larger than your CWGraph),
but will revert to a normal pointer over the rest of the form.

Regards,
Dave

Mark Downes wrote:
>Dave,> This will not work properly if the cursor is changed while over
the graph and th
en>moved quickly to another control in the form. It passes
over the exposed form before
>any>Form_MouseMove messages are generated.> Thanks for your help though.>>
Are there any more suggestions?>>Mark D.>>Dave Auyer wrote:>>> You might
try this (it seemed to work OK for updating a text box as to the>> mouse
position):>>>> set the mouse track mode when you load the form,>> CWGraph1.TrackMode
= cwGTrackAllEvents>>>> in event CWGraph1_MouseMove(), change the mouse cursor
to what you want it>> to be when the mouse is over the graph>>>> in event
Form_MouseMove(), change the mouse cursor to what you want it to>> be when
the mouse is over the rest of the form>>>> Hope this helps,>> Dave>>>> "MarkD"
wrote:>> >>I'm interested in using a custom cursor
while the mouse is over a CWGraph>object.>> One way that I've been told
I can do it is to use the windows messages>TrackMouseEvent>> and WM_MOUSEMOVE
to determine if the cursor is over the graph.> In order>> to use t
hese API,
I need to have the hWnd of the CWGraph object.> How can>> I get the hWnd
and is there a better way of determining if the cursor>is>> over the graph?>
0 Kudos
Message 4 of 4
(3,763 Views)