Merged from the latest developing branch.
[MacVim.git] / src / GvimExt / gvimext.h
blob3b6b40b104d2435788a3f57888763d84b1399cff
1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved gvimext by Tianmiao Hu
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 */
9 /*
10 * If you have any questions or any suggestions concerning gvimext, please
11 * contact Tianmiao Hu: tianmiao@acm.org.
14 #if !defined(AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_)
15 #define AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_
17 #if defined(_MSC_VER) && _MSC_VER > 1000
18 #pragma once
19 #endif
21 // Insert your headers here
22 // #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
24 //--------------------------------------------------------------
25 // common user interface routines
28 //--------------------------------------------------------------
30 #ifndef STRICT
31 # define STRICT
32 #endif
34 #define INC_OLE2 // WIN32, get ole2 from windows.h
36 /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
37 #if defined(_MSC_VER) && _MSC_VER >= 1400
38 # define _CRT_SECURE_NO_DEPRECATE
39 # define _CRT_NONSTDC_NO_DEPRECATE
40 #endif
42 #include <windows.h>
43 #include <windowsx.h>
44 #include <shlobj.h>
46 /* Accommodate old versions of VC that don't have a modern Platform SDK */
47 #if defined(_MSC_VER) && _MSC_VER < 1300
48 # undef UINT_PTR
49 # define UINT_PTR UINT
50 #endif
52 #define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
54 // Initialize GUIDs (should be done only and at-least once per DLL/EXE)
56 #pragma data_seg(".text")
57 #define INITGUID
58 #include <initguid.h>
59 #include <shlguid.h>
62 // The class ID of this Shell extension class.
64 // class id: {51EEE242-AD87-11d3-9C1E-0090278BBD99}
67 // NOTE!!! If you use this shell extension as a starting point,
68 // you MUST change the GUID below. Simply run UUIDGEN.EXE
69 // to generate a new GUID.
72 // {51EEE242-AD87-11d3-9C1E-0090278BBD99}
73 // static const GUID <<name>> =
74 // { 0x51eee242, 0xad87, 0x11d3, { 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99 } };
78 // {51EEE242-AD87-11d3-9C1E-0090278BBD99}
79 // IMPLEMENT_OLECREATE(<<class>>, <<external_name>>,
80 // 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
83 // {51EEE242-AD87-11d3-9C1E-0090278BBD99} -- this is the registry format
84 DEFINE_GUID(CLSID_ShellExtension, 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
86 // this class factory object creates context menu handlers for windows 32 shell
87 class CShellExtClassFactory : public IClassFactory
89 protected:
90 ULONG m_cRef;
92 public:
93 CShellExtClassFactory();
94 ~CShellExtClassFactory();
96 //IUnknown members
97 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
98 STDMETHODIMP_(ULONG) AddRef();
99 STDMETHODIMP_(ULONG) Release();
101 //IClassFactory members
102 STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
103 STDMETHODIMP LockServer(BOOL);
106 typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY;
107 #define MAX_HWND 100
109 // this is the actual OLE Shell context menu handler
110 class CShellExt : public IContextMenu,
111 IShellExtInit
113 protected:
114 ULONG m_cRef;
115 LPDATAOBJECT m_pDataObj;
116 UINT m_edit_existing_off;
118 // For some reason, this callback must be static
119 static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
121 STDMETHODIMP PushToWindow(HWND hParent,
122 LPCSTR pszWorkingDir,
123 LPCSTR pszCmd,
124 LPCSTR pszParam,
125 int iShowCmd,
126 int idHWnd);
128 STDMETHODIMP InvokeGvim(HWND hParent,
129 LPCSTR pszWorkingDir,
130 LPCSTR pszCmd,
131 LPCSTR pszParam,
132 int iShowCmd);
134 STDMETHODIMP InvokeSingleGvim(HWND hParent,
135 LPCSTR pszWorkingDir,
136 LPCSTR pszCmd,
137 LPCSTR pszParam,
138 int iShowCmd,
139 int useDiff);
141 public:
142 int m_cntOfHWnd;
143 HWND m_hWnd[MAX_HWND];
144 CShellExt();
145 ~CShellExt();
147 //IUnknown members
148 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
149 STDMETHODIMP_(ULONG) AddRef();
150 STDMETHODIMP_(ULONG) Release();
152 //IShell members
153 STDMETHODIMP QueryContextMenu(HMENU hMenu,
154 UINT indexMenu,
155 UINT idCmdFirst,
156 UINT idCmdLast,
157 UINT uFlags);
159 STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
161 STDMETHODIMP GetCommandString(UINT_PTR idCmd,
162 UINT uFlags,
163 UINT FAR *reserved,
164 LPSTR pszName,
165 UINT cchMax);
167 //IShellExtInit methods
168 STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder,
169 LPDATAOBJECT pDataObj,
170 HKEY hKeyID);
173 typedef CShellExt *LPCSHELLEXT;
174 #pragma data_seg()
176 #endif