hi, about casting see to the structure typedef struct tagBITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; } BITMAPINFO; BITMAPINFO is almost same as BITMAPINFOHEADER casting means int iVar = 1; short sVar = (short)iVar; //I cast iVar to sVar int SetDIBitsToDevice( HDC hdc, // handle to device context int XDest, // x-coordinate of upper-left corner of // dest. rect. int YDest, // y-coordinate of upper-left corner of // dest. rect. DWORD dwWidth, // source rectangle width DWORD dwHeight, // source rectangle height int XSrc, // x-coordinate of lower-left corner of // source rect. int YSrc, // y-coordinate of lower-left corner of // source rect. UINT uStartScan, // first scan line in array UINT cScanLines, // number of scan lines CONST VOID *lpvBits, // address of array with DIB bits CONST BITMAPINFO *lpbmi, // address of structure with bitmap info. UINT fuColorUse // RGB or palette indexes ); .h CBitmap m_bmpLogo1; CString m_strLogoPath; HANDLE m_hBitmap; .cpp ::OnCreate() CFileFind filefind; CString strVal = strCurrentPath +"label.bmp"; m_strLogoPath = strVal; if (filefind.FindFile(strVal)) bLogo = TRUE; else m_strLogoPath = ""; if(bLogo) { if(!m_bmpLogo1.LoadBitmap(strVal)) { m_hBitmap = LoadImage (NULL,m_strLogoPath,IMAGE_BITMAP,0,0, LR_DEFAULTSIZE | LR_LOADFROMFILE ); //| LR_CREATEDIBSECTION if(!m_bmpLogo1.Attach(m_hBitmap)) m_strLogoPath = ""; } } //another function CBitmap bmp //class BITMAP Bitmap; //handle long cx=0,cy=0; CSize size bmp.Attach(m_hBitmap); bmp.GetBitmap(&Bitmap); size = bmp.GetBitmapDimension(); cx = size.cx; //or Bitmap.bmWidth cy = size.cy; //or Bitmap.bmHeight BITMAPINFO info; ZeroMemory( &info.bmiHeader, sizeof(BITMAPINFOHEADER) ); info.bmiHeader.biWidth = cx; // Set size you need info.bmiHeader.biHeight = cy; // Set size you need info.bmiHeader.biPlanes = 1; info.bmiHeader.biBitCount = 24; // Can be 8, 16, 32 bpp or other number info.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); //.. //I never used SetDIBitsToDevice() so i give you another example function //Let's create a new bitmap HDC dc= CreateCompatibleDC(NULL); VOID *pvBits; HBITMAP oldBmp