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. Managed C++/CLI
  4. Loading Resource

Loading Resource

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++graphicstestingbeta-testing
3 Posts 2 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.
  • J Offline
    J Offline
    John R Shaw
    wrote on last edited by
    #1

    ** The following was posted to the .NET foram, but few questions seem to be answered there. I am no longer mad (upset) just tired. Being .NET seems to go automatically with managed, but one thing at a time. ** This is driving me nuts! :mad: I am writing my first C++ .NET application and all I want to do is load a bitmap resource. Normally I would do something like ::LoadImage(IDB_BITMAP), but it says it is not in the global namespace. I want to load it as an Image type, but Image only has method for loading from a file or via a windows handle. The code should look something like the following: pImage->FromResource(IDB_BITMAP);ORpImage = resources->GetObject(IDB_BITMAP); This should be simple! :sigh: Thanks for any help, INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

    2 1 Reply Last reply
    0
    • J John R Shaw

      ** The following was posted to the .NET foram, but few questions seem to be answered there. I am no longer mad (upset) just tired. Being .NET seems to go automatically with managed, but one thing at a time. ** This is driving me nuts! :mad: I am writing my first C++ .NET application and all I want to do is load a bitmap resource. Normally I would do something like ::LoadImage(IDB_BITMAP), but it says it is not in the global namespace. I want to load it as an Image type, but Image only has method for loading from a file or via a windows handle. The code should look something like the following: pImage->FromResource(IDB_BITMAP);ORpImage = resources->GetObject(IDB_BITMAP); This should be simple! :sigh: Thanks for any help, INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

      2 Offline
      2 Offline
      2bee
      wrote on last edited by
      #2

      Hello, i found this article quite useful and it could help you in solving your issue. However this article shows how to create resources (bitmaps etc.) and use them within a .Net program. I am not quite sure if this is actually what you want. :confused: Furthermore it is written in C# but on the other side, C# is easy to convert to C++/CLI. http://www.jelovic.com/articles/resources_in_visual_studio.htm[^] so it would be instead:

      ResourceManager^ resourceManager = gcnew ResourceManager("MyCompany.MyProject.SomeResources", GetType().Assembly);
      Bitmap^ image = (Bitmap^)resourceManager->GetObject ("MyBitmapName");

      Hope this helps, best regards Tobias

      J 1 Reply Last reply
      0
      • 2 2bee

        Hello, i found this article quite useful and it could help you in solving your issue. However this article shows how to create resources (bitmaps etc.) and use them within a .Net program. I am not quite sure if this is actually what you want. :confused: Furthermore it is written in C# but on the other side, C# is easy to convert to C++/CLI. http://www.jelovic.com/articles/resources_in_visual_studio.htm[^] so it would be instead:

        ResourceManager^ resourceManager = gcnew ResourceManager("MyCompany.MyProject.SomeResources", GetType().Assembly);
        Bitmap^ image = (Bitmap^)resourceManager->GetObject ("MyBitmapName");

        Hope this helps, best regards Tobias

        J Offline
        J Offline
        John R Shaw
        wrote on last edited by
        #3

        Thank you very much! I do not know if it will help or not (yet), it looks very simular to what I have been tryiing to do. If it is written in C# I can not tell the difference, becuase it looks exactly the same as in C++. If .NET is what the next generation of progammers is going to have to learn, then I feel sorry for them. Actually I should not, since I am now going back to school. But they are making us write everything in vb.net, all pre-packaged stuff (controls, etc...). If I was not tryiing to use .NET and managed code the program would be all but finished by now. Thanks again, INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

        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