::LoadBitmap
-
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. -
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.You have to pass the handle to the application instance as first parameter function.
-
You have to pass the handle to the application instance as first parameter function.
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: -
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: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).
-
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).
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.