:
: HBITMAP radarBmp = (HBITMAP)LoadImage( NULL,
: TEXT("c:\\Quest Projects\\Visual Studio\\Resources\\Resources\\radar_bgrnd.bmp"),
: IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);:
: Hm... you *should* be able to load bitmaps from file using
: LoadImage, just not like the above. (Your above code will indeed
: attempt to load from a resource)
:
: Try this instead:
:
:
:
: HBITMAP radarBmp = (HBITMAP)LoadImage( NULL,
: TEXT("c:\\Quest Projects\\Visual Studio\\Resources\\Resources\\radar_bgrnd.bmp"),
: IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
: :
:
: According to MSDN, you do not need to specify LR_DEFAULTCOLOR as it
: is the default flag.
:
: Also, I personally use "/" instead of "\\" as it seems supported on
: more systems, and is prettier. This is just my personal taste though
: ;)
:
: Last but not least, you should never specify an exact location for a
: file within a program. That is, the location should be in a
: configuration file, or a relative path from your programs location.
:
:
[.:EvolutionEngine][.:MicroOS
: Operating
: System][Website ::
: OS Development Series]
:
The point about hard-coding the path in the code is very wise. It is better to use some kind of relative directory. Something beside your EXE file will do nice. Get the path of your EXE file and search for last directory separator (backslash in your case) - once it is found append at this location some sub-folder: like "\Images". Then all your images may be loaded just by name:
LoadMyBitmap ("radar_bgrnd.bmp");
Internally this function will use the path constructed from path to EXE file. This way - no matter in which directory your program is deployed - all images will be loaded properly.