I am making a BMP loader. I have a question. I already have the "Browse..." button, but how do I LOAD the BMP. I need an example for once I get the name of the selected file. Any help is appreciated!
I am making a BMP loader. I have a question. I already have the "Browse..." button, but how do I LOAD the BMP. I need an example for once I get the name of the selected file. Any help is appreciated!
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
www.google.com will answer this question without anyone having to write it out here.
search first, read someone else's code and give it a go.. when you have problems... post again.
U.
Quidquid latine dictum sit, altum sonatur.
Whatever is said in Latin sounds profound.
Use LoadImage().
Tho I'm away from my computer so not totally sure about the arguments being in the right place, in fact it's been several weeks away from the compiler so your going to have to correct the errors yourself......play with it...
...That's the basic idea anyway. Oh and of course don't actually declare the variables in the message loop, I used it for brevity...Code:PAINTSTRUCT ps; case WM_CREATE: int screenX = GetSystemMetrics(SM_CXSCREEN); int screenY = GetSystemMetrics(SM_CYSCREEN); HDC dc = GetDC(hwnd); HDC hdc = CreateCompatibleDC(dc); HBITMAP b = CreateCompatibleBitmap(dc); SelectObject(hdc, b); PatBlt(hdc, screenX, screenY, PATCOPY); HBITMAP bm = (HBITMAP)LoadImage("bmp.bmp", ??, ??, IMAGE_BITMAP, LR_LOADFROMFILE, hThisInstance); HDC bmdc = CreateCompatibleDC(dc); SelectObject(dc, bmdc); PatBlt(bmdc, screenX, screenY, PATCOPY); case WM_PAINT: hdc = BeginPaint(hwnd, &ps); BitBlt(hdc <-- bmdc); // Obviously not a literal function call... EndPaint(hwnd, &ps);
....good luck!
Don't forget to free, with DeleteDC() / ReleaseDC() / DeleteObject() ect, all that mem you are allocating with the Create??() and CreateCompatible??() functions.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill