On 05/25/2011 12:36 PM, Adam Martinson wrote:
On 05/24/2011 03:37 AM, Huw Davies wrote:
+static IDropTarget* WrapDropTarget(IDropTarget* inner) +{
- DropTargetWrapper* This = HeapAlloc(GetProcessHeap(), 0,
sizeof(*This));
- if (This)
- {
This->iface = (IDropTarget){&DropTargetWrapper_VTbl };
This->iface.lpVtbl =&DropTargetWrapper_VTbl;
- hr = CoMarshalInterface(stream,&IID_IDropTarget, unk,
MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
- IUnknown_Release(unk);
- hr = CoMarshalInterface(stream,&IID_IDropTarget,
(IUnknown*)wrapper, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
if(SUCCEEDED(hr)) { hr = create_map_from_stream(stream,&map); if(SUCCEEDED(hr)) {
IDropTarget_AddRef(pDropTarget); SetPropW(hwnd, prop_oledroptarget, pDropTarget);
You probably want to set the window prop to the wrapper here. Either way you still need the AddRef (on the wrapper if you set that), it gets released in RevokeDragDrop.
Huw.
The AddRef is done in WrapDropTarget(), seems like the appropriate place for it. Quite right on the rest though, thanks.
Oops no, the window prop should be pDropTarget, not the wrapper. The wrapper is only used for the marshalling.