- Initialize the OLE libraries. You should check the build version and call the OleInitialize function exactly as you would for a drop source.
- Call the RegisterDragDrop function. OLE keeps a list of the windows that are drop targets. Every window that accepts dropped objects must register itself and its IDropTarget interface pointer. Then when the user drags the object over a drop target window, OLE has the IDropTarget interface pointer handy.
- Implement the IDropTarget interface. OLE uses the IDropTarget interface pointer that you registered with RegisterDragDrop to keep you informed of the state of a drop operation.
DWORD grfKeyState, POINTL pointl, LPDWORD pdwEffect) { FORMATETC fmtetc; SCODE sc = S_OK; UndrawDragFeedback(); // removes any visual feedback // QueryDrop returns TRUE if the app. can accept a drop based on // the current key state, requested action, and cursor position. if (pDataObj && QueryDrop(grfKeyState,pointl,FALSE,pdwEffect)) { m_pDoc->m_lpSite = CSimpleSite::Create(m_pDoc); m_pDoc->m_lpSite->m_dwDrawAspect = DVASPECT_CONTENT; // Initialize the FORMATETC structure. fmtetc.cfFormat = NULL; fmtetc.ptd = NULL; fmtetc.lindex = -1; fmtetc.dwAspect = DVASPECT_CONTENT; // draws object's content fmtetc.tymed = TYMED_NULL; HRESULT hrErr = OleCreateFromData (pDataObj,IID_IOleObject,OLERENDER_DRAW, &fmtetc, &m_pDoc->m_lpSite->m_OleClientSite, m_pDoc->m_lpSite->m_lpObjStorage, (LPVOID FAR *)&m_pDoc->m_lpSite->m_lpOleObject); if (hrErr == NOERROR) // The object was created successfully. else // The object creation failed. sc = GetScode(hrErr); } return ResultFromScode(sc); }
- Call the RevokeDragDrop function. Before a drop target window is destroyed, it must call RevokeDragDrop to allow OLE to remove the window from its list of drop targets.
- Uninitialize the OLE libraries. Like a drop source, your application needs to
uninitialize the OLE libraries before terminating.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers - More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples - Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database