~bjd/syncany/misc-fixes

« back to all changes in this revision

Viewing changes to windows-syncany/SyncanyExt/ContextMenuExt.h

  • Committer: Stefan Mai
  • Date: 2011-05-31 07:32:28 UTC
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: ubuntu@iamnafets.com-20110531073228-095oh7n3c2mvjy5r
Adding Windows shell extensions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ContextMenuExt.h : Declaration of the CContextMenuExt
 
2
 
 
3
#pragma once
 
4
#include "resource.h"       // main symbols
 
5
#include "SyncanyExt_i.h"
 
6
 
 
7
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
 
8
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
 
9
#endif
 
10
 
 
11
using namespace ATL;
 
12
 
 
13
extern HMODULE g_hModule;
 
14
extern BOOL g_isExplorer;
 
15
extern LONG g_numObject;
 
16
 
 
17
 
 
18
// CContextMenuExt
 
19
 
 
20
class CContextMenuExt :
 
21
    public IShellExtInit,
 
22
    public IContextMenu
 
23
{
 
24
    LONG m_refcnt;
 
25
public:
 
26
        CContextMenuExt();
 
27
 
 
28
        TCHAR m_szFile[MAX_PATH];
 
29
    STDMETHODIMP QueryInterface(const IID &riid, void **ppv);
 
30
 
 
31
        STDMETHODIMP_(ULONG) AddRef() {
 
32
            InterlockedIncrement(&g_numObject);
 
33
            return InterlockedIncrement(&m_refcnt);
 
34
        }
 
35
 
 
36
        STDMETHODIMP_(ULONG) Release() {
 
37
            InterlockedDecrement(&g_numObject);
 
38
            ULONG res = InterlockedDecrement(&m_refcnt);
 
39
            if (!res) delete this;
 
40
            return res;
 
41
        }
 
42
 
 
43
public:
 
44
        // IShellExtInit
 
45
        STDMETHODIMP Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
 
46
 
 
47
        // IContextMenu
 
48
        STDMETHODIMP QueryContextMenu (
 
49
                HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd,
 
50
                UINT uidLastCmd, UINT uFlags );
 
51
 
 
52
        STDMETHODIMP GetCommandString (
 
53
                UINT_PTR idCmd, UINT uFlags, UINT* pwReserved,
 
54
                LPSTR pszName, UINT cchMax );
 
55
 
 
56
        STDMETHODIMP InvokeCommand (
 
57
                LPCMINVOKECOMMANDINFO pCmdInfo );
 
58
 
 
59
};
 
 
b'\\ No newline at end of file'