Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

IPicture::Render question

yoavoyoavo Member Posts: 4
Hi,
I have an ATL exe server and I want to draw a bitmap which a VB client suppose to deliever.
In a class (XMyClass) I have a method which gets an input parameter IPicture* and should draw the bitmap on a
button.
Here is the implementation of the method (To simplify the problem, I draw the bitmap directly on the Desktop):

STDMETHODIMP XMyClass::DrawBitmap(IPicture *iPicture)
{
if (iPicture)
{
CDC aScreen, aToHDC,aFromHDC;
aScreen.CreateDC(_T("DISPLAY"),NULL,NULL,NULL);
// get width and height of picture
long hmWidth;
long hmHeight;
iPicture->get_Width(&hmWidth);
iPicture->get_Height(&hmHeight);
// convert himetric to pixels
int nWidth = MulDiv(hmWidth, GetDeviceCaps(aScreen, LOGPIXELSX), 2540);
int nHeight = MulDiv(hmHeight, GetDeviceCaps(aScreen, LOGPIXELSY), 2540);
// display picture using IPicture::Render
HRESULT hr = iPicture->Render(aScreen, 0, 0, nWidth, nHeight, 0, hmHeight, hmWidth, -hmHeight, NULL);
}

My problem is that in my application (which is quite big one...) I failed to render the picture. I get in the HRESULT
the error: "A null reference pointer was passed to the stub".
(In a smaller application that I've created just to check this issue, the bitmap is drawn and there is no problem...)

Does anyone have any idea what may cause the problem ?

thanks in advance,
Yoav.


Sign In or Register to comment.