+ 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;
+ char zFormats[128];
+ char zContainer[128];
+ USHORT uSize = GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1;
+ char* pzBuffer = new char[uSize];
+
+ memset(pzBuffer, '\0', GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()));
+ pzBuffer[GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())] = '\0';
+ GetDataObject()->GetDataHere( GetDataObject()->GetPreferredFormat()
+ ,(void*)pzBuffer
+ );
+
+ strcpy(zFormats, "<DRM_OS2FILE, DRF_UNKNOWN>");
+ strcpy(zContainer, GetDataObject()->GetPreferredFormat().GetId().c_str());
+
+ hStrRMF = ::DrgAddStrHandle(zFormats);
+ hStrContainer = ::DrgAddStrHandle(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(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