public static string GetSourceProjectPath(Microsoft.VisualStudio.OLE.Interop.IDataObject dataObject)
{
string projectPath = null;
FORMATETC fmtetc = CreateFormatEtc(CF_VSPROJECTCLIPDESCRIPTOR);
if(QueryGetData(dataObject, ref fmtetc) == VSConstants.S_OK)
{
STGMEDIUM stgmedium = DragDropHelper.GetData(dataObject, ref fmtetc);
if(stgmedium.tymed == (uint)TYMED.TYMED_HGLOBAL && stgmedium.unionmember != IntPtr.Zero)
{
// We are releasing the cloned hglobal here.
using (SafeGlobalAllocHandle dropInfoHandle = new SafeGlobalAllocHandle(stgmedium.unionmember, true))
{
projectPath = GetData(dropInfoHandle);
}
}
}
return projectPath;
}