#include <idraganddrop.h>
Public Member Functions |
|
bool | CheckClipFormat (IDataObject *pDataObject) |
DropType * | ParseDataObject (IDataObject *pDataObject) |
bool CheckClipFormat | ( | IDataObject * | pDataObject | ) | [virtual] |
Reimplemented from DropClipFormat.
DropType* ParseDataObject | ( | IDataObject * | pDataObject | ) | [virtual] |
bool VIZableClipFmt::CheckClipFormat(IDataObject* pDataObject) { // accept CF_MAXURL clip formats FORMATETC fmt = { NULL, NULL, DVASPECT_CONTENT, -1, NULL }; fmt.cfFormat = RegisterClipboardFormat(_M("CF_MAXURL")); fmt.tymed = TYMED_HGLOBAL; return SUCCEEDED(pDataObject->QueryGetData(&fmt)) == TRUE; } DropType* VIZableClipFmt::ParseDataObject(IDataObject* pDataObject) { // parse a CF_MAXURL clipformat into one of the FileDropTypes & // fill in the FileDropType::current_packge URLTab HRESULT hr; FORMATETC fmt = { NULL, NULL, DVASPECT_CONTENT, -1, NULL }; STGMEDIUM stg = { TYMED_NULL, NULL, NULL }; fmt.tymed = TYMED_HGLOBAL; fmt.cfFormat = RegisterClipboardFormat(_M("CF_MAXURL")); // clear out the file drop current data FileDropType::Init(); // look for CF_MAXURL formats hr = pDataObject->GetData(&fmt, &stg); if(SUCCEEDED(hr)) { // found, get the max file name MCHAR szUrl[MAX_PATH]; ZeroMemory(szUrl, sizeof(szUrl)); wcstombs(szUrl, reinterpret_cast<wchar_t*>(GlobalLock(stg.hGlobal)), MAX_PATH-1); GlobalUnlock(stg.hGlobal); ReleaseStgMedium(&stg); // add it to the current_package URLTab FileDropType::current_package.Add(szUrl); } // if we have a non-NULL module, get the appropriate // FileDropType (usually based on file extension), by asking the // utility DropType finder in FileDropType if (FileDropType::current_package.Count() > 0) return FileDropType::FindDropType( FileDropType::current_package[0], pDataObject); else return NULL; }
Reimplemented from DropClipFormat.