A example in MFC:
class my_OleDrop
ublic COleDropTarget
{
public:
virtual DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point )
{
UINT cf=RegisterClipboardFormat(CFSTR_SHELLURL);
if(pDataObject->IsDataAvailable(cf))
return DROPEFFECT_COPY;
else
return DROPEFFECT_NONE;
}
virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point )
{
UINT cf=RegisterClipboardFormat(CFSTR_SHELLURL);
if(pDataObject->IsDataAvailable(cf))
return DROPEFFECT_COPY;
else
return DROPEFFECT_COPY;
}
virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point )
{
UINT cf=RegisterClipboardFormat(CFSTR_SHELLURL);
if(pDataObject->IsDataAvailable(cf))
{
HGLOBAL hglb=pDataObject->GetGlobalData(cf);
char * pchar=(char *)GlobalLock(hglb);
/********************************************
The URL u want,call normal http related functions to deal with that.
*********************************************/
GlobalUnlock(hglb);
GlobalFree(hglb);
}
return true;
}
};
2.
in COleDDDlg::COleDDDlg(CWnd* pParent /*=NULL*/)
AfxOleInit();
3.
in BOOL COleDDDlg::OnInitDialog()
mDragDrop=new my_OleDrop();
VERIFY(mDragDrop->Register(this));
return TRUE; // return TRUE unless you set the focus to a control