Hi czerny,
Rewriting CreateBmpFromMem in C :
HBITMAP __stdcall CreateBmpFromMem( HWND hwind , LPVOID pImg , HDC* tempDC)
{
HDC hdc;
char *bmpheader = (char *)pImg + sizeof(BITMAPFILEHEADER);
LPVOID lpbInit = (LPVOID)((int)pImg + ((LPBITMAPFILEHEADER)pImg)->bfOffBits) ;
hdc=GetDC(hwind);
*tempDC=hdc;
return (CreateDIBitmap(hdc,
(LPBITMAPINFOHEADER)bmpheader,
CBM_INIT,lpbInit,
(LPBITMAPINFO)bmpheader,
DIB_RGB_COLORS));
}