annotate src/GvimExt/gvimext.h @ 448:dd9db57ee7ce v7.0118

updated for version 7.0118
author vimboss
date Thu, 28 Jul 2005 22:36:45 +0000
parents 4e2284e71352
children 0f9f4761ad9c
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
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
17 #if _MSC_VER > 1000
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
18 #pragma once
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
19 #endif // _MSC_VER > 1000
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
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
31 #define STRICT
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
32 #endif
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
33
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
34 #define INC_OLE2 // WIN32, get ole2 from windows.h
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
35
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
36 #include <windows.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
37 #include <windowsx.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
38 #include <shlobj.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
39
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
40 #define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
41
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
42 // Initialize GUIDs (should be done only and at-least once per DLL/EXE)
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
43 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
44 #pragma data_seg(".text")
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
45 #define INITGUID
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
46 #include <initguid.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
47 #include <shlguid.h>
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
48
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
49 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
50 // The class ID of this Shell extension class.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
51 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
52 // class id: {51EEE242-AD87-11d3-9C1E-0090278BBD99}
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
53 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
54 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
55 // NOTE!!! If you use this shell extension as a starting point,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
56 // you MUST change the GUID below. Simply run UUIDGEN.EXE
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
57 // to generate a new GUID.
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
58 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
59
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
60 // {51EEE242-AD87-11d3-9C1E-0090278BBD99}
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
61 // static const GUID <<name>> =
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
62 // { 0x51eee242, 0xad87, 0x11d3, { 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99 } };
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
63 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
64 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
65
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
66 // {51EEE242-AD87-11d3-9C1E-0090278BBD99}
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
67 // IMPLEMENT_OLECREATE(<<class>>, <<external_name>>,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
68 // 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
69 //
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
70
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
71 // {51EEE242-AD87-11d3-9C1E-0090278BBD99} -- this is the registry format
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
72 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
73
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
74 // this class factory object creates context menu handlers for windows 32 shell
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
75 class CShellExtClassFactory : public IClassFactory
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
76 {
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
77 protected:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
78 ULONG m_cRef;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
79
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
80 public:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
81 CShellExtClassFactory();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
82 ~CShellExtClassFactory();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
83
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
84 //IUnknown members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
85 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
86 STDMETHODIMP_(ULONG) AddRef();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
87 STDMETHODIMP_(ULONG) Release();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
88
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
89 //IClassFactory members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
90 STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
91 STDMETHODIMP LockServer(BOOL);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
92
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
93 };
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
94 typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
95 #define MAX_HWND 100
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
96
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
97 // this is the actual OLE Shell context menu handler
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
98 class CShellExt : public IContextMenu,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
99 IShellExtInit
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
100 {
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
101 protected:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
102 ULONG m_cRef;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
103 LPDATAOBJECT m_pDataObj;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
104 UINT m_edit_existing_off;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
105
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
106 // For some reason, this callback must be static
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
107 static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
108
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
109 STDMETHODIMP PushToWindow(HWND hParent,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
110 LPCSTR pszWorkingDir,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
111 LPCSTR pszCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
112 LPCSTR pszParam,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
113 int iShowCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
114 int idHWnd);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
115
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
116 STDMETHODIMP InvokeGvim(HWND hParent,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
117 LPCSTR pszWorkingDir,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
118 LPCSTR pszCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
119 LPCSTR pszParam,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
120 int iShowCmd);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
121
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
122 STDMETHODIMP InvokeSingleGvim(HWND hParent,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
123 LPCSTR pszWorkingDir,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
124 LPCSTR pszCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
125 LPCSTR pszParam,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
126 int iShowCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
127 int useDiff);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
128
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
129 public:
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
130 int m_cntOfHWnd;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
131 HWND m_hWnd[MAX_HWND];
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
132 CShellExt();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
133 ~CShellExt();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
134
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
135 //IUnknown members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
136 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
137 STDMETHODIMP_(ULONG) AddRef();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
138 STDMETHODIMP_(ULONG) Release();
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
139
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
140 //IShell members
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
141 STDMETHODIMP QueryContextMenu(HMENU hMenu,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
142 UINT indexMenu,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
143 UINT idCmdFirst,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
144 UINT idCmdLast,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
145 UINT uFlags);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
146
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
147 STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
148
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
149 STDMETHODIMP GetCommandString(UINT idCmd,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
150 UINT uFlags,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
151 UINT FAR *reserved,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
152 LPSTR pszName,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
153 UINT cchMax);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
154
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
155 //IShellExtInit methods
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
156 STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
157 LPDATAOBJECT pDataObj,
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
158 HKEY hKeyID);
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
159 };
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
160
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
161 typedef CShellExt *LPCSHELLEXT;
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
162 #pragma data_seg()
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
163
4e2284e71352 updated for version 7.0002
vimboss
parents:
diff changeset
164 #endif