OLD | NEW |
| (Empty) |
1 /// Copyright (c) Microsoft Corporation. All rights reserved. | |
2 | |
3 using System; | |
4 using System.Diagnostics; | |
5 using System.Diagnostics.CodeAnalysis; | |
6 using System.IO; | |
7 using System.Runtime.InteropServices; | |
8 using System.Text; | |
9 using Microsoft.VisualStudio; | |
10 using Microsoft.VisualStudio.OLE.Interop; | |
11 using Microsoft.VisualStudio.TextManager.Interop; | |
12 | |
13 namespace Microsoft.VisualStudio.Project | |
14 { | |
15 internal static class NativeMethods | |
16 { | |
17 // IIDS | |
18 public static readonly Guid IID_IUnknown = new Guid("{00000000-0
000-0000-C000-000000000046}"); | |
19 | |
20 public const int | |
21 CLSCTX_INPROC_SERVER = 0x1; | |
22 | |
23 public const int | |
24 S_FALSE = 0x00000001, | |
25 S_OK = 0x00000000, | |
26 | |
27 IDOK = 1, | |
28 IDCANCEL = 2, | |
29 IDABORT = 3, | |
30 IDRETRY = 4, | |
31 IDIGNORE = 5, | |
32 IDYES = 6, | |
33 IDNO = 7, | |
34 IDCLOSE = 8, | |
35 IDHELP = 9, | |
36 IDTRYAGAIN = 10, | |
37 IDCONTINUE = 11, | |
38 | |
39 OLECMDERR_E_NOTSUPPORTED = unchecked((int)0x80040100), | |
40 OLECMDERR_E_UNKNOWNGROUP = unchecked((int)0x80040104), | |
41 | |
42 UNDO_E_CLIENTABORT = unchecked((int)0x80044001), | |
43 E_OUTOFMEMORY = unchecked((int)0x8007000E), | |
44 E_INVALIDARG = unchecked((int)0x80070057), | |
45 E_FAIL = unchecked((int)0x80004005), | |
46 E_NOINTERFACE = unchecked((int)0x80004002), | |
47 E_POINTER = unchecked((int)0x80004003), | |
48 E_NOTIMPL = unchecked((int)0x80004001), | |
49 E_UNEXPECTED = unchecked((int)0x8000FFFF), | |
50 E_HANDLE = unchecked((int)0x80070006), | |
51 E_ABORT = unchecked((int)0x80004004), | |
52 E_ACCESSDENIED = unchecked((int)0x80070005), | |
53 E_PENDING = unchecked((int)0x8000000A); | |
54 | |
55 public const int | |
56 OLECLOSE_SAVEIFDIRTY = 0, | |
57 OLECLOSE_NOSAVE = 1, | |
58 OLECLOSE_PROMPTSAVE = 2; | |
59 | |
60 public const int | |
61 OLEIVERB_PRIMARY = 0, | |
62 OLEIVERB_SHOW = -1, | |
63 OLEIVERB_OPEN = -2, | |
64 OLEIVERB_HIDE = -3, | |
65 OLEIVERB_UIACTIVATE = -4, | |
66 OLEIVERB_INPLACEACTIVATE = -5, | |
67 OLEIVERB_DISCARDUNDOSTATE = -6, | |
68 OLEIVERB_PROPERTIES = -7; | |
69 | |
70 public const int | |
71 OFN_READONLY = unchecked((int)0x00000001), | |
72 OFN_OVERWRITEPROMPT = unchecked((int)0x00000002), | |
73 OFN_HIDEREADONLY = unchecked((int)0x00000004), | |
74 OFN_NOCHANGEDIR = unchecked((int)0x00000008), | |
75 OFN_SHOWHELP = unchecked((int)0x00000010), | |
76 OFN_ENABLEHOOK = unchecked((int)0x00000020), | |
77 OFN_ENABLETEMPLATE = unchecked((int)0x00000040), | |
78 OFN_ENABLETEMPLATEHANDLE = unchecked((int)0x00000080), | |
79 OFN_NOVALIDATE = unchecked((int)0x00000100), | |
80 OFN_ALLOWMULTISELECT = unchecked((int)0x00000200), | |
81 OFN_EXTENSIONDIFFERENT = unchecked((int)0x00000400), | |
82 OFN_PATHMUSTEXIST = unchecked((int)0x00000800), | |
83 OFN_FILEMUSTEXIST = unchecked((int)0x00001000), | |
84 OFN_CREATEPROMPT = unchecked((int)0x00002000), | |
85 OFN_SHAREAWARE = unchecked((int)0x00004000), | |
86 OFN_NOREADONLYRETURN = unchecked((int)0x00008000), | |
87 OFN_NOTESTFILECREATE = unchecked((int)0x00010000), | |
88 OFN_NONETWORKBUTTON = unchecked((int)0x00020000), | |
89 OFN_NOLONGNAMES = unchecked((int)0x00040000), | |
90 OFN_EXPLORER = unchecked((int)0x00080000), | |
91 OFN_NODEREFERENCELINKS = unchecked((int)0x00100000), | |
92 OFN_LONGNAMES = unchecked((int)0x00200000), | |
93 OFN_ENABLEINCLUDENOTIFY = unchecked((int)0x00400000), | |
94 OFN_ENABLESIZING = unchecked((int)0x00800000), | |
95 OFN_USESHELLITEM = unchecked((int)0x01000000), | |
96 OFN_DONTADDTORECENT = unchecked((int)0x02000000), | |
97 OFN_FORCESHOWHIDDEN = unchecked((int)0x10000000); | |
98 | |
99 // for READONLYSTATUS | |
100 public const int | |
101 ROSTATUS_NotReadOnly = 0x0, | |
102 ROSTATUS_ReadOnly = 0x1, | |
103 ROSTATUS_Unknown = unchecked((int)0xFFFFFFFF); | |
104 | |
105 public const int | |
106 IEI_DoNotLoadDocData = 0x10000000; | |
107 | |
108 public const int | |
109 CB_SETDROPPEDWIDTH = 0x0160, | |
110 | |
111 GWL_STYLE = (-16), | |
112 GWL_EXSTYLE = (-20), | |
113 | |
114 DWL_MSGRESULT = 0, | |
115 | |
116 SW_SHOWNORMAL = 1, | |
117 | |
118 HTMENU = 5, | |
119 | |
120 WS_POPUP = unchecked((int)0x80000000), | |
121 WS_CHILD = 0x40000000, | |
122 WS_MINIMIZE = 0x20000000, | |
123 WS_VISIBLE = 0x10000000, | |
124 WS_DISABLED = 0x08000000, | |
125 WS_CLIPSIBLINGS = 0x04000000, | |
126 WS_CLIPCHILDREN = 0x02000000, | |
127 WS_MAXIMIZE = 0x01000000, | |
128 WS_CAPTION = 0x00C00000, | |
129 WS_BORDER = 0x00800000, | |
130 WS_DLGFRAME = 0x00400000, | |
131 WS_VSCROLL = 0x00200000, | |
132 WS_HSCROLL = 0x00100000, | |
133 WS_SYSMENU = 0x00080000, | |
134 WS_THICKFRAME = 0x00040000, | |
135 WS_TABSTOP = 0x00010000, | |
136 WS_MINIMIZEBOX = 0x00020000, | |
137 WS_MAXIMIZEBOX = 0x00010000, | |
138 WS_EX_DLGMODALFRAME = 0x00000001, | |
139 WS_EX_MDICHILD = 0x00000040, | |
140 WS_EX_TOOLWINDOW = 0x00000080, | |
141 WS_EX_CLIENTEDGE = 0x00000200, | |
142 WS_EX_CONTEXTHELP = 0x00000400, | |
143 WS_EX_RIGHT = 0x00001000, | |
144 WS_EX_LEFT = 0x00000000, | |
145 WS_EX_RTLREADING = 0x00002000, | |
146 WS_EX_LEFTSCROLLBAR = 0x00004000, | |
147 WS_EX_CONTROLPARENT = 0x00010000, | |
148 WS_EX_STATICEDGE = 0x00020000, | |
149 WS_EX_APPWINDOW = 0x00040000, | |
150 WS_EX_LAYERED = 0x00080000, | |
151 WS_EX_TOPMOST = 0x00000008, | |
152 WS_EX_NOPARENTNOTIFY = 0x00000004, | |
153 | |
154 LVM_SETEXTENDEDLISTVIEWSTYLE = (0x1000 + 54), | |
155 | |
156 LVS_EX_LABELTIP = 0x00004000, | |
157 | |
158 // winuser.h | |
159 WH_JOURNALPLAYBACK = 1, | |
160 WH_GETMESSAGE = 3, | |
161 WH_MOUSE = 7, | |
162 WSF_VISIBLE = 0x0001, | |
163 WM_NULL = 0x0000, | |
164 WM_CREATE = 0x0001, | |
165 WM_DELETEITEM = 0x002D, | |
166 WM_DESTROY = 0x0002, | |
167 WM_MOVE = 0x0003, | |
168 WM_SIZE = 0x0005, | |
169 WM_ACTIVATE = 0x0006, | |
170 WA_INACTIVE = 0, | |
171 WA_ACTIVE = 1, | |
172 WA_CLICKACTIVE = 2, | |
173 WM_SETFOCUS = 0x0007, | |
174 WM_KILLFOCUS = 0x0008, | |
175 WM_ENABLE = 0x000A, | |
176 WM_SETREDRAW = 0x000B, | |
177 WM_SETTEXT = 0x000C, | |
178 WM_GETTEXT = 0x000D, | |
179 WM_GETTEXTLENGTH = 0x000E, | |
180 WM_PAINT = 0x000F, | |
181 WM_CLOSE = 0x0010, | |
182 WM_QUERYENDSESSION = 0x0011, | |
183 WM_QUIT = 0x0012, | |
184 WM_QUERYOPEN = 0x0013, | |
185 WM_ERASEBKGND = 0x0014, | |
186 WM_SYSCOLORCHANGE = 0x0015, | |
187 WM_ENDSESSION = 0x0016, | |
188 WM_SHOWWINDOW = 0x0018, | |
189 WM_WININICHANGE = 0x001A, | |
190 WM_SETTINGCHANGE = 0x001A, | |
191 WM_DEVMODECHANGE = 0x001B, | |
192 WM_ACTIVATEAPP = 0x001C, | |
193 WM_FONTCHANGE = 0x001D, | |
194 WM_TIMECHANGE = 0x001E, | |
195 WM_CANCELMODE = 0x001F, | |
196 WM_SETCURSOR = 0x0020, | |
197 WM_MOUSEACTIVATE = 0x0021, | |
198 WM_CHILDACTIVATE = 0x0022, | |
199 WM_QUEUESYNC = 0x0023, | |
200 WM_GETMINMAXINFO = 0x0024, | |
201 WM_PAINTICON = 0x0026, | |
202 WM_ICONERASEBKGND = 0x0027, | |
203 WM_NEXTDLGCTL = 0x0028, | |
204 WM_SPOOLERSTATUS = 0x002A, | |
205 WM_DRAWITEM = 0x002B, | |
206 WM_MEASUREITEM = 0x002C, | |
207 WM_VKEYTOITEM = 0x002E, | |
208 WM_CHARTOITEM = 0x002F, | |
209 WM_SETFONT = 0x0030, | |
210 WM_GETFONT = 0x0031, | |
211 WM_SETHOTKEY = 0x0032, | |
212 WM_GETHOTKEY = 0x0033, | |
213 WM_QUERYDRAGICON = 0x0037, | |
214 WM_COMPAREITEM = 0x0039, | |
215 WM_GETOBJECT = 0x003D, | |
216 WM_COMPACTING = 0x0041, | |
217 WM_COMMNOTIFY = 0x0044, | |
218 WM_WINDOWPOSCHANGING = 0x0046, | |
219 WM_WINDOWPOSCHANGED = 0x0047, | |
220 WM_POWER = 0x0048, | |
221 WM_COPYDATA = 0x004A, | |
222 WM_CANCELJOURNAL = 0x004B, | |
223 WM_NOTIFY = 0x004E, | |
224 WM_INPUTLANGCHANGEREQUEST = 0x0050, | |
225 WM_INPUTLANGCHANGE = 0x0051, | |
226 WM_TCARD = 0x0052, | |
227 WM_HELP = 0x0053, | |
228 WM_USERCHANGED = 0x0054, | |
229 WM_NOTIFYFORMAT = 0x0055, | |
230 WM_CONTEXTMENU = 0x007B, | |
231 WM_STYLECHANGING = 0x007C, | |
232 WM_STYLECHANGED = 0x007D, | |
233 WM_DISPLAYCHANGE = 0x007E, | |
234 WM_GETICON = 0x007F, | |
235 WM_SETICON = 0x0080, | |
236 WM_NCCREATE = 0x0081, | |
237 WM_NCDESTROY = 0x0082, | |
238 WM_NCCALCSIZE = 0x0083, | |
239 WM_NCHITTEST = 0x0084, | |
240 WM_NCPAINT = 0x0085, | |
241 WM_NCACTIVATE = 0x0086, | |
242 WM_GETDLGCODE = 0x0087, | |
243 WM_NCMOUSEMOVE = 0x00A0, | |
244 WM_NCLBUTTONDOWN = 0x00A1, | |
245 WM_NCLBUTTONUP = 0x00A2, | |
246 WM_NCLBUTTONDBLCLK = 0x00A3, | |
247 WM_NCRBUTTONDOWN = 0x00A4, | |
248 WM_NCRBUTTONUP = 0x00A5, | |
249 WM_NCRBUTTONDBLCLK = 0x00A6, | |
250 WM_NCMBUTTONDOWN = 0x00A7, | |
251 WM_NCMBUTTONUP = 0x00A8, | |
252 WM_NCMBUTTONDBLCLK = 0x00A9, | |
253 WM_NCXBUTTONDOWN = 0x00AB, | |
254 WM_NCXBUTTONUP = 0x00AC, | |
255 WM_NCXBUTTONDBLCLK = 0x00AD, | |
256 WM_KEYFIRST = 0x0100, | |
257 WM_KEYDOWN = 0x0100, | |
258 WM_KEYUP = 0x0101, | |
259 WM_CHAR = 0x0102, | |
260 WM_DEADCHAR = 0x0103, | |
261 WM_CTLCOLOR = 0x0019, | |
262 WM_SYSKEYDOWN = 0x0104, | |
263 WM_SYSKEYUP = 0x0105, | |
264 WM_SYSCHAR = 0x0106, | |
265 WM_SYSDEADCHAR = 0x0107, | |
266 WM_KEYLAST = 0x0108, | |
267 WM_IME_STARTCOMPOSITION = 0x010D, | |
268 WM_IME_ENDCOMPOSITION = 0x010E, | |
269 WM_IME_COMPOSITION = 0x010F, | |
270 WM_IME_KEYLAST = 0x010F, | |
271 WM_INITDIALOG = 0x0110, | |
272 WM_COMMAND = 0x0111, | |
273 WM_SYSCOMMAND = 0x0112, | |
274 WM_TIMER = 0x0113, | |
275 WM_HSCROLL = 0x0114, | |
276 WM_VSCROLL = 0x0115, | |
277 WM_INITMENU = 0x0116, | |
278 WM_INITMENUPOPUP = 0x0117, | |
279 WM_MENUSELECT = 0x011F, | |
280 WM_MENUCHAR = 0x0120, | |
281 WM_ENTERIDLE = 0x0121, | |
282 WM_CHANGEUISTATE = 0x0127, | |
283 WM_UPDATEUISTATE = 0x0128, | |
284 WM_QUERYUISTATE = 0x0129, | |
285 WM_CTLCOLORMSGBOX = 0x0132, | |
286 WM_CTLCOLOREDIT = 0x0133, | |
287 WM_CTLCOLORLISTBOX = 0x0134, | |
288 WM_CTLCOLORBTN = 0x0135, | |
289 WM_CTLCOLORDLG = 0x0136, | |
290 WM_CTLCOLORSCROLLBAR = 0x0137, | |
291 WM_CTLCOLORSTATIC = 0x0138, | |
292 WM_MOUSEFIRST = 0x0200, | |
293 WM_MOUSEMOVE = 0x0200, | |
294 WM_LBUTTONDOWN = 0x0201, | |
295 WM_LBUTTONUP = 0x0202, | |
296 WM_LBUTTONDBLCLK = 0x0203, | |
297 WM_RBUTTONDOWN = 0x0204, | |
298 WM_RBUTTONUP = 0x0205, | |
299 WM_RBUTTONDBLCLK = 0x0206, | |
300 WM_MBUTTONDOWN = 0x0207, | |
301 WM_MBUTTONUP = 0x0208, | |
302 WM_MBUTTONDBLCLK = 0x0209, | |
303 WM_XBUTTONDOWN = 0x020B, | |
304 WM_XBUTTONUP = 0x020C, | |
305 WM_XBUTTONDBLCLK = 0x020D, | |
306 WM_MOUSEWHEEL = 0x020A, | |
307 WM_MOUSELAST = 0x020A, | |
308 WM_PARENTNOTIFY = 0x0210, | |
309 WM_ENTERMENULOOP = 0x0211, | |
310 WM_EXITMENULOOP = 0x0212, | |
311 WM_NEXTMENU = 0x0213, | |
312 WM_SIZING = 0x0214, | |
313 WM_CAPTURECHANGED = 0x0215, | |
314 WM_MOVING = 0x0216, | |
315 WM_POWERBROADCAST = 0x0218, | |
316 WM_DEVICECHANGE = 0x0219, | |
317 WM_IME_SETCONTEXT = 0x0281, | |
318 WM_IME_NOTIFY = 0x0282, | |
319 WM_IME_CONTROL = 0x0283, | |
320 WM_IME_COMPOSITIONFULL = 0x0284, | |
321 WM_IME_SELECT = 0x0285, | |
322 WM_IME_CHAR = 0x0286, | |
323 WM_IME_KEYDOWN = 0x0290, | |
324 WM_IME_KEYUP = 0x0291, | |
325 WM_MDICREATE = 0x0220, | |
326 WM_MDIDESTROY = 0x0221, | |
327 WM_MDIACTIVATE = 0x0222, | |
328 WM_MDIRESTORE = 0x0223, | |
329 WM_MDINEXT = 0x0224, | |
330 WM_MDIMAXIMIZE = 0x0225, | |
331 WM_MDITILE = 0x0226, | |
332 WM_MDICASCADE = 0x0227, | |
333 WM_MDIICONARRANGE = 0x0228, | |
334 WM_MDIGETACTIVE = 0x0229, | |
335 WM_MDISETMENU = 0x0230, | |
336 WM_ENTERSIZEMOVE = 0x0231, | |
337 WM_EXITSIZEMOVE = 0x0232, | |
338 WM_DROPFILES = 0x0233, | |
339 WM_MDIREFRESHMENU = 0x0234, | |
340 WM_MOUSEHOVER = 0x02A1, | |
341 WM_MOUSELEAVE = 0x02A3, | |
342 WM_CUT = 0x0300, | |
343 WM_COPY = 0x0301, | |
344 WM_PASTE = 0x0302, | |
345 WM_CLEAR = 0x0303, | |
346 WM_UNDO = 0x0304, | |
347 WM_RENDERFORMAT = 0x0305, | |
348 WM_RENDERALLFORMATS = 0x0306, | |
349 WM_DESTROYCLIPBOARD = 0x0307, | |
350 WM_DRAWCLIPBOARD = 0x0308, | |
351 WM_PAINTCLIPBOARD = 0x0309, | |
352 WM_VSCROLLCLIPBOARD = 0x030A, | |
353 WM_SIZECLIPBOARD = 0x030B, | |
354 WM_ASKCBFORMATNAME = 0x030C, | |
355 WM_CHANGECBCHAIN = 0x030D, | |
356 WM_HSCROLLCLIPBOARD = 0x030E, | |
357 WM_QUERYNEWPALETTE = 0x030F, | |
358 WM_PALETTEISCHANGING = 0x0310, | |
359 WM_PALETTECHANGED = 0x0311, | |
360 WM_HOTKEY = 0x0312, | |
361 WM_PRINT = 0x0317, | |
362 WM_PRINTCLIENT = 0x0318, | |
363 WM_HANDHELDFIRST = 0x0358, | |
364 WM_HANDHELDLAST = 0x035F, | |
365 WM_AFXFIRST = 0x0360, | |
366 WM_AFXLAST = 0x037F, | |
367 WM_PENWINFIRST = 0x0380, | |
368 WM_PENWINLAST = 0x038F, | |
369 WM_APP = unchecked((int)0x8000), | |
370 WM_USER = 0x0400, | |
371 WM_REFLECT = | |
372 WM_USER + 0x1C00, | |
373 WS_OVERLAPPED = 0x00000000, | |
374 WPF_SETMINPOSITION = 0x0001, | |
375 WM_CHOOSEFONT_GETLOGFONT = (0x0400 + 1), | |
376 | |
377 WHEEL_DELTA = 120, | |
378 DWLP_MSGRESULT = 0, | |
379 PSNRET_NOERROR = 0, | |
380 PSNRET_INVALID = 1, | |
381 PSNRET_INVALID_NOCHANGEPAGE = 2; | |
382 | |
383 public const int | |
384 PSN_APPLY = ((0 - 200) - 2), | |
385 PSN_KILLACTIVE = ((0 - 200) - 1), | |
386 PSN_RESET = ((0 - 200) - 3), | |
387 PSN_SETACTIVE = ((0 - 200) - 0); | |
388 | |
389 public const int | |
390 GMEM_MOVEABLE = 0x0002, | |
391 GMEM_ZEROINIT = 0x0040, | |
392 GMEM_DDESHARE = 0x2000; | |
393 | |
394 public const int | |
395 SWP_NOACTIVATE = 0x0010, | |
396 SWP_NOZORDER = 0x0004, | |
397 SWP_NOSIZE = 0x0001, | |
398 SWP_NOMOVE = 0x0002, | |
399 SWP_FRAMECHANGED = 0x0020; | |
400 | |
401 public const int | |
402 TVM_SETINSERTMARK = (0x1100 + 26), | |
403 TVM_GETEDITCONTROL = (0x1100 + 15); | |
404 | |
405 public const int | |
406 FILE_ATTRIBUTE_READONLY = 0x00000001; | |
407 | |
408 public const int | |
409 PSP_DEFAULT = 0x00000000, | |
410 PSP_DLGINDIRECT = 0x00000001, | |
411 PSP_USEHICON = 0x00000002, | |
412 PSP_USEICONID = 0x00000004, | |
413 PSP_USETITLE = 0x00000008, | |
414 PSP_RTLREADING = 0x00000010, | |
415 PSP_HASHELP = 0x00000020, | |
416 PSP_USEREFPARENT = 0x00000040, | |
417 PSP_USECALLBACK = 0x00000080, | |
418 PSP_PREMATURE = 0x00000400, | |
419 PSP_HIDEHEADER = 0x00000800, | |
420 PSP_USEHEADERTITLE = 0x00001000, | |
421 PSP_USEHEADERSUBTITLE = 0x00002000; | |
422 | |
423 public const int | |
424 PSH_DEFAULT = 0x00000000, | |
425 PSH_PROPTITLE = 0x00000001, | |
426 PSH_USEHICON = 0x00000002, | |
427 PSH_USEICONID = 0x00000004, | |
428 PSH_PROPSHEETPAGE = 0x00000008, | |
429 PSH_WIZARDHASFINISH = 0x00000010, | |
430 PSH_WIZARD = 0x00000020, | |
431 PSH_USEPSTARTPAGE = 0x00000040, | |
432 PSH_NOAPPLYNOW = 0x00000080, | |
433 PSH_USECALLBACK = 0x00000100, | |
434 PSH_HASHELP = 0x00000200, | |
435 PSH_MODELESS = 0x00000400, | |
436 PSH_RTLREADING = 0x00000800, | |
437 PSH_WIZARDCONTEXTHELP = 0x00001000, | |
438 PSH_WATERMARK = 0x00008000, | |
439 PSH_USEHBMWATERMARK = 0x00010000, // user pass in a hbm
Watermark instead of pszbmWatermark | |
440 PSH_USEHPLWATERMARK = 0x00020000, // | |
441 PSH_STRETCHWATERMARK = 0x00040000, // stretchwatermark
also applies for the header | |
442 PSH_HEADER = 0x00080000, | |
443 PSH_USEHBMHEADER = 0x00100000, | |
444 PSH_USEPAGELANG = 0x00200000, // use frame dialog templ
ate matched to page | |
445 PSH_WIZARD_LITE = 0x00400000, | |
446 PSH_NOCONTEXTHELP = 0x02000000; | |
447 | |
448 public const int | |
449 PSBTN_BACK = 0, | |
450 PSBTN_NEXT = 1, | |
451 PSBTN_FINISH = 2, | |
452 PSBTN_OK = 3, | |
453 PSBTN_APPLYNOW = 4, | |
454 PSBTN_CANCEL = 5, | |
455 PSBTN_HELP = 6, | |
456 PSBTN_MAX = 6; | |
457 | |
458 public const int | |
459 TRANSPARENT = 1, | |
460 OPAQUE = 2, | |
461 FW_BOLD = 700; | |
462 | |
463 [StructLayout(LayoutKind.Sequential)] | |
464 public struct NMHDR | |
465 { | |
466 public IntPtr hwndFrom; | |
467 public int idFrom; | |
468 public int code; | |
469 } | |
470 | |
471 /// <devdoc> | |
472 /// Helper class for setting the text parameters to OLECMDTEXT s
tructures. | |
473 /// </devdoc> | |
474 public static class OLECMDTEXT | |
475 { | |
476 | |
477 /// <summary> | |
478 /// Flags for the OLE command text | |
479 /// </summary> | |
480 public enum OLECMDTEXTF | |
481 { | |
482 /// <summary>No flag</summary> | |
483 OLECMDTEXTF_NONE = 0, | |
484 /// <summary>The name of the command is required
.</summary> | |
485 OLECMDTEXTF_NAME = 1, | |
486 /// <summary>A description of the status is requ
ired.</summary> | |
487 OLECMDTEXTF_STATUS = 2 | |
488 } | |
489 } | |
490 | |
491 /// <devdoc> | |
492 /// OLECMDF enums for IOleCommandTarget | |
493 /// </devdoc> | |
494 public enum tagOLECMDF | |
495 { | |
496 OLECMDF_SUPPORTED = 1, | |
497 OLECMDF_ENABLED = 2, | |
498 OLECMDF_LATCHED = 4, | |
499 OLECMDF_NINCHED = 8, | |
500 OLECMDF_INVISIBLE = 16 | |
501 } | |
502 | |
503 /// <devdoc> | |
504 /// This method takes a file URL and converts it to an absolute
path. The trick here is that | |
505 /// if there is a '#' in the path, everything after this is trea
ted as a fragment. So | |
506 /// we need to append the fragment to the end of the path. | |
507 /// </devdoc> | |
508 [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledP
rivateCode")] | |
509 public static string GetAbsolutePath(string fileName) | |
510 { | |
511 System.Diagnostics.Debug.Assert(fileName != null && file
Name.Length > 0, "Cannot get absolute path, fileName is not valid"); | |
512 | |
513 Uri uri = new Uri(fileName); | |
514 return uri.LocalPath + uri.Fragment; | |
515 } | |
516 | |
517 /// <devdoc> | |
518 /// Please use this "approved" method to compare file names. | |
519 /// </devdoc> | |
520 public static bool IsSamePath(string file1, string file2) | |
521 { | |
522 if(file1 == null || file1.Length == 0) | |
523 { | |
524 return (file2 == null || file2.Length == 0); | |
525 } | |
526 | |
527 Uri uri1 = null; | |
528 Uri uri2 = null; | |
529 | |
530 try | |
531 { | |
532 if(!Uri.TryCreate(file1, UriKind.Absolute, out u
ri1) || !Uri.TryCreate(file2, UriKind.Absolute, out uri2)) | |
533 { | |
534 return false; | |
535 } | |
536 | |
537 if(uri1 != null && uri1.IsFile && uri2 != null &
& uri2.IsFile) | |
538 { | |
539 return 0 == String.Compare(uri1.LocalPat
h, uri2.LocalPath, StringComparison.OrdinalIgnoreCase); | |
540 } | |
541 | |
542 return file1 == file2; | |
543 } | |
544 catch(UriFormatException e) | |
545 { | |
546 Trace.WriteLine("Exception " + e.Message); | |
547 } | |
548 | |
549 return false; | |
550 } | |
551 | |
552 [ComImport(), Guid("9BDA66AE-CA28-4e22-AA27-8A7218A0E3FA"), Inte
rfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] | |
553 public interface IEventHandler | |
554 { | |
555 | |
556 // converts the underlying codefunction into an event ha
ndler for the given event | |
557 // if the given event is NULL, then the function will ha
ndle no events | |
558 [PreserveSig] | |
559 int AddHandler(string bstrEventName); | |
560 | |
561 [PreserveSig] | |
562 int RemoveHandler(string bstrEventName); | |
563 | |
564 IVsEnumBSTR GetHandledEvents(); | |
565 | |
566 bool HandlesEvent(string bstrEventName); | |
567 } | |
568 | |
569 [ComImport(), Guid("A55CCBCC-7031-432d-B30A-A68DE7BDAD75"), Inte
rfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] | |
570 public interface IParameterKind | |
571 { | |
572 | |
573 void SetParameterPassingMode(PARAMETER_PASSING_MODE Para
mPassingMode); | |
574 void SetParameterArrayDimensions(int uDimensions); | |
575 int GetParameterArrayCount(); | |
576 int GetParameterArrayDimensions(int uIndex); | |
577 int GetParameterPassingMode(); | |
578 } | |
579 | |
580 public enum PARAMETER_PASSING_MODE | |
581 { | |
582 cmParameterTypeIn = 1, | |
583 cmParameterTypeOut = 2, | |
584 cmParameterTypeInOut = 3 | |
585 } | |
586 | |
587 [ | |
588 ComImport, ComVisible(true), Guid("3E596484-D2E4-461a-A876-254C4
F097EBB"), | |
589 InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) | |
590 ] | |
591 public interface IMethodXML | |
592 { | |
593 // Generate XML describing the contents of this function
's body. | |
594 void GetXML(ref string pbstrXML); | |
595 | |
596 // Parse the incoming XML with respect to the CodeModel
XML schema and | |
597 // use the result to regenerate the body of the function
. | |
598 /// <include file='doc\NativeMethods.uex' path='docs/doc
[@for="IMethodXML.SetXML"]/*' /> | |
599 [PreserveSig] | |
600 int SetXML(string pszXML); | |
601 | |
602 // This is really a textpoint | |
603 [PreserveSig] | |
604 int GetBodyPoint([MarshalAs(UnmanagedType.Interface)]out
object bodyPoint); | |
605 } | |
606 | |
607 [ComImport(), Guid("EA1A87AD-7BC5-4349-B3BE-CADC301F17A3"), Inte
rfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] | |
608 public interface IVBFileCodeModelEvents | |
609 { | |
610 | |
611 [PreserveSig] | |
612 int StartEdit(); | |
613 | |
614 [PreserveSig] | |
615 int EndEdit(); | |
616 } | |
617 | |
618 ///-------------------------------------------------------------
------------- | |
619 /// ICodeClassBase: | |
620 ///-------------------------------------------------------------
------------- | |
621 [GuidAttribute("23BBD58A-7C59-449b-A93C-43E59EFC080C")] | |
622 [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | |
623 [ComImport()] | |
624 public interface ICodeClassBase | |
625 { | |
626 [PreserveSig()] | |
627 int GetBaseName(out string pBaseName); | |
628 } | |
629 | |
630 public const ushort CF_HDROP = 15; // winuser.h | |
631 public const uint MK_CONTROL = 0x0008; //winuser.h | |
632 public const uint MK_SHIFT = 0x0004; | |
633 public const int MAX_PATH = 260; // windef.h | |
634 | |
635 /// <summary> | |
636 /// Specifies options for a bitmap image associated with a task
item. | |
637 /// </summary> | |
638 public enum VSTASKBITMAP | |
639 { | |
640 BMP_COMPILE = -1, | |
641 BMP_SQUIGGLE = -2, | |
642 BMP_COMMENT = -3, | |
643 BMP_SHORTCUT = -4, | |
644 BMP_USER = -5 | |
645 }; | |
646 | |
647 public const int ILD_NORMAL = 0x0000, | |
648 ILD_TRANSPARENT = 0x0001, | |
649 ILD_MASK = 0x0010, | |
650 ILD_ROP = 0x0040; | |
651 | |
652 /// <summary> | |
653 /// Defines the values that are not supported by the System.Envi
ronment.SpecialFolder enumeration | |
654 /// </summary> | |
655 [ComVisible(true)] | |
656 public enum ExtendedSpecialFolder | |
657 { | |
658 /// <summary> | |
659 /// Identical to CSIDL_COMMON_STARTUP | |
660 /// </summary> | |
661 CommonStartup = 0x0018, | |
662 | |
663 /// <summary> | |
664 /// Identical to CSIDL_WINDOWS | |
665 /// </summary> | |
666 Windows = 0x0024, | |
667 } | |
668 | |
669 | |
670 // APIS | |
671 | |
672 /// <summary> | |
673 /// Changes the parent window of the specified child window. | |
674 /// </summary> | |
675 /// <param name="hWnd">Handle to the child window.</param> | |
676 /// <param name="hWndParent">Handle to the new parent window. If
this parameter is NULL, the desktop window becomes the new parent window.</para
m> | |
677 /// <returns>A handle to the previous parent window indicates su
ccess. NULL indicates failure.</returns> | |
678 [DllImport("User32", ExactSpelling = true, CharSet = CharSet.Aut
o)] | |
679 public static extern IntPtr SetParent(IntPtr hWnd, IntPtr hWndPa
rent); | |
680 | |
681 [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet
.Auto)] | |
682 public static extern bool DestroyIcon(IntPtr handle); | |
683 | |
684 [DllImport("user32.dll", EntryPoint = "IsDialogMessageA", SetLas
tError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention =
CallingConvention.StdCall)] | |
685 public static extern bool IsDialogMessageA(IntPtr hDlg, ref MSG
msg); | |
686 | |
687 /// <summary> | |
688 /// Indicates whether the file type is binary or not | |
689 /// </summary> | |
690 /// <param name="lpApplicationName">Full path to the file to che
ck</param> | |
691 /// <param name="lpBinaryType">If file isbianry the bitness of t
he app is indicated by lpBinaryType value.</param> | |
692 /// <returns>True if the file is binary false otherwise</returns
> | |
693 [DllImport("kernel32.dll")] | |
694 public static extern bool GetBinaryType([MarshalAs(UnmanagedType
.LPWStr)]string lpApplicationName, out uint lpBinaryType); | |
695 | |
696 } | |
697 } | |
698 | |
OLD | NEW |