Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Custom cursor problem

Custom cursor problem

Scheduled Pinned Locked Moved Visual Basic
help
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    The real M
    wrote on last edited by
    #1

    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.

    L 1 Reply Last reply
    0
    • T The real M

      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.

      L Offline
      L Offline
      LloydA111
      wrote on last edited by
      #2

      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.

      H 1 Reply Last reply
      0
      • L LloydA111

        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.

        H Offline
        H Offline
        Henry Minute
        wrote on last edited by
        #3

        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.”

        T 1 Reply Last reply
        0
        • H Henry Minute

          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.”

          T Offline
          T Offline
          The real M
          wrote on last edited by
          #4

          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.)

          H 1 Reply Last reply
          0
          • T The real M

            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.)

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #5

            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.”

            T 1 Reply Last reply
            0
            • H Henry Minute

              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.”

              T Offline
              T Offline
              The real M
              wrote on last edited by
              #6

              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 Sub

              It works perfectly with every cursor file (even animated ones). Thanks! :-D :-D :-D

              W 1 Reply Last reply
              0
              • T The real M

                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 Sub

                It works perfectly with every cursor file (even animated ones). Thanks! :-D :-D :-D

                W Offline
                W Offline
                waterboarer
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups