So I have been trying to create a stretched bitmap from a bitmap that I receive via a function call and stretch it so a user defined size.

Here is my code that isn't working
// I know my bitmap even stretched is not over 64k
// For this please assume that bih and bmiHeader are valid if you find no problem with this code I can give you that information, 'thank you'.
// pSubBuffer - Buffer of bitmap
// bih is Bitmap info head for pSubBuffer
// bmiHeader is requested new info for new bitmap

BYTE* CreateStretchedBitmap(BYTE*pSubBuffer, BITMAPINFOHEADER bih, BITMAPINFOHEADER bmiHeader)

HDC hdcSrc = CreateCompatibleDC(NULL);
HDC hdcDst = CreateCompatibleDC(NULL);
HBITMAP hBit, hbmOld, hbmOld2, hbmNew;
hBit = CreateDIBitmap(hdcSrc, &bih, CBM_INIT, (void*)pSubBuffer, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
hbmNew = CreateDIBitmap(hdcDst, &bmiHeader, 0, NULL, NULL, DIB_RGB_COLORS);

hbmOld = (HBITMAP)SelectObject(hdcSrc, hBit);
hbmOld2 = (HBITMAP)SelectObject(hdcDst, hbmNew);

result = StretchBlt(hdcDst, 0,0, bmiHeader.biWidth, bmiHeader.biHeight, hdcSrc,0, 0, nWidth, nHeight, SRCCOPY);
// result is 1 here

HANDLE hDIB = GlobalAlloc(GHND, bmiHeader.biSizeImage);
char *lpbitmap = (char *)GlobalLock(hDIB);
result = GetDIBits(hdcDst, hbmNew, 0, bmiHeader.biHeight, lpbitmap, (BITMAPINFO*)&bmiHeader, DIB_RGB_COLORS);
// result returns 0 here and there is no error from GetLastError()

SelectObject(hdcDst, hbmOld2);
SelectObject(hdcSrc, hbmOld);
BYTE * pOutBuffer = new BYTE[bmiHeader.biSizeImage];
memcpy(pOutBuffer, lpbitmap, bmiHeader.biSizeImage);
return pOutBuffer;