GetCurrentObject returns 0, but as far as it knows, it is returning successfully. This is because in the line
case OBJ_BITMAP: ret = dc->hBitmap; break;
dc->hBitmap is 0, although dc is a valid DC. The HDC that is passed to GetCurrentObject to get dc is obtained by calling CWindow::BegingPaint(PAINTSTRUCT *) from a class derived from ATL's CWindow. I'm guessing that this is where the problem is probably coming from - the app is written in C++ with ATL.
-Steve
I've seen this occur when wine frees a gdi handle it shouldn't. Check that the OBJ_BITMAP handle is really valid.
Also wierd stuff can occur if the app expects a HDIB but we provide it a HBITMAP... or vice versa.
Mike
steve.lustbader@philips.com wrote:
My app calls GetCurrentObject with a valid HDC and OBJ_BITMAP. It returns 0, however, which causes my app to crash. What further info can I provide to help debug this?
-Steve
On Fri, 8 Nov 2002 17:56:05 -0500, you wrote:
GetCurrentObject returns 0, but as far as it knows, it is returning successfully. This is because in the line
case OBJ_BITMAP: ret = dc->hBitmap; break;
dc->hBitmap is 0, although dc is a valid DC. The HDC that is passed to GetCurrentObject to get dc is obtained by calling CWindow::BegingPaint(PAINTSTRUCT *) from a class derived from ATL's CWindow. I'm guessing that this is where the problem is probably coming from - the app is written in C++ with ATL.
-Steve
Here a patch that is lying around here for quite a while that I use to prevent an Eudora 4/5 crash with the same symptoms. I wonder if it helps you.
And yes, GetCurrentObject(..,OBJ_BITMAP) on a freshly created dc returns != 0 in windows. I'm just not sure this patch is the real solution, although I haven't seen any negative effects.
Rein.