passing OLE Control Obj as parameter to another OLE Control
Norman C. Byers -- nbyers@intxxnet.com
Monday, November 18, 1996
Environment: VC++ 4.2b, NT4.0=09
I've been having problems with the Media Architects (now going out of =
business...) ImageKnife control.
The component gallery generated class is call Cpicbuf. The Function I'm =
trying to call is called Assign(LPDISPATCH src). This essential takes =
one Cpicbuf and copies it to another. I've been passing a =
Srcpicbuf.GetIDispatch() value. It's not working and returning a message =
that the Src LPDISPATCH does not represent a valid ImageKnife control.=20
The equivalent in VB is very simple, given 2 picbuf objects: DestPicbuf =
and SrcPicBuf:
DestPicbuf.Assign SrcPicBuf
How do we duplicate the equivalent in C++ ? I've been searching thru =
MSDN and other CD's for what would seem to be a simple answer.
Michael C. Hamilton -- mch@tiac.net
Tuesday, November 19, 1996
Norman Byers wrote:
> The component gallery generated class is call Cpicbuf. The Function
> I'm trying to call is called Assign(LPDISPATCH src). This essential
> takes one Cpicbuf and copies it to another. I've been passing a
> Srcpicbuf.GetIDispatch() value. It's not working and returning a
> message that the Src LPDISPATCH does not represent a valid ImageKnife
> control.
I had the same problem with ImageKnife/OCX when I first started using
it. The solution was to add the following function to the CPicbuf
class:
LPDISPATCH CPicbuf::GetLPDispatch()
{
LPDISPATCH retDisp = NULL;
IUnknown* pIUnknown = GetControlUnknown();
if (pIUnknown != NULL)
pIUnknown->QueryInterface(IID_IDispatch, (void**)&retDisp);
return retDisp;
}
The Assign() function now becomes:
m_DestPicbuf.Assign(0, m_SrcPicbuf.GetLPDispatch(), 0);
Good luck,
-Michael
Michael C. Hamilton -- mch@tiac.net
Tuesday, November 19, 1996
Norman Byers wrote:
> The component gallery generated class is call Cpicbuf. The Function
> I'm trying to call is called Assign(LPDISPATCH src). This essential
> takes one Cpicbuf and copies it to another. I've been passing a
> Srcpicbuf.GetIDispatch() value. It's not working and returning a
> message that the Src LPDISPATCH does not represent a valid ImageKnife
> control.
I had the same problem with ImageKnife/OCX when I first started using
it. The solution was to add the following function to the CPicbuf
class:
LPDISPATCH CPicbuf::GetLPDispatch()
{
LPDISPATCH retDisp = NULL;
IUnknown* pIUnknown = GetControlUnknown();
if (pIUnknown != NULL)
pIUnknown->QueryInterface(IID_IDispatch, (void**)&retDisp);
return retDisp;
}
The Assign() function now becomes:
m_DestPicbuf.Assign(0, m_SrcPicbuf.GetLPDispatch(), 0);
Good luck,
-Michael
| Вернуться в корень Архива
|