How to acces picture in the resources

Hi,

I want to add pictures to my project so I go to Project->resource->add resource than I import the picture I want. But now the problem is, how to access my picture from my class
for example my picture is pict.bmp, so after I added it to resources how to call it

Thank you in advance :D




Answer this question

How to acces picture in the resources

  • Jacco Mintjes

    MFC
    CBitmap bmp;
    bmp.LoadBitmap(IDB_BITMAP1);// IDB_BITMAP1 will be the existing bitmap in your resource.


    Win32

    HBITMAP hbmp = LoadBitmap(hinst, MAKEINTRESOURCE(IDB_BITMAP1));



  • Joel_F

    I actually want to access my picture such as My.Resources.Mypic from my code, I think that will work in VB or C# but how to doit in C++

    Anyway thank you for answering :D


  • Obsolete

    You can use LoadBitmap function to load the resource into memory.

    If you are using LoadBitmap function of GDI, it will return a HBITMAP handle value. You can use this handle for further drawing and processing.

    If you are using CBitmap::LoadImage, it will internally store the handle value inside the object. You can use m_hObject (or operator HBIMAP) to get the handle value (if required)

    Just google or go to codeproject you can see enormous number of articles regarding bitmap and GDI


  • How to acces picture in the resources