Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Bitmap Resource

This topic is 5966 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have made a member function to load a resource bitmap. It gives me error 87: Invalid parameter. What am I doing wrong: //////////////////////////////////////////////////////////// void CGDIBitmap::LoadResource(HDC hdcCompatible,int ResID) { // if we''ve already got a bitmap loaded, UnInit it so we can load a new // one. if(m_hdcBitmap) UnInit(); // create the memory dc m_hdcBitmap = CreateCompatibleDC(hdcCompatible); // load the BMP file m_hBitmap = (HBITMAP)LoadImage( NULL, MAKEINTRESOURCE(ResID),IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); // if the load failed, throw an error. if (m_hBitmap == NULL) { CHAR szBuf[80]; DWORD dw = GetLastError(); sprintf(szBuf, "LoadResource failed: error code %u\n",dw); MessageBox(NULL, szBuf, "Error", MB_OK); } // select our new bitmap into the dc m_hOldBitmap = static_cast(SelectObject(m_hdcBitmap,m_hBitmap)); // query the bitmap''s properties BITMAP bmp; GetObject(m_hBitmap,sizeof(BITMAP),(LPVOID)&bmp); // assign height and width from those properties m_iWidth=bmp.bmWidth; m_iHeight=bmp.bmHeight; } //////////////////////////////////////////////////// please help Break;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!