Advertisement
ASP_Volume3 Graphics/ Sound #55655

Load a BMP from a file

This is a simple, easy to use function that shows how to load a bitmap from a file then bitblit it to a window.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
//load bmp
int LoadBitmapFile(char* FileName, int x, int y, HWND hwnd)
{
BITMAP bm;
HDC hdc = GetDC(hwnd);
BitHandle = (HBITMAP)LoadImage(NULL, FileName, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE);
if(BitHandle == NULL)
{
MessageBox(0, "Error loading the specified bitmap", "Program Error!",
MB_ICONERROR | MB_SYSTEMMODAL | MB_OK);
}
HDC dc = CreateCompatibleDC(hdc);
SelectObject(dc, BitHandle);
GetObject(BitHandle, sizeof(BITMAP), &bm);
BitBlt(hdc, x, y, bm.bmWidth, bm.bmHeight, dc, 0,0, SRCCOPY); 
ReleaseDC(hwnd, hdc);
return(0);
}
/* to load a bmp simple call the function as follows : LoadBitmapFile("bitmap.bmp",50,50,hwnd);
hope this helps */

<h3>Please Download attached file herewith</h3>
This zip file contains an RTF, readable by Word, Wordpad, or most other word processors, regardless of platform.
Original Comments (3)
Recovered from Wayback Machine