// grab the relevant map from the file
LPTSTR XR2tex = ".\\Textures\\XRRR\\XR2MFDMap.bmp";
HANDLE XR2Map = LoadImage(NULL, XR2tex, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
if (!XR2Map) // handle errors - the return value is NULL from LoadImage
{
DWORD error = GetLastError();
HRESULT b0rk = HRESULT_FROM_WIN32(error);
skp->SetTextColor(MFD_RED);
txt = b0rk;
skp->Text(3, linespacing*lineNo, txt.c_str(), (int)txt.length());
lineNo++;
}
else
{
BITMAP bm; // Create a BITMAP object to store our image
GetObject( XR2Map, sizeof(BITMAP), &bm);
HDC hMemDC = CreateCompatibleDC(skp->GetDC()); // This replaces hDC in the sketchpad way of doing stuff
SelectObject(hMemDC, XR2Map); // Load our object above into the memory canvas
BitBlt( skp->GetDC(), 0, 0, bm.bmWidth, bm.bmHeight,
hMemDC, 0, 0, SRCCOPY ); // blit from above memory canvas onto our MFD
}