Skip to main content
GameDev.net gamedev.net
🔒 Locked

Bitmap Resources

Started by jharkey Sep 18, 2000 at 6:02 PM 4 replies 250+ views
Original Post
jharkey
jharkey
Hello I need help with loading a bitmap that is a resource. I have it in the .rc script, but i cant load it and blt it to the screen. I dont think that my LoadImage function is correct, but i''m not sure. Please help me. extern HINSTANCE hinst; HBITMAP background=NULL; bool LoadWindow(HWND hwnd) { background=(HBITMAP)LoadImage (hinst,"IDB_BITMAP_WINDOW",IMAGE_BITMAP, NULL,NULL,LR_DEFAULTCOLOR); ////i also tried the macro MAKEINTRESOURCE (IDB_BITMAP_WINDOW), but that didnt work either//// return true; } bool DrawWindow(HWND hwnd) { HDC hdc=GetDC(hwnd); HDC whdc=CreateCompatibleDC(hdc); SelectObject(whdc,background); BitBlt(hdc,0,0,100,100,whdc,0,0,SRCCOPY); DeleteDC(whdc); ReleaseDC(hwnd,hdc); return true; } bool DestroyWindow() { DeleteObject(background); return true; }
Ecco2000
Ecco2000
If you open up the help file and look up LoadImage and Blt it will tell you all the requirements and parameter that go along with using resource bitmaps. you could also try changing the name of the resource in the resource editor from:
IDB_Bitmap
to:
"IDB_Bitmap"
"Don't make me come down there..." -GOD
jharkey
jharkey
Thanks, but i''ve done everything that the help says and it still
doesnt work. i cant even load a bitmap that the resource editor
itself makes. i tried renaming it like you said, but no luck.
i''ve looked at lots of the examples in the help and cant find
what i''m doing different. maybe someone could tell me how step
by step. thanks
DeltaVee
DeltaVee
when you create (or create through loading) the image in the resource editor give it an ID.

Then you LoadImage(NULL,MAKEINTRESOURCE(THE ID YOU JUST DEFINED), yada, yada, yada);

D.V.


--------------------------
Carpe Diem
D.V.Carpe Die<FONT C
jharkey
jharkey
Thanks DeltaVee, but i tried that and it didnt work. i cant figure it out.
Scooter
Scooter
If you defined the bitmap correctly in the resource files then it should work the makeintroresource

background=(HBITMAP)LoadImage (hinst,MAKEINTRESOURCE(IDB_BITMAP),IMAGE_BITMAP,
0,0,LR_DEFAULTCOLOR | LR_DEFAULTSIZE);

if this doesn''t work then you need to check your resource files.


We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.