How do I pass a CImage object to a control that accepts a LPDISPATCH parameter?

I am having problems loading a picture into a control.
I need to load files into the control at run time.
The IDispatch wrapper class for the control looks like this:

class aPictReaderctrl : public CWnd {
    void SetPicture(LPDISPATCH propVal) {....}

I am using  CImage to load a picure like this:
   aPictReaderctrl     cPicureCtl;

   CString   strPicture = "SomePicture.tif";
   CImage  ciPicure;
   HRESULT hResult = ciPicure.Load(strPicture );


I could pass the CImage into a picure control.

  CStatic m_PictureBx;

   cPicureCtl.SetPicture(m_PictureBx.GetDispatchIID( ?????  ));

but then, what do I use in the parameter to GetDispatchIID( IID *pIID )?

I don't know if there is an easier approach.
Could someone help me?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You may use 'CPictureHolder' class for this....


CPictureHolder pic;

pic.CreateFromBitmap(ciPicure.m_hBitmap); //bitmap handle of CImage::m_hBitmap

cPicureCtl.SetPicture(pic.GetPictureDispatch()); //Attach to IDispatch


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ruben1717Author Commented:
Thank you very much, it worked.
>>Thank you very much, it worked.

Then why Grade 'B' ????

Ruben1717Author Commented:
I am so sorry, I had selected "A",  I think you deserve an "A". I must have accidently clicked on "B". I got a popup window from my test program, just before I clicked submit, and I must have selected the wrong  grade when I reenactivated the screen.  My apologies.  
I am trying to correct the grade now.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.