jijon
April 27th, 1999, 03:52 AM
Hi,
I want to drop files listed in my listview control
out onto Desktop Explorer.
When Drag begins,
following codes run.
Hmm... Dragging is OK,
But after drop, there is no further action.
What I want to do is,
Drag files outof my list control and
copy them into the folder I selected by
dragging.
I used COleDataSource class instead of
using COM API "DoDraDrop" directly.
void CTestDlg::OnBegindragList(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
COleDataSource cods;
COleDropSource dropsource;
STGMEDIUM stgmedium;
FORMATETC formatetc;
DROPEFFECT de;
CString str;
str = "C:\\Autoexec.bat";
/*
formatetc.tymed = TYMED_FILE;
formatetc.cfFormat = CF_HDROP;
formatetc.dwAspect = DVASPECT_ICON;
formatetc.lindex = 0;
formatetc.ptd = NULL;
*/
HGLOBAL h;
h = GlobalAlloc(GHND|GMEM_SHARE, str.GetLength()+1);
strcpy( LPSTR(GlobalLock(h)), "C:\\Autoexec.bat");
GlobalUnlock(h);
cods.CacheGlobalData(CF_HDROP, h, &formatetc);
/*
stgmedium.tymed = TYMED_FILE;
stgmedium.lpszFileName = (unsigned short*)(L"C:\\Autoexec.bat");
stgmedium.pUnkForRelease = NULL;
*/
de = cods.DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE);
if( de ==DROPEFFECT_MOVE )
{
AfxMessageBox("Drop Move");
}
else if( de == DROPEFFECT_COPY )
{
AfxMessageBox("Drop Copy");
}
else
{
AfxMessageBox("Drop NONE");
}
GlobalFree(h);
*pResult = 0;
}
What can I do?
Please help.......
http://www.jiran.com/~jijon"http://www.jiran.com/~jijon/jijonbanner.gif
I want to drop files listed in my listview control
out onto Desktop Explorer.
When Drag begins,
following codes run.
Hmm... Dragging is OK,
But after drop, there is no further action.
What I want to do is,
Drag files outof my list control and
copy them into the folder I selected by
dragging.
I used COleDataSource class instead of
using COM API "DoDraDrop" directly.
void CTestDlg::OnBegindragList(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
COleDataSource cods;
COleDropSource dropsource;
STGMEDIUM stgmedium;
FORMATETC formatetc;
DROPEFFECT de;
CString str;
str = "C:\\Autoexec.bat";
/*
formatetc.tymed = TYMED_FILE;
formatetc.cfFormat = CF_HDROP;
formatetc.dwAspect = DVASPECT_ICON;
formatetc.lindex = 0;
formatetc.ptd = NULL;
*/
HGLOBAL h;
h = GlobalAlloc(GHND|GMEM_SHARE, str.GetLength()+1);
strcpy( LPSTR(GlobalLock(h)), "C:\\Autoexec.bat");
GlobalUnlock(h);
cods.CacheGlobalData(CF_HDROP, h, &formatetc);
/*
stgmedium.tymed = TYMED_FILE;
stgmedium.lpszFileName = (unsigned short*)(L"C:\\Autoexec.bat");
stgmedium.pUnkForRelease = NULL;
*/
de = cods.DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE);
if( de ==DROPEFFECT_MOVE )
{
AfxMessageBox("Drop Move");
}
else if( de == DROPEFFECT_COPY )
{
AfxMessageBox("Drop Copy");
}
else
{
AfxMessageBox("Drop NONE");
}
GlobalFree(h);
*pResult = 0;
}
What can I do?
Please help.......
http://www.jiran.com/~jijon"http://www.jiran.com/~jijon/jijonbanner.gif