annotate src/GvimExt/gvimext.h @ 16538:cb7c468eae13

Added tag v8.1.1272 for changeset d9f6590071097bc26887abcc5ea6083db1ecc45a
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 May 2019 13:15:08 +0200
parents 7fad90423bd2
children 31546178bc83
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
2 *
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved gvimext by Tianmiao Hu
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
4 *
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
7 */
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
8
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
9 /*
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
10 * If you have any questions or any suggestions concerning gvimext, please
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
11 * contact Tianmiao Hu: tianmiao@acm.org.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
12 */
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
13
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
14 #if !defined(AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_)
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
15 #define AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
16
2080
fa7e62dd58d7 updated for version 7.2.364
Bram Moolenaar <bram@zimbu.org>
parents: 842
diff changeset
17 #if defined(_MSC_VER) && _MSC_VER > 1000
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
18 #pragma once
2080
fa7e62dd58d7 updated for version 7.2.364
Bram Moolenaar <bram@zimbu.org>
parents: 842
diff changeset
19 #endif
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
20
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
21 // Insert your headers here
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
22 // #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
23
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
24 //--------------------------------------------------------------
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
25 // common user interface routines
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
26 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
27 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
28 //--------------------------------------------------------------
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
29
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
30 #ifndef STRICT
842
a209672376fd updated for version 7.0f
vimboss
parents: 835
diff changeset
31 # define STRICT
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
32 #endif
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
33
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 8180
diff changeset
34 #define INC_OLE2 // MS-Windows, get ole2 from windows.h
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
35
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 10
diff changeset
36 /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
2080
fa7e62dd58d7 updated for version 7.2.364
Bram Moolenaar <bram@zimbu.org>
parents: 842
diff changeset
37 #if defined(_MSC_VER) && _MSC_VER >= 1400
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 10
diff changeset
38 # define _CRT_SECURE_NO_DEPRECATE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 10
diff changeset
39 # define _CRT_NONSTDC_NO_DEPRECATE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 10
diff changeset
40 #endif
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 10
diff changeset
41
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
42 #include <windows.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
43 #include <windowsx.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
44 #include <shlobj.h>
8180
1e48ffa2d697 commit https://github.com/vim/vim/commit/271273c39f2150ecdaa67fe1a2a8e9cdc63db545
Christian Brabandt <cb@256bit.org>
parents: 6805
diff changeset
45 #include <wchar.h>
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
46
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 714
diff changeset
47 /* Accommodate old versions of VC that don't have a modern Platform SDK */
2224
a0cce15dd2a9 Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents: 2080
diff changeset
48 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
842
a209672376fd updated for version 7.0f
vimboss
parents: 835
diff changeset
49 # undef UINT_PTR
a209672376fd updated for version 7.0f
vimboss
parents: 835
diff changeset
50 # define UINT_PTR UINT
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 714
diff changeset
51 #endif
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 714
diff changeset
52
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
53 #define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
54
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
55 // Initialize GUIDs (should be done only and at-least once per DLL/EXE)
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
56 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
57 #pragma data_seg(".text")
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
58 #define INITGUID
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
59 #include <initguid.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
60 #include <shlguid.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
61
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
62 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
63 // The class ID of this Shell extension class.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
64 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
65 // class id: {51EEE242-AD87-11d3-9C1E-0090278BBD99}
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
66 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
67 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
68 // NOTE!!! If you use this shell extension as a starting point,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
69 // you MUST change the GUID below. Simply run UUIDGEN.EXE
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
70 // to generate a new GUID.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
71 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
72
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
73 // {51EEE242-AD87-11d3-9C1E-0090278BBD99}
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
74 // static const GUID <<name>> =
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
75 // { 0x51eee242, 0xad87, 0x11d3, { 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99 } };
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
76 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
77 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
78
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
79 // {51EEE242-AD87-11d3-9C1E-0090278BBD99}
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
80 // IMPLEMENT_OLECREATE(<<class>>, <<external_name>>,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
81 // 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
82 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
83
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
84 // {51EEE242-AD87-11d3-9C1E-0090278BBD99} -- this is the registry format
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
85 DEFINE_GUID(CLSID_ShellExtension, 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
86
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
87 // this class factory object creates context menu handlers for windows 32 shell
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
88 class CShellExtClassFactory : public IClassFactory
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
89 {
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
90 protected:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
91 ULONG m_cRef;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
92
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
93 public:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
94 CShellExtClassFactory();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
95 ~CShellExtClassFactory();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
96
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
97 //IUnknown members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
98 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
99 STDMETHODIMP_(ULONG) AddRef();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
100 STDMETHODIMP_(ULONG) Release();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
101
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
102 //IClassFactory members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
103 STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
104 STDMETHODIMP LockServer(BOOL);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
105
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
106 };
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
107 typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
108 #define MAX_HWND 100
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
109
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
110 // this is the actual OLE Shell context menu handler
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
111 class CShellExt : public IContextMenu,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
112 IShellExtInit
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
113 {
6805
81cb471657e0 patch 7.4.724
Bram Moolenaar <bram@vim.org>
parents: 2224
diff changeset
114 private:
81cb471657e0 patch 7.4.724
Bram Moolenaar <bram@vim.org>
parents: 2224
diff changeset
115 BOOL LoadMenuIcon();
81cb471657e0 patch 7.4.724
Bram Moolenaar <bram@vim.org>
parents: 2224
diff changeset
116
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
117 protected:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
118 ULONG m_cRef;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
119 LPDATAOBJECT m_pDataObj;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
120 UINT m_edit_existing_off;
6805
81cb471657e0 patch 7.4.724
Bram Moolenaar <bram@vim.org>
parents: 2224
diff changeset
121 HBITMAP m_hVimIconBitmap;
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
122
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
123 // For some reason, this callback must be static
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
124 static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
125
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
126 STDMETHODIMP PushToWindow(HWND hParent,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
127 LPCSTR pszWorkingDir,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
128 LPCSTR pszCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
129 LPCSTR pszParam,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
130 int iShowCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
131 int idHWnd);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
132
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
133 STDMETHODIMP InvokeGvim(HWND hParent,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
134 LPCSTR pszWorkingDir,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
135 LPCSTR pszCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
136 LPCSTR pszParam,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
137 int iShowCmd);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
138
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
139 STDMETHODIMP InvokeSingleGvim(HWND hParent,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
140 LPCSTR pszWorkingDir,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
141 LPCSTR pszCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
142 LPCSTR pszParam,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
143 int iShowCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
144 int useDiff);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
145
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
146 public:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
147 int m_cntOfHWnd;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
148 HWND m_hWnd[MAX_HWND];
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
149 CShellExt();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
150 ~CShellExt();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
151
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
152 //IUnknown members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
153 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
154 STDMETHODIMP_(ULONG) AddRef();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
155 STDMETHODIMP_(ULONG) Release();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
156
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
157 //IShell members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
158 STDMETHODIMP QueryContextMenu(HMENU hMenu,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
159 UINT indexMenu,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
160 UINT idCmdFirst,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
161 UINT idCmdLast,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
162 UINT uFlags);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
163
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
164 STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
165
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 714
diff changeset
166 STDMETHODIMP GetCommandString(UINT_PTR idCmd,
10
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
167 UINT uFlags,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
168 UINT FAR *reserved,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
169 LPSTR pszName,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
170 UINT cchMax);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
171
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
172 //IShellExtInit methods
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
173 STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
174 LPDATAOBJECT pDataObj,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
175 HKEY hKeyID);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
176 };
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
177
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
178 typedef CShellExt *LPCSHELLEXT;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
179 #pragma data_seg()
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
180
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
181 #endif