Custom cursor problem
-
Hi In my program I would like to use a cursor from windows\cursors. In the Load event I use the following code: Cursor = New Cursor("c:\windows\cursors\3dgarro.cur") (This is a built-in cursor of Windows.) However, the result is a plain black arrow instead of the 3D golden one. (I tried with other cursors too, the result is always a black arrow.) I have no idea what the problem is. :( Any advices would be welcome.
-
Hi In my program I would like to use a cursor from windows\cursors. In the Load event I use the following code: Cursor = New Cursor("c:\windows\cursors\3dgarro.cur") (This is a built-in cursor of Windows.) However, the result is a plain black arrow instead of the 3D golden one. (I tried with other cursors too, the result is always a black arrow.) I have no idea what the problem is. :( Any advices would be welcome.
In my windows folder I don't have a golden cursor. Maybe extra cursors like that are extra ones you have the choice of adding when you install Windows? Although I have never seen a golden one. What version of Windows are you using?
If everything was not true, would it be not true that everything is not true? So by saying everything is not true, you are automatically denying that everything is not true. Im so confused... FreeDOS - An open source modern MS-DOS/PC-DOS replacement.
-
In my windows folder I don't have a golden cursor. Maybe extra cursors like that are extra ones you have the choice of adding when you install Windows? Although I have never seen a golden one. What version of Windows are you using?
If everything was not true, would it be not true that everything is not true? So by saying everything is not true, you are automatically denying that everything is not true. Im so confused... FreeDOS - An open source modern MS-DOS/PC-DOS replacement.
Perhaps the Golden Cursor is a close relative of the Golden Rivet?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Perhaps the Golden Cursor is a close relative of the Golden Rivet?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
The problem is not about the golden arrow, it does not work with any cursor. :sigh: (Anyway, the golden arrow was installed with my XP Prof by default, not optional, no extra-pack or sg like that.)
-
The problem is not about the golden arrow, it does not work with any cursor. :sigh: (Anyway, the golden arrow was installed with my XP Prof by default, not optional, no extra-pack or sg like that.)
I know a way to do what you want, but it involves using the P/Invoke capability of .NET. Here it is in C# (I will try to convert it to VB for you but I don't use VB very often, so I may make a few errors), in case another kind CPian will convert it properly. C#
[DllImport("user32.dll")]
static extern IntPtr LoadCursorFromFile(string lpFileName);static Cursor ColoredCursor; static ColoredCursorForm() { // Load colored cursor once for the lifetime of the application IntPtr cursor = LoadCursorFromFile(@"c:\\windows\\cursors\\3dgarro.cur"); ColoredCursor = new Cursor(cursor); }
Better than me translating it take a look at this (pinvoke.net)[^], scroll down a bit, you will find a VB example. This is a very useful site, I suggest that you bookmark it. Good Luck! :)
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
I know a way to do what you want, but it involves using the P/Invoke capability of .NET. Here it is in C# (I will try to convert it to VB for you but I don't use VB very often, so I may make a few errors), in case another kind CPian will convert it properly. C#
[DllImport("user32.dll")]
static extern IntPtr LoadCursorFromFile(string lpFileName);static Cursor ColoredCursor; static ColoredCursorForm() { // Load colored cursor once for the lifetime of the application IntPtr cursor = LoadCursorFromFile(@"c:\\windows\\cursors\\3dgarro.cur"); ColoredCursor = new Cursor(cursor); }
Better than me translating it take a look at this (pinvoke.net)[^], scroll down a bit, you will find a VB example. This is a very useful site, I suggest that you bookmark it. Good Luck! :)
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
I used the following code:
Declare Function LoadCursorFromFileA Lib "user32.dll" (ByVal lpFileName$) As IntPtr
Sub LoadCur()
Cursor = New Cursor(LoadCursorFromFileA("c:\windows\cursors\3dgarro.cur"))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadCur()
End SubIt works perfectly with every cursor file (even animated ones). Thanks! :-D :-D :-D
-
I used the following code:
Declare Function LoadCursorFromFileA Lib "user32.dll" (ByVal lpFileName$) As IntPtr
Sub LoadCur()
Cursor = New Cursor(LoadCursorFromFileA("c:\windows\cursors\3dgarro.cur"))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadCur()
End SubIt works perfectly with every cursor file (even animated ones). Thanks! :-D :-D :-D
This Solution worked, but only after I figured out that I needed to put my custom cursors in the c:\windows\cursors folder. Thanks for the tip.