Help! MFC Active Control driving me bonkers!
Posted on 1998-05-14
It's a simple problem, but the answer eludes me. I have tried some methods but I've had NO success. So I'm BEGGING for someone to help me on this! :)
How do you find out the Width and Height of a bitmap object in an Active X control?? The only way it appears you can access the information it through the GetPictureDispatch function in CPictureHolder. This is what I've tried so far..
//Else draw it in Bitmap's Length and Width
LPPICTURE pPict = NULL;
LPPICTUREDISP pPictDisp = m_cPicHolder.GetPictureDispatch();
if ((pPictDisp != NULL) &&
ASSERT(pPict != NULL);
rect = rcBounds;
rect.right = rect.left + hmWidth;
rect.bottom = rect.top + hmHeight;
m_cPicHolder.Render(pdc, rect, rcBounds);
// Added in for DEBUG
_itoa( hmWidth, buffer, 10 );
pdc->ExtTextOut(rect.left, (rect.top + rect.bottom)/2, ETO_CLIPPED, rect, debugStr, debugStr.GetLength(), NULL);
// End DEBUG
and of course it FAILS miserably! Gives me some outrageous numbers for the width and height. Please, someone please explain to me what the story is here!