>37 after ISDrawHBITMAP
how big is that bitmap?
the IS3DrawHBITMAP function works like this:
1. create a memory-based DC based on the DC you passed in
2. call ::SelectObject to select the HBITMAP you passed in into that memory-DC
3. BitBlt from the memory-DC to the output DC
4. de-select your HBITMAP from the memory DC
the IS_ERR_SELECTOBJ error happens when step 2 fails.
here's the code (it's just the standard BitBlt operation that you can find anywhere) :
Code:
if (hBmp==NULL)
{
m_error=IS_ERR_BADPARAM;
return FALSE;
}
int iCaps = ::GetDeviceCaps(outDC, RASTERCAPS);
if ((iCaps & RC_BITBLT) != RC_BITBLT)
{
m_error=IS_ERR_NODEVOP;
return FALSE;
}
// select our palette - on 16 and 24-bit displays, palettes have no effect.
if (hPal==NULL)
hPal = (HPALETTE) GetStockObject(DEFAULT_PALETTE);
HPALETTE hOldPal;
hOldPal = ::SelectPalette(outDC, hPal, FALSE);
::RealizePalette(outDC);
// create a DC to select our HBITMAP into
HDC hMemDC;
hMemDC = ::CreateCompatibleDC(outDC);
if (hMemDC==NULL)
{
m_error=IS_ERR_DC;
::SelectPalette(outDC, hOldPal, FALSE);
return FALSE;
}
// let the memDC play, too
SelectPalette(hMemDC, hPal, FALSE);
// select HBITMAP into our DC
HBITMAP olh=(HBITMAP )::SelectObject(hMemDC,hBmp);
if (olh==NULL)
{
m_error=IS_ERR_SELECTOBJ;
::SelectPalette(outDC, hOldPal, FALSE);
::DeleteDC(hMemDC);
return FALSE;
}
// copy to screen
if (!::BitBlt(outDC,
xPos, yPos,
outWidth, outHeight,
hMemDC,
srcXStart, srcYStart,
SRCCOPY))
{
m_error = IS_ERR_BITBLT;
}
// clean up
::SelectPalette(outDC, hOldPal, FALSE);
::SelectObject(hMemDC,olh);
::DeleteDC(hMemDC);
you might try calling ::GetLastError (not IS3GetLastError) after the SelectObject call, to see if Windows can tell you anything else about what happened.
--
chris losinger
smallest@smalleranimals.com