LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why a customized cursor changes after resized in winapi

I made this vi based on several posts before on how to resize a customized cursor. The problem is that the cursor constantly blinks, repositions itself to the top-left corner, and sometimes returns to default (hand) when the mouse moves. I wonder how to fix it to get a stable enlarged cursor.

 

Thanks,

 

Lei 

0 Kudos
Message 1 of 11
(3,643 Views)

I didn't see any problems when I ran your VI.  Actually, with the very large cursor size like you have set (200), I saw some slight flickering while Windows was redrawing it.  But no problems otherwise.

0 Kudos
Message 2 of 11
(3,639 Views)

Ravens,

 

Those blinks are not something I want. If you wait a little longer, you can see sometimes the cursor appears on the left corner of the screen, and if you moves the cursor or click some controls, the cursor can change back to a hand, though for a very short of time. As you said, it looks like the windows was redrawing it, and I am wondering how to prevent it.

 

Here's what the msdn says regarding Setcursor function.

 

"Your application can change the design of the cursor by using the SetCursor function and specifying a different cursor handle. However, when the cursor moves, the system redraws the class cursor at the new location. To prevent the class cursor from being redrawn, you must process the WM_SETCURSOR message. Each time the cursor moves and mouse input is not captured, the system sends this message to the window in which the cursor is moving."

 

Thank you,

 

Lei

0 Kudos
Message 3 of 11
(3,635 Views)

I am not seeing any of the behavior you describe.  No jumping cursor to the left corner, no changing to a hand.  And it isn't even blinking.

 

The only thing I see is when the cursor is very large (much too large to be of use), is a very slight flicker as windows tries to redraw that huge cursor.  Make the size 100 or less, and I see no problems at all.

 

Have you tried on a different PC?

 

 

0 Kudos
Message 4 of 11
(3,631 Views)

I also tried this and did not see the problems mentioned. Since you're using Windows, which one are you using? Could the problem be related to a theme you have installed?

0 Kudos
Message 5 of 11
(3,625 Views)

Nobody saw what I saw? This is weird. I just tried another laptop and I can still see the cursor being redrawn occasionally at the left corner outside of the front panel. It did apear a little bit better after I downsized to 100, but I do need a much lager crosshair cursor in my application.

 

Both laptop are installed with windows7 64bit and using the windows 7 areo themes. I tried the windows 7 basic one, and it got even worse, felt like I'm draging the mouse.

 

 

0 Kudos
Message 6 of 11
(3,614 Views)

Mine is a WinXP machine, LV 2011.

 

I'd have to wait until I get home to try it on Windows Vista machine with the Aero theme to see if that makes any difference to me.

 

Do you have an XP machine you can try it on?

0 Kudos
Message 7 of 11
(3,610 Views)

I also tested this on Windows XP as I have LV 2011 on a virtual machine. I downconverted the VI and ran it on Windows 7 and saw what you are describing. Without going into the guts of the Windows API I'd suggest trying it by making a big cursor to begin with and use the LabVIEW VIs to load the cursor. Dialog & User Interface -> Cursor. I didn't try it since I don't have a program handy to make a cursor file.

0 Kudos
Message 8 of 11
(3,607 Views)

Glad it wasn't my eye flickering! 🙂   I was thinking to use the api to avoid making a cursor myself.  Maybe I should go back to the drawing board now. I hope the LV cursor vi won't force the system size upon a customized cursor file.

 

Thank you both! If anyone find a way to do it in Win7 (API), please let me know.

 

Lei

0 Kudos
Message 9 of 11
(3,603 Views)

Hi !

 

Found the problem with Win7... But it disapears when the cursor size is set with a multiple of the original cur file. 

For example, if the cursor sotred in your .cur file has a size of 256x256 pixels, setting a drawing size of 200 pixels makes problem occuring... Howeever if the drawing size is set to 128 or 64, no more problems !

 

Hope this helps !

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 10 of 11
(3,572 Views)