# SDL_image with MFC...?

## Recommended Posts

Hello! I've been working on a small project that requires all sorts of image formats to be loaded and stored in a CBitmap class.. But I'm having problems linking an SDL Surface with MFC's CreateBitmap function. Here's the code that I have so far for loading the image..
	SDL_Surface *surface = IMG_Load("goose.bmp");

HBITMAP bitmap = CreateBitmap(surface->w, surface->h, 3, 24, surface->pixels);
m_Image.SetBitmap(bitmap);
SDL_FreeSurface(surface);


I'm just trying to get it to work, but the screen comes up blank. I used the LoadImage function to load the same bmp and display it, and it works. But I need to be able to load the other formats, so that won't cut it.. I'd really appreciate it if someone could help me out, I'm getting frustrated with this.. :( -Fredric

##### Share on other sites
Have a look at DevIL.
Handles all kinds of filetypes and has interfaces to GDI, OpenGL, DirectX 9.

Thermo

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627735
• Total Posts
2978855

• 10
• 10
• 21
• 14
• 12