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. ::LoadBitmap

::LoadBitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
5 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.
  • L Offline
    L Offline
    Laffis
    wrote on last edited by
    #1

    Do you people ever come across problem that this does not work? HBITMAP hBmp = ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP2)); I got 0 returned by the above func. Why? I am always in a bit of struggle with bitmap as I have not done much with it. Anyone can shed some light? My bitmap is created in dev studio.

    C 1 Reply Last reply
    0
    • L Laffis

      Do you people ever come across problem that this does not work? HBITMAP hBmp = ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP2)); I got 0 returned by the above func. Why? I am always in a bit of struggle with bitmap as I have not done much with it. Anyone can shed some light? My bitmap is created in dev studio.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      You have to pass the handle to the application instance as first parameter function.

      L 1 Reply Last reply
      0
      • C Cedric Moonen

        You have to pass the handle to the application instance as first parameter function.

        L Offline
        L Offline
        Laffis
        wrote on last edited by
        #3

        The code is from Msdn website. I just mangaged to get it work: BOOL CMFCPlayingPenDlg::OnInitDialog() { CDialog::OnInitDialog(); ..... DWORD dwStyle = WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE; m_staticX.ModifyStyleEx(0, dwStyle); HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1)); m_staticX.SetBitmap(hBmp); } The strange thing is that I did not change much but this time bitmap was loaded. However, the bitmap does not appear on my static ctrl...:doh:

        C 1 Reply Last reply
        0
        • L Laffis

          The code is from Msdn website. I just mangaged to get it work: BOOL CMFCPlayingPenDlg::OnInitDialog() { CDialog::OnInitDialog(); ..... DWORD dwStyle = WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE; m_staticX.ModifyStyleEx(0, dwStyle); HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1)); m_staticX.SetBitmap(hBmp); } The strange thing is that I did not change much but this time bitmap was loaded. However, the bitmap does not appear on my static ctrl...:doh:

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          Is that working if you pass the handle of the application instance as first parameter as I suggested in my first post ? Laffis wrote: The strange thing is that I did not change much Laffis wrote: HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1)); What did you change EXACTLY at this line of code (post what was shown on the MSDN website).

          L 1 Reply Last reply
          0
          • C Cedric Moonen

            Is that working if you pass the handle of the application instance as first parameter as I suggested in my first post ? Laffis wrote: The strange thing is that I did not change much Laffis wrote: HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1)); What did you change EXACTLY at this line of code (post what was shown on the MSDN website).

            L Offline
            L Offline
            Laffis
            wrote on last edited by
            #5

            I tried to ::AfxGetInstanceHandle() and passed it replace 0 with the instance handle. Bitmap still gets no-shown. cedric moonen wrote: What did you change EXACTLY at this line of code (post what was shown on the MSDN website). I played about the static ctrl the bitmap is supposed to attach to. I may have modified style, and later create a derived class off CStatic, that's about it. The CStaticX class does nothing special inside apart from the code generated by Wizzard.

            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