Trying to use resources in windows with sdl

I have problems to load a binary resource (a bmp) with sdl in windows,
the resource is loading successfully in the exe file but I don’t get
load it as a SDL_Surface, here is my code:

  • the resource script:

#include “main.h”

ID_FONDOF BINTYPE “images/fondo.bmp”

  • the code for loading the sdl_surface in main.c:

    HGLOBAL h_res_load;
    HRSRC h_res;

    h_res=FindResource(NULL,MAKEINTRESOURCE(ID_FONDOF),RT_RCDATA);
    h_res_load=LoadResource(NULL,h_res);

fondo=SDL_LoadBMP_RW(SDL_RWFromMem(LockResource(h_res),SizeofResource(NULL,h_res)),1);

Any ideas to solve the problem???, the program crash immediately after
of executing it.

—Publicidad--------------------------------------------------------
Juega con Ventura24.es, loter?a inteligente y multiplica tus
posibilidades!! http://www.iespana.es/_reloc/email.ventura

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You should check intermediary results (using assert) to be sure that each
function succeeds. This will help to know exactly which call is defective.

Le mercredi 30 Juin 2004 01:23, Sefra at iespana.es a ?crit :

I have problems to load a binary resource (a bmp) with sdl in windows,
the resource is loading successfully in the exe file but I don’t get
load it as a SDL_Surface, here is my code:

  • the resource script:

#include “main.h”

ID_FONDOF BINTYPE “images/fondo.bmp”

  • the code for loading the sdl_surface in main.c:

    HGLOBAL h_res_load;
    HRSRC h_res;

    h_res=FindResource(NULL,MAKEINTRESOURCE(ID_FONDOF),RT_RCDATA);
    h_res_load=LoadResource(NULL,h_res);

fondo=SDL_LoadBMP_RW(SDL_RWFromMem(LockResource(h_res),SizeofResource(NULL,
h_res)),1);

Any ideas to solve the problem???, the program crash immediately after
of executing it.

—Publicidad--------------------------------------------------------
Juega con Ventura24.es, loter?a inteligente y multiplica tus
posibilidades!! http://www.iespana.es/_reloc/email.ventura


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Michel Nolard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA4ooryAKwOMHoSb0RAsn3AJ43YccBp9XB6pRLcTQNJao/1ApPCwCfT/R4
cuoLs4LLiWwM5w5HfTh7848=
=8zpp
-----END PGP SIGNATURE-----