+ m_pDragInfo = ::DrgAllocDraginfo(m_ulItems);
+
+ //
+ // Set a default drag image struct with what we know so far
+ //
+ m_vDragImage.cb = sizeof(DRAGIMAGE);
+ m_vDragImage.cptl = 0; // non-zero if fl is DRG_POLYGON
+ m_vDragImage.hImage = 0; // Set in GiveFeedback
+ m_vDragImage.sizlStretch.cx = 20L;
+ m_vDragImage.sizlStretch.cy = 20L;
+ m_vDragImage.fl = DRG_ICON | DRG_STRETCH;
+ m_vDragImage.cxOffset = 0;
+ m_vDragImage.cyOffset = 0;
+
+ HSTR hStrType = ::DrgAddStrHandle(DRT_UNKNOWN);
+ HSTR hStrRMF;
+ HSTR hStrContainer;
+ wxChar zFormats[128];
+ wxChar zContainer[128];
+ USHORT uSize = (USHORT)(GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1);
+ wxChar* pzBuffer = new wxChar[uSize];
+
+ memset(pzBuffer, '\0', GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()));
+ pzBuffer[GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())] = '\0';
+ GetDataObject()->GetDataHere( GetDataObject()->GetPreferredFormat()
+ ,(void*)pzBuffer
+ );
+
+ wxStrcpy(zFormats, _T("<DRM_OS2FILE, DRF_UNKNOWN>"));
+ wxStrcpy(zContainer, GetDataObject()->GetPreferredFormat().GetId());
+
+ hStrRMF = ::DrgAddStrHandle((PSZ)zFormats);
+ hStrContainer = ::DrgAddStrHandle((PSZ)zContainer);
+
+ m_pDragItem = new DRAGITEM[m_ulItems];
+ for (ULONG i = 0; i < m_ulItems; i++)
+ {
+ m_pDragItem[i].hwndItem = m_pWindow->GetHWND();
+ m_pDragItem[i].hstrType = hStrType;
+ m_pDragItem[i].hstrRMF = hStrRMF;
+ m_pDragItem[i].hstrContainerName = hStrContainer;
+ m_pDragItem[i].fsControl = 0;
+ m_pDragItem[i].fsSupportedOps = DO_COPYABLE | DO_MOVEABLE | DO_LINKABLE;
+ m_pDragItem[i].hstrSourceName = ::DrgAddStrHandle((PSZ)pzBuffer);
+ m_pDragItem[i].hstrTargetName = m_pDragItem[i].hstrSourceName;
+ m_pDragItem[i].ulItemID = i;
+ ::DrgSetDragitem( m_pDragInfo
+ ,&m_pDragItem[i]
+ ,sizeof(DRAGITEM)
+ ,0
+ );
+ }
+ delete [] pzBuffer;
+ delete [] m_pDragItem;
+} // end of wxDropSource::Init