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     virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
39     virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
40     virtual HRESULT WINAPI DragLeave();
41     virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
42 
43     // IPersist
44     virtual HRESULT WINAPI GetClassID(CLSID *lpClassId);
45 
46     //////// IPersistFile
47     virtual HRESULT WINAPI GetCurFile(LPOLESTR *ppszFileName);
48     virtual HRESULT WINAPI IsDirty();
49     virtual HRESULT WINAPI Load(LPCOLESTR pszFileName, DWORD dwMode);
50     virtual HRESULT WINAPI Save(LPCOLESTR pszFileName, BOOL fRemember);
51     virtual HRESULT WINAPI SaveCompleted(LPCOLESTR pszFileName);
52 
53 
54 DECLARE_REGISTRY_RESOURCEID(IDR_EXEDROPHANDLER)
55 DECLARE_NOT_AGGREGATABLE(CExeDropHandler)
56 
57 DECLARE_PROTECT_FINAL_CONSTRUCT()
58 
59 BEGIN_COM_MAP(CExeDropHandler)
60     COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
61     COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile)
62     COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
63 END_COM_MAP()
64 };
65 
66 #endif /* _CEXEDROPHANDLER_H_ */
67