1 /* 2 * executable drop target handler 3 * 4 * Copyright 2014 Huw Campbell 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 21 #ifndef _CEXEDROPHANDLER_H_ 22 #define _CEXEDROPHANDLER_H_ 23 24 class CExeDropHandler : 25 public CComCoClass<CExeDropHandler, &CLSID_ExeDropHandler>, 26 public CComObjectRootEx<CComMultiThreadModelNoCS>, 27 public IDropTarget, 28 public IPersistFile 29 { 30 private: 31 CLSID *pclsid; 32 LPWSTR sPathTarget; 33 public: 34 CExeDropHandler(); 35 ~CExeDropHandler(); 36 37 // IDropTarget 38 STDMETHOD(DragEnter)(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override; 39 STDMETHOD(DragOver)(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override; 40 STDMETHOD(DragLeave)() override; 41 STDMETHOD(Drop)(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override; 42 43 // IPersist 44 STDMETHOD(GetClassID)(CLSID *lpClassId) override; 45 46 //////// IPersistFile 47 STDMETHOD(GetCurFile)(LPOLESTR *ppszFileName) override; 48 STDMETHOD(IsDirty)() override; 49 STDMETHOD(Load)(LPCOLESTR pszFileName, DWORD dwMode) override; 50 STDMETHOD(Save)(LPCOLESTR pszFileName, BOOL fRemember) override; 51 STDMETHOD(SaveCompleted)(LPCOLESTR pszFileName) override; 52 53 DECLARE_REGISTRY_RESOURCEID(IDR_EXEDROPHANDLER) 54 DECLARE_NOT_AGGREGATABLE(CExeDropHandler) 55 56 DECLARE_PROTECT_FINAL_CONSTRUCT() 57 58 BEGIN_COM_MAP(CExeDropHandler) 59 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) 60 COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile) 61 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) 62 END_COM_MAP() 63 }; 64 65 #endif /* _CEXEDROPHANDLER_H_ */ 66