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. C / C++ / MFC
  4. how to add cur resources to any executable by program?

how to add cur resources to any executable by program?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
10 Posts 3 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.
  • N Offline
    N Offline
    nenfa
    wrote on last edited by
    #1

    how to add cur resources to any executable by program?

    D 1 Reply Last reply
    0
    • N nenfa

      how to add cur resources to any executable by program?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you looked at UpdateResource(hResource, RT_CURSOR, ...) and related functions?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      N 1 Reply Last reply
      0
      • D David Crow

        Have you looked at UpdateResource(hResource, RT_CURSOR, ...) and related functions?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Man who follows car will be exhausted." - Confucius

        N Offline
        N Offline
        nenfa
        wrote on last edited by
        #3

        Yes, I have looked. It's ok for icon resources, but fail for cur resources, who can help me, thanks ;)

        C D 2 Replies Last reply
        0
        • N nenfa

          Yes, I have looked. It's ok for icon resources, but fail for cur resources, who can help me, thanks ;)

          C Offline
          C Offline
          Code o mat
          wrote on last edited by
          #4

          Explain what you mean by "fail"? It crashes, UpdateResource returns with FALSE (in this case, what does GetLastError give you?), everything seems to succeed but the executable is not updated/saved?

          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

          N 1 Reply Last reply
          0
          • C Code o mat

            Explain what you mean by "fail"? It crashes, UpdateResource returns with FALSE (in this case, what does GetLastError give you?), everything seems to succeed but the executable is not updated/saved?

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

            N Offline
            N Offline
            nenfa
            wrote on last edited by
            #5

            Everything is ok, but the cur added is black and with wrong data attribute(size, color and so on), i don't know which go wrong, however the same code is fine for icon file :doh:

            C 1 Reply Last reply
            0
            • N nenfa

              Everything is ok, but the cur added is black and with wrong data attribute(size, color and so on), i don't know which go wrong, however the same code is fine for icon file :doh:

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #6

              And you are sure the source is OK, i mean the cursor file you want to add.

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

              N 1 Reply Last reply
              0
              • C Code o mat

                And you are sure the source is OK, i mean the cursor file you want to add.

                > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

                N Offline
                N Offline
                nenfa
                wrote on last edited by
                #7

                Yes, i think so, as i replace the source of one cur resource with the tools of "Res Hacker", it's ok!

                C 1 Reply Last reply
                0
                • N nenfa

                  Yes, i think so, as i replace the source of one cur resource with the tools of "Res Hacker", it's ok!

                  C Offline
                  C Offline
                  Code o mat
                  wrote on last edited by
                  #8

                  Maybe the data gets corrupted when you load the cursor file to be passed as the pData parameter of UpdateResource[^]? The documentation also says that it has to be properly alligned, could this maybe be the cause of the problem?

                  > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

                  1 Reply Last reply
                  0
                  • N nenfa

                    Yes, I have looked. It's ok for icon resources, but fail for cur resources, who can help me, thanks ;)

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    nenfa wrote:

                    ...but fail for cur resources...

                    So UpdateResource() returns 0?

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    N 1 Reply Last reply
                    0
                    • D David Crow

                      nenfa wrote:

                      ...but fail for cur resources...

                      So UpdateResource() returns 0?

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "Man who follows car will be exhausted." - Confucius

                      N Offline
                      N Offline
                      nenfa
                      wrote on last edited by
                      #10

                      No, it returns non-zero value, if i change to RT_ICON, it'll show, this's so strange

                      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