#### Archived

This topic is now archived and is closed to further replies.

# Problems importing bitmaps...

This topic is 6241 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Okay, I finally got this cool graphics demo working, but I want to combine it all in one .exe file so that there are no external graphics files needed. The only thing is I really dont know how? Can someone help me? I''ve tried importing the two bitmaps as resouces, but it doesn''t seem that they compile with the rest of the code, and if I reload the workspace, I find that the bitmaps are not included in the resource folders??? Also, do I have to get a handle (or makeinto a resource) the bitmap in order to use it?? I know I posted this question earlier, but my options are becoming depleted fast! Could someone please show with a "code" example of how to do this.say in directx? I appreciate anytime that is given to this question!! ~ Boltimus ~

##### Share on other sites
Any resource that you have in your project will get compilied into the application. First, you want to make sure the bitmaps that you want to use are resources in your current project. The easiest way to tell is if you have a resources tab under the "Workspace".

Here is some code on how to load a bitmap from a resource into a HBITMAP object you can use to draw it onto your surface

  hBMP = (HBITMAP) LoadImage( GetModuleHandle(NULL), szFile, IMAGE_BITMAP, dwWidth, dwHeight, LR_CREATEDIBSECTION );

hBMP will now be a valid handle to your bitmap resource. szFile the name of the Bitmap resource, ex IDB_BACKGROUND. To draw it onto your surface, use StretchBlt. This will expand or contract the surface to be the exact size of the bitmap

  // Draw our image StretchBlt( hDC, 0, 0, g_ddsd.dwWidth, g_ddsd.dwHeight, hDCImage, 0, 0, dwWidth, dwHeight, SRCCOPY );

g_ddsd is a global DDSURFACEDESC2 item and dwWidth, dwHeight are the height and width of the Bitmap. Hope this helps.

-----------------------------
kevin@mayday-anime.com
http://dainteractive.mayday-anime.com

##### Share on other sites
Okay, then I guess another problem would be (sigh) that for some reason I''m not getting the resources tab up. How do I actually insert the bitmap as a resource? What I do is that I select INSERT then RESOURCE then BITMAP and then IMPORT. After I select the file, it is displayed on the screen in the bitmap editor. However I don''t get a resources tab?? Where do I go from here? Thanx! for your time!!

~ Boltimus ~

opps

~ Boltimus ~

1. 1
2. 2
JoeJ
17
3. 3
4. 4
5. 5
frob
11

• 13
• 16
• 13
• 20
• 12
• ### Forum Statistics

• Total Topics
632178
• Total Posts
3004608

×