Dear all;
I want to get the icon of the file or shortcut that is dropped and
draded into the window. How could I do this?
Now, I try to do this by modify the program of
How to Implement Drag and Drop Between Your Program and Explorer[
^]
I want to extract the icon of the Imagelist structure
and modify the code as below:
void CMultiFilerDlg::OnPaint()
{
CPaintDC dc(this);
CImageList *mm_imglist;
mm_imglist = c_FileList.GetImageList(LVSIL_SMALL);
IMAGEINFO imageinfo;
mm_imglist->GetImageInfo(0, &imageinfo);
int x = mm_imglist->GetImageCount();
CDC dcMem;
dcMem.CreateCompatibleDC (&dc);
CRect rect (imageinfo.rcImage);
CBitmap bmp;
bmp.CreateCompatibleBitmap (&dc, rect.Width (), rect.Height ());
CBitmap* pBmpOld = dcMem.SelectObject (&bmp);
mm_imglist->DrawIndirect (&dcMem, 0, CPoint (0, 0), CSize (rect.Width (), rect.Height ()), CPoint (0, 0));
dc.BitBlt(0,0,100,100,&dcMem,0,0,SRCCOPY);
dcMem.SelectObject (pBmpOld);
}
But what I extract is not the icon I put into the window, and I find the mm_imglist is not change after I put the file.
Please give a help and thanks all.