I had a simple program that used LoadBitmap to get a bmp from its resources. I'd done this a thousand times without difficulties and it seemed to work perfectly this time as well. But when I moved the damn thing to my other PC (Win98se) no image displayed.

Right, quickly check another program that uses the same method. That works, must be something different with this new one.

Ok, throw in some error checking; aahh so LoadBitmap is returning NULL, but damn so is GetLastError, that?s no help.

Eventually I spotted the difference, the new program was passing eax to GetModuleHandle, while the one that worked on both OSs passed zero to it.

Strange thing is that the return value from invoke GetModuleHandle,eax was valid when used to display a dialog on Win98se so why wouldn?t it also work for LoadBitmap?
Posted on 2002-02-28 17:50:53 by Eóin
Some weeks ago I spent hours finding out why my program did work on w2k and not on 98 (or ME). Finally I found out that the resource IDs have to be in specific ranges to work. I defined the IDs myself and used some IDs that where very high. It worked perfectly on win2k but win98 gave weird errors like 'this executable is not a valid win32 PE file'..
Maybe this is your problem, although you didn't get that message...

Thomas
Posted on 2002-03-01 02:35:35 by Thomas
I had sometimes trouble with BITMAPCORE bitmap files, that are saved by some gfx-programs (f.e. photoshop) instead of normal BITMAPFILEs.

Another topic are resources larger than 64K (windows bug under Win95, but under Win98SE ?) could give trouble.

The ID problem of thomas is new to me, maybe its a problem with INT16 datatype and ids larger than 32767 - get negative?

(german said: poke-ing in the fog :) )
Posted on 2002-03-01 08:09:30 by beaster
The ID problem is new to me as well, thanks Thomas. However it wasn't the problem here as the IDs involved were 1 for the dialog, 10 for the bmp.

I've never fully understood resources. For example passing NULL to FindResource/LockResource as a first parameter will work just as well a passing a module handle, well it does on Win2k anyway.

I'm sure there is a good explanation, but while the handle returned by GetModuleHandle,0 seems to always work I'll stick with it rather than rely on other perhaps undocumented methods.
Posted on 2002-03-01 13:03:45 by Eóin