Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Large mouse pointers 1

Status
Not open for further replies.

Overlord44

Programmer
Mar 9, 2004
26
0
0
GB
I have an application I'm developing in Visual Basic 6 that is able to be controlled some distance away from a PC with a wireless mouse. I have made an interface that can be used from a short distance from a PC for the most part without any problems (increasing text size and whatnot), with one exception - the cursor.

I found out how to change the cursor when hovering over an object (easy enough with a label covering the entire form and set the properties there), but my problem is size - cursors under windows are limited to being a 32x32 image (you can use .ico or .cur files, but that's irrelvant). Ideally, I'd like a 128x128 cursor, though size could be changed to suit the app later on.

My question is this - I figure that if a 128x128 (or whatever) image (probably a GIF so the pointer isn't a square block) could be made to stick to the mouse pointer while the cursor is over the application (it'll be fullscreen, so going outside of it shouldn't be a problem unless they alt-tab on the keyboard or something from actually at the PC), then the pointer will be visible and useable (the application is going to have large controls, so accuracy from that distance isn't a huge problem).

However, I have no idea how to do this. Any thoughts?
 
>cursors under windows are limited to being a 32x32 image

They are not, you know ...
 
They aren't? I've tried creating a 128x128 icon and under one circumstance it didn't apply, and in the other it was down-sized to become a 32x32 icon...
 
This is in Axialis AX-Cursors 4.5, by the way. I just tried again, this time with the maximum size cursor it'll create without going into custom. No matter what I try, VB displays it out as a 32x32 icon...
 
...and a black & white one at that (sorry for triple post)
 
For the record (gaaah, sorry again for this), if I try to apply the cursor under XP, not in the program, it's in colour, but is still stuck at 32x32 despite Axalis having it open right now as a 72x72 icon.
 
I'm merely going to demonstrate that Windows cursors are not limited to being 32 x 32 here, rather than providing a solution to the original problem.

Add an ImageList to a blank form. Make sure you have selected 'Custom' under the General tab, and then load any picture that you like into the image list (does not have to be a .CUR). If you are loading anything other than a cursor or icon set the ImageList's MaskColor to the color in the image that you would like to be transparent and ensure that UseMaskColor is selected

Add the following code to your form:
Code:
[blue]Option Explicit
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    SetCursor ImageList1.ListImages(1).ExtractIcon.Handle
End Sub[/blue]
 
Hah, OK, it can be done. I set it to an onLoad event, and it disappears straight away, though - how do I get it to stick until the app loses focus/is closed?
 
OK, FormName_MouseMove does it but the effort it's having to put into constantly refreshing it every time the mouse moves makes a horrible effect =( There a better way than this, or is the only option?
 
> OK, it can be done

Yep :)

>every time the mouse moves makes a horrible effect

Indeed. What you are battling here is some of the design decisions made by the VB team - and why I didn't provide a solution to your problem. To work around it involves (as far as I have ever worked out) using the API to hack the window class to use a different 'system cursor'
 
Oh, OK. I guess I'll have to manage with the existing solution, it's not so bad at a distance ;)

Thanks for the help, anyhow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top