OLEStartDrag (ILEADRasterImgList) example for C++ 5.0 and later

BOOL COLEDragDropDlg::OnInitDialog()
{
    .
    .
    .
    m_LeadImgList2.SetDisplayItemText(true);
    m_LeadImgList2.SetScrollStyle(IMGLST_SCROLLSTYLE_VERTICAL);
    m_LeadImgList2.SetItemHeight(150);
    m_LeadImgList2.SetItemWidth(150);
    m_LeadImgList2.SetAllowSelection(IMGLST_ALLOWSELECTION_MULTI);
   
    m_LeadImgList1.LoadFromFile("c:\\1.bmp",0,0,1);
    return TRUE; // return TRUE unless you set the focus to a control
}

void COLEDragDropDlg::OnStartDrag()
{
    m_LeadImgList1.SetEnableOLEDragMethod(true);
    m_LeadImgList2.SetEnableOLEDragMethod(true);
   
    CPictureHolder PicHolder;
    PicHolder.CreateFromIcon(IDR_MAINFRAME);
   
    m_LeadImgList1.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
    m_LeadImgList2.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
}

void COLEDragDropDlg::OnStopDrag()
{
    m_LeadImgList1.SetEnableOLEDragMethod(false);
    m_LeadImgList2.SetEnableOLEDragMethod(false);
}

void COLEDragDropDlg::OnImgList1_OLECompleteDrag(short Button, short Shift, long x, long y)
{
    CString tmp;
    tmp.Format("Drag Complete for Item# %d \n",m_LeadImgList1.HitTest(x, y));
    m_strHistory += tmp;
}

void COLEDragDropDlg::OnImgList1_OLEDragOver(short Button, short Shift, long x, long y)
{
    CString tmp;
    tmp.Format("Drag Over Item# %d \n",m_LeadImgList1.HitTest(x, y));
    m_strHistory += tmp;
}

void COLEDragDropDlg::OnImgList1_OLEGiveFeedback()
{
   m_LeadImgList1.SetEnableUseDefaultCursor(false);
}

void COLEDragDropDlg::OnImgList1_OLEStartDrag(short Button, short Shift, long x, long y)
{
    CString tmp;
    tmp.Format("Drag Start for Item# %d \n",m_LeadImgList1.HitTest(x, y));
    m_strHistory += tmp;
}

void COLEDragDropDlg::OnShowHistory()
{
    MessageBox(m_strHistory);
}