ProgressThreadProcClass.cs 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using System.Threading;
  5. using System.Drawing;
  6. namespace PaintDotNet
  7. {
  8. class ProgressThreadProcClass
  9. {
  10. private IFileTransferProgressEvents progressEvent;
  11. private Thread progressThread;
  12. public static void AddOnceThread(Form win32Window, Delegate method)
  13. {
  14. ProgressThreadProcClass procClass = new ProgressThreadProcClass();
  15. int itemCount = 100;
  16. ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
  17. //System.Threading.ThreadStart threadStart = null;
  18. System.Threading.ThreadStart copyThreadProc =
  19. delegate ()
  20. {
  21. try
  22. {
  23. win32Window.Invoke(method);
  24. }
  25. catch (Exception)
  26. {
  27. }
  28. finally
  29. {
  30. progressEvents.EndOperation(OperationResult.Finished);
  31. }
  32. };
  33. procClass.StartProgressAction(/*currentForm*/win32Window, itemCount, copyThreadProc, progressEvents, null);
  34. }
  35. /// <summary>
  36. /// 进度条消失
  37. /// </summary>
  38. /// <param name="win32Window">控制进度条的form</param>
  39. public void DismissProgressAction(Form win32Window)
  40. {
  41. if (progressThread != null)
  42. {
  43. //progressThread.Abort();
  44. progressThread = null;
  45. }
  46. if (progressEvent != null)
  47. {
  48. progressEvent.EndOperation(OperationResult.Finished);
  49. progressEvent = null;
  50. }
  51. }
  52. /// <summary>
  53. /// 进度条方法-无具体进度
  54. /// </summary>
  55. /// <param name="win32Window">控制进度条的form</param>
  56. /// <param name="threadStart">可拷贝下面方法中的内容,将delegate改为具体运算过程的方法名</param>
  57. public void StartProgressAutoAction(Form win32Window, ThreadStart threadStart, string dialogText)
  58. {
  59. if (progressEvent != null)
  60. {
  61. progressEvent.EndOperation(OperationResult.Finished);
  62. progressEvent = null;
  63. }
  64. if (progressThread != null)
  65. {
  66. progressThread.Abort();
  67. progressThread = null;
  68. }
  69. int itemCount = 100;
  70. progressEvent = new IFileTransferProgressEvents();
  71. progressEvent.SetAutoWait(true);
  72. ThreadStart copyThreadProc =
  73. delegate ()
  74. {
  75. try
  76. {
  77. progressEvent.SetItemCount(itemCount);
  78. while (progressEvent != null)
  79. {
  80. for (int i = 0; i < itemCount; ++i)
  81. {
  82. Thread.Sleep(10);
  83. if (progressEvent != null)
  84. progressEvent.SetItemOrdinal(i);
  85. }
  86. if (progressEvent != null)
  87. Thread.Sleep(600);
  88. //Thread.SpinWait(600);
  89. }
  90. }
  91. catch
  92. {
  93. }
  94. finally
  95. {
  96. if (progressEvent != null)
  97. {
  98. progressEvent.EndOperation(OperationResult.Finished);
  99. progressEvent = null;
  100. }
  101. }
  102. };
  103. progressThread = new Thread(threadStart);
  104. progressThread.SetApartmentState(ApartmentState.STA);
  105. progressThread.Start();
  106. Thread copyThread = new Thread(copyThreadProc);
  107. copyThread.SetApartmentState(ApartmentState.STA);
  108. ////copyThread.IsBackground = true;
  109. //copyThread/*Thread.CurrentThread*/.Priority = ThreadPriority.BelowNormal/*AboveNormal*/;
  110. EventHandler onUIShown =
  111. delegate (object sender, EventArgs e)
  112. {
  113. copyThread.Start();
  114. };
  115. progressEvent.BeginOperation(win32Window, onUIShown, dialogText);
  116. copyThread.Join();
  117. copyThread.Abort();
  118. GC.KeepAlive(win32Window);
  119. }
  120. /// <summary>
  121. /// 进度条方法-有具体进度
  122. /// </summary>
  123. /// <param name="win32Window">弹出进度条的form</param>
  124. /// <param name="itemCount">进度条总进度,建议值为100或200</param>
  125. /// <param name="copyThreadProc">可拷贝下面方法中的内容,将Thread.Sleep(50)改为具体运算过程</param>
  126. public void StartProgressAction(Form win32Window, int itemCount, ThreadStart copyThreadProc, IFileTransferProgressEvents progressEvents, string dialogText)
  127. {
  128. if (itemCount > 0)
  129. {
  130. if (progressEvents == null)
  131. {
  132. progressEvent = new IFileTransferProgressEvents();
  133. }
  134. else
  135. progressEvent = progressEvents;
  136. if (copyThreadProc == null)
  137. copyThreadProc =
  138. delegate ()
  139. {
  140. try
  141. {
  142. progressEvent.SetItemCount(itemCount);
  143. for (int i = 0; i < itemCount; ++i)
  144. {
  145. Thread.Sleep(50);
  146. progressEvent.SetItemOrdinal(i);
  147. }
  148. }
  149. finally
  150. {
  151. progressEvent.EndOperation(OperationResult.Finished);
  152. }
  153. };
  154. Thread copyThread = new Thread(copyThreadProc);
  155. copyThread.SetApartmentState(ApartmentState.STA);
  156. EventHandler onUIShown =
  157. delegate (object sender, EventArgs e)
  158. {
  159. copyThread.Start();
  160. };
  161. progressEvent.BeginOperation(win32Window, onUIShown, dialogText);
  162. copyThread.Join();
  163. }
  164. GC.KeepAlive(win32Window);
  165. }
  166. /// <summary>
  167. /// 方法备份
  168. /// </summary>
  169. /// <param name="win32Window"></param>
  170. /// <param name="itemCount"></param>
  171. public void StartProgressActionCopy(Form win32Window, int itemCount/*, string[] items*/)
  172. {
  173. //int hr = NativeConstants.S_OK;
  174. //List<string> localPathNames = new List<string>();
  175. if (itemCount/*needLocalCopy.Count*/ > 0)
  176. {
  177. IFileTransferProgressEvents progressEvents = new IFileTransferProgressEvents();
  178. ThreadStart copyThreadProc =
  179. delegate ()
  180. {
  181. try
  182. {
  183. progressEvents.SetItemCount(itemCount);
  184. for (int i = 0; i < itemCount/*needLocalCopy.Count*/; ++i)
  185. {
  186. //NativeInterfaces.IShellItem item = needLocalCopy[i];
  187. progressEvents.SetItemOrdinal(i);
  188. //CopyResult result = CreateLocalCopy(item, progressEvents, out pathName);
  189. //if (result == CopyResult.Success)
  190. //{
  191. // localPathNames.Add(pathName);
  192. //}
  193. //else if (result == CopyResult.Skipped)
  194. //{
  195. // // do nothing
  196. //}
  197. //else if (result == CopyResult.CancelOperation)
  198. //{
  199. // hr = NativeConstants.S_FALSE;
  200. // break;
  201. //}
  202. //else
  203. //{
  204. // throw new InvalidEnumArgumentException();
  205. //}
  206. }
  207. }
  208. finally
  209. {
  210. OperationResult result = OperationResult.Finished;
  211. //if (hr == NativeConstants.S_OK)
  212. // result = OperationResult.Finished;
  213. //else
  214. // result = OperationResult.Canceled;
  215. progressEvents.EndOperation(result);
  216. }
  217. };
  218. Thread copyThread = new Thread(copyThreadProc);
  219. copyThread.SetApartmentState(ApartmentState.STA);
  220. EventHandler onUIShown =
  221. delegate (object sender, EventArgs e)
  222. {
  223. copyThread.Start();
  224. };
  225. //this.cancelSink = new CancelableTearOff();
  226. progressEvents.BeginOperation(win32Window, onUIShown/*, cancelSink*/, null);
  227. //this.cancelSink = null;
  228. copyThread.Join();
  229. //oleWindow = null;
  230. }
  231. //this.FileNames = localPathNames.ToArray();
  232. //items.Clear();
  233. //items = null;
  234. GC.KeepAlive(win32Window);
  235. //return hr;
  236. }
  237. #region 内部类
  238. public class IFileTransferProgressEvents
  239. {
  240. private TransferProgressDialog progressDialog;
  241. //private ICancelable cancelSink;
  242. private bool autoWait = false;
  243. private int itemCount = 0;
  244. private int itemOrdinal = 0;
  245. private string itemName = string.Empty;
  246. private long totalWork;
  247. private long totalProgress;
  248. private /*const */int maxPBValue = 100;//200; // granularity of progress bar. 100 means 1%, 200 means 0.5%, etc.
  249. //private bool cancelRequested = false;
  250. public void BeginOperation(Form/*IWin32Window*/ owner, EventHandler callWhenUIShown/*, ICancelable cancelSink*/, string dialogText)
  251. {
  252. if (this.progressDialog != null)
  253. {
  254. //throw new InvalidOperationException("Operation already in progress");
  255. return;
  256. }
  257. this.progressDialog = new TransferProgressDialog();
  258. this.progressDialog.lblTitleBackColor = Color.Transparent;
  259. this.progressDialog.Text = dialogText == null ? PdnResources.GetString("Menu.Isoperation.Text")/*"正在运算"*/ : dialogText;// PdnResources.GetString("DocumentWorkspace.ShowFileDialog.TransferProgress.Title");
  260. this.progressDialog.Icon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.MenuFileOpenIcon.png").Reference);
  261. //this.progressDialog.Title = PdnResources.GetString("DocumentWorkspace.ShowFileDialog.ItemText.Initializing");
  262. this.progressDialog.ProcessMsg = PdnResources.GetString("Menu.Operationisinprogresspleasewaitpatiently.Text");//#21198
  263. if (autoWait/* && this.progressDialog != null*/)
  264. this.progressDialog.ProgressBar.Style = ProgressBarStyle.Blocks;
  265. else
  266. this.progressDialog.ProgressBar.Style = ProgressBarStyle.Marquee;
  267. this.progressDialog.ProgressBar.Maximum = maxPBValue;
  268. this.progressDialog.CancelClicked +=
  269. delegate (object sender, EventArgs e)
  270. {
  271. //this.cancelRequested = true;
  272. //this.cancelSink.RequestCancel();
  273. //UpdateUI();
  274. };
  275. EventHandler progressDialog_Shown =
  276. delegate (object sender, EventArgs e)
  277. {
  278. callWhenUIShown(this, EventArgs.Empty);
  279. };
  280. this.progressDialog.CancelVisible = false;
  281. //this.cancelSink = cancelSink;
  282. this.itemOrdinal = 0;
  283. //this.cancelRequested = false;
  284. this.itemName = this.progressDialog.Text != null ? this.progressDialog.Text : string.Empty;
  285. this.itemCount = 0;
  286. this.itemOrdinal = 0;
  287. this.totalProgress = 0;
  288. this.totalWork = 0;
  289. this.progressDialog.Shown += progressDialog_Shown;
  290. if (owner != null)
  291. this.progressDialog.ShowDialog(owner);
  292. else
  293. this.progressDialog.Show();
  294. this.progressDialog.Shown -= progressDialog_Shown;
  295. this.progressDialog.CancelVisible = false;
  296. //this.progressDialog.Dispose();
  297. //this.progressDialog = null;
  298. //this.cancelSink = null;
  299. }
  300. public void SetAutoWait(bool autoWait)
  301. {
  302. this.autoWait = autoWait;
  303. if (autoWait && this.progressDialog != null)
  304. {
  305. this.progressDialog.ProcessMsg = PdnResources.GetString("Menu.Operationisinprogresspleasewaitpatiently.Text");//正在处理
  306. }
  307. }
  308. public void SetItemCount(int itemCount)
  309. {
  310. if (this.progressDialog.InvokeRequired)
  311. {
  312. this.progressDialog.BeginInvoke(new Procedure<int>(SetItemCount), new object[] { itemCount });
  313. }
  314. else
  315. {
  316. this.itemCount = itemCount;
  317. this.maxPBValue = itemCount;
  318. this.progressDialog.ProgressBar.Maximum = maxPBValue;
  319. UpdateUI();
  320. }
  321. }
  322. public void SetItemOrdinal(int itemOrdinal)
  323. {
  324. if (this.progressDialog.InvokeRequired)
  325. {
  326. this.progressDialog.BeginInvoke(new Procedure<int>(SetItemOrdinal), new object[] { itemOrdinal });
  327. }
  328. else
  329. {
  330. this.itemOrdinal = itemOrdinal;
  331. this.totalWork = 0;
  332. this.totalProgress = 0;
  333. UpdateUI();
  334. }
  335. }
  336. public void SetItemInfo(string itemInfo)
  337. {
  338. if (this.progressDialog.InvokeRequired)
  339. {
  340. this.progressDialog.BeginInvoke(new Procedure<string>(SetItemInfo), new object[] { itemInfo });
  341. }
  342. else
  343. {
  344. this.itemName = itemInfo;
  345. UpdateUI();
  346. }
  347. }
  348. public void BeginItem()
  349. {
  350. if (this.progressDialog.InvokeRequired)
  351. {
  352. this.progressDialog.BeginInvoke(new Procedure(BeginItem), null);
  353. }
  354. else
  355. {
  356. this.progressDialog.ProgressBar.Style = ProgressBarStyle.Continuous;
  357. }
  358. }
  359. public void SetItemWorkTotal(long totalWork)
  360. {
  361. if (this.progressDialog.InvokeRequired)
  362. {
  363. this.progressDialog.BeginInvoke(new Procedure<long>(SetItemWorkTotal), new object[] { totalWork });
  364. }
  365. else
  366. {
  367. this.totalWork = totalWork;
  368. UpdateUI();
  369. }
  370. }
  371. public void SetItemWorkProgress(long totalProgress)
  372. {
  373. if (this.progressDialog.InvokeRequired)
  374. {
  375. this.progressDialog.BeginInvoke(new Procedure<long>(SetItemWorkProgress), new object[] { totalProgress });
  376. }
  377. else
  378. {
  379. this.totalProgress = totalProgress;
  380. UpdateUI();
  381. }
  382. }
  383. public void EndItem(WorkItemResult result)
  384. {
  385. if (this.progressDialog.InvokeRequired)
  386. {
  387. this.progressDialog.BeginInvoke(new Procedure<WorkItemResult>(EndItem), new object[] { result });
  388. }
  389. else
  390. {
  391. }
  392. }
  393. public void EndOperation(OperationResult result)
  394. {
  395. if (this.progressDialog.InvokeRequired)
  396. {
  397. this.progressDialog.BeginInvoke(new Procedure<OperationResult>(EndOperation), new object[] { result });
  398. }
  399. else
  400. {
  401. this.progressDialog.Close();
  402. }
  403. }
  404. public WorkItemFailureAction ReportItemFailure(Exception ex)
  405. {
  406. if (this.progressDialog.InvokeRequired)
  407. {
  408. object result = this.progressDialog.Invoke(
  409. new Function<WorkItemFailureAction, Exception>(ReportItemFailure),
  410. new object[] { ex });
  411. return (WorkItemFailureAction)result;
  412. }
  413. else
  414. {
  415. WorkItemFailureAction result;
  416. result = ShowFileTransferFailedDialog(ex);
  417. return result;
  418. }
  419. }
  420. private WorkItemFailureAction ShowFileTransferFailedDialog(Exception ex)
  421. {
  422. WorkItemFailureAction result;
  423. Icon formIcon = this.progressDialog.Icon;
  424. string formTitle = PdnResources.GetString("DocumentWorkspace.ShowFileDialog.ItemFailureDialog.Title");
  425. Image taskImage = PdnResources.GetImageResource("Icons.WarningIcon.png").Reference;
  426. string introTextFormat = PdnResources.GetString("DocumentWorkspace.ShowFileDialog.ItemFailureDialog.IntroText.Format");
  427. string introText = string.Format(introTextFormat, ex.Message);
  428. TaskButton retryTB = new TaskButton(
  429. PdnResources.GetImageResource("Icons.MenuImageRotate90CWIcon.png").Reference,
  430. PdnResources.GetString("DocumentWorkspace.ShowFileDialog.RetryTB.ActionText"),
  431. PdnResources.GetString("DocumentWorkspace.ShowFileDialog.RetryTB.ExplanationText"));
  432. TaskButton skipTB = new TaskButton(
  433. PdnResources.GetImageResource("Icons.HistoryFastForwardIcon.png").Reference,
  434. PdnResources.GetString("DocumentWorkspace.ShowFileDialog.SkipTB.ActionText"),
  435. PdnResources.GetString("DocumentWorkspace.ShowFileDialog.SkipTB.ExplanationText"));
  436. TaskButton cancelTB = new TaskButton(
  437. PdnResources.GetImageResource("Icons.CancelIcon.png").Reference,
  438. PdnResources.GetString("DocumentWorkspace.ShowFileDialog.CancelTB.ActionText"),
  439. PdnResources.GetString("DocumentWorkspace.ShowFileDialog.CancelTB.ExplanationText"));
  440. List<TaskButton> taskButtons = new List<TaskButton>();
  441. taskButtons.Add(retryTB);
  442. // Only have the Skip button if there is more than 1 item being transferred.
  443. // If only 1 item is begin transferred, Skip and Cancel are essentially synonymous.
  444. if (this.itemCount > 1)
  445. {
  446. taskButtons.Add(skipTB);
  447. }
  448. taskButtons.Add(cancelTB);
  449. int width96 = (TaskDialog.DefaultPixelWidth96Dpi * 4) / 3; // 33% wider
  450. TaskButton clickedTB = TaskDialog.Show(
  451. this.progressDialog,
  452. formIcon,
  453. formTitle,
  454. taskImage,
  455. true,
  456. introText,
  457. taskButtons.ToArray(),
  458. retryTB,
  459. cancelTB,
  460. width96,
  461. false,
  462. 0,
  463. out bool unuse);
  464. if (clickedTB == retryTB)
  465. {
  466. result = WorkItemFailureAction.RetryItem;
  467. }
  468. else if (clickedTB == skipTB)
  469. {
  470. result = WorkItemFailureAction.SkipItem;
  471. }
  472. else
  473. {
  474. result = WorkItemFailureAction.CancelOperation;
  475. }
  476. return result;
  477. }
  478. private void UpdateUI()
  479. {
  480. int itemCount2 = Math.Max(1, this.itemCount);
  481. double startValue = (double)this.itemOrdinal / (double)itemCount2;
  482. double endValue = (double)(this.itemOrdinal + 1) / (double)itemCount2;
  483. long totalWork2 = Math.Max(1, this.totalWork);
  484. double lerp = (double)this.totalProgress / (double)totalWork2;
  485. double newValue = Utility.Lerp(startValue, endValue, lerp);
  486. int newValueInt = (int)Math.Ceiling(maxPBValue * newValue);
  487. //if (this.cancelRequested)
  488. //{
  489. // this.progressDialog.CancelEnabled = false;
  490. // this.progressDialog.ItemText = PdnResources.GetString("DocumentWorkspace.ShowFileDialog.ItemText.Canceling");
  491. // this.progressDialog.OperationProgress = string.Empty;
  492. // this.progressDialog.ProgressBar.Style = ProgressBarStyle.Marquee;
  493. //}
  494. //else
  495. {
  496. //this.progressDialog.CancelEnabled = true;
  497. this.progressDialog.CancelVisible = false;
  498. this.progressDialog.Title = this.itemName;
  499. string progressFormat = PdnResources.GetString("DocumentWorkspace.ShowFileDialog.ProgressText.Format");
  500. if (this.autoWait)
  501. {
  502. this.progressDialog.ProcessMsg = PdnResources.GetString("Menu.Operationisinprogresspleasewaitpatiently.Text");//正在处理
  503. }
  504. else
  505. {
  506. string progressText = string.Format(progressFormat, Math.Min(this.itemOrdinal + 1, this.itemCount), this.itemCount);
  507. this.progressDialog.ProcessMsg = progressText;
  508. }
  509. this.progressDialog.ProgressBar.Style = ProgressBarStyle.Continuous;
  510. this.progressDialog.ProgressBar.Value = newValueInt;
  511. }
  512. }
  513. }
  514. internal static class NativeConstants
  515. {
  516. public const int MAX_PATH = 260;
  517. public const int CSIDL_DESKTOP_DIRECTORY = 0x0010; // C:\Users\[user]\Desktop\
  518. public const int CSIDL_MYPICTURES = 0x0027;
  519. public const int CSIDL_PERSONAL = 0x0005;
  520. public const int CSIDL_PROGRAM_FILES = 0x0026; // C:\Program Files\
  521. public const int CSIDL_APPDATA = 0x001a; // C:\Users\[user]\AppData\Roaming\
  522. public const int CSIDL_LOCAL_APPDATA = 0x001c; // C:\Users\[user]\AppData\Local\
  523. public const int CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019; // C:\Users\All Users\Desktop
  524. public const int CSIDL_FLAG_CREATE = 0x8000; // new for Win2K, or this in to force creation of folder
  525. public const uint SHGFP_TYPE_CURRENT = 0;
  526. public const uint SHGFP_TYPE_DEFAULT = 1;
  527. public const int BP_COMMANDLINK = 6;
  528. public const int CMDLS_NORMAL = 1;
  529. public const int CMDLS_HOT = 2;
  530. public const int CMDLS_PRESSED = 3;
  531. public const int CMDLS_DISABLED = 4;
  532. public const int CMDLS_DEFAULTED = 5;
  533. public const int CMDLS_DEFAULTED_ANIMATING = 6;
  534. public enum SECURITY_IMPERSONATION_LEVEL
  535. {
  536. SecurityAnonymous = 0,
  537. SecurityIdentification = 1,
  538. SecurityImpersonation = 2,
  539. SecurityDelegation = 3
  540. }
  541. public enum TOKEN_TYPE
  542. {
  543. TokenPrimary = 1,
  544. TokenImpersonation = 2
  545. }
  546. public const uint TOKEN_ASSIGN_PRIMARY = 0x0001;
  547. public const uint TOKEN_DUPLICATE = 0x0002;
  548. public const uint TOKEN_IMPERSONATE = 0x0004;
  549. public const uint TOKEN_QUERY = 0x0008;
  550. public const uint TOKEN_QUERY_SOURCE = 0x0010;
  551. public const uint TOKEN_ADJUST_PRIVILEGES = 0x0020;
  552. public const uint TOKEN_ADJUST_GROUPS = 0x0040;
  553. public const uint TOKEN_ADJUST_DEFAULT = 0x0080;
  554. public const uint TOKEN_ADJUST_SESSIONID = 0x0100;
  555. public const uint TOKEN_ALL_ACCESS_P =
  556. STANDARD_RIGHTS_REQUIRED |
  557. TOKEN_ASSIGN_PRIMARY |
  558. TOKEN_DUPLICATE |
  559. TOKEN_IMPERSONATE |
  560. TOKEN_QUERY |
  561. TOKEN_QUERY_SOURCE |
  562. TOKEN_ADJUST_PRIVILEGES |
  563. TOKEN_ADJUST_GROUPS |
  564. TOKEN_ADJUST_DEFAULT;
  565. public const uint TOKEN_ALL_ACCESS = TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID;
  566. public const uint TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY;
  567. public const uint TOKEN_WRITE = STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT;
  568. public const uint TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE;
  569. public const uint MAXIMUM_ALLOWED = 0x02000000;
  570. public const uint PROCESS_TERMINATE = 0x0001;
  571. public const uint PROCESS_CREATE_THREAD = 0x0002;
  572. public const uint PROCESS_SET_SESSIONID = 0x0004;
  573. public const uint PROCESS_VM_OPERATION = 0x0008;
  574. public const uint PROCESS_VM_READ = 0x0010;
  575. public const uint PROCESS_VM_WRITE = 0x0020;
  576. public const uint PROCESS_DUP_HANDLE = 0x0040;
  577. public const uint PROCESS_CREATE_PROCESS = 0x0080;
  578. public const uint PROCESS_SET_QUOTA = 0x0100;
  579. public const uint PROCESS_SET_INFORMATION = 0x0200;
  580. public const uint PROCESS_QUERY_INFORMATION = 0x0400;
  581. public const uint PROCESS_SUSPEND_RESUME = 0x0800;
  582. public const uint PROCESS_QUERY_LIMITED_INFORMATION = 0x1000;
  583. public const uint PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF;
  584. public const uint PF_NX_ENABLED = 12;
  585. public const uint PF_XMMI_INSTRUCTIONS_AVAILABLE = 6;
  586. public const uint PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10;
  587. public const uint PF_SSE3_INSTRUCTIONS_AVAILABLE = 13;
  588. public const uint CF_ENHMETAFILE = 14;
  589. public static Guid BHID_Stream
  590. {
  591. get
  592. {
  593. return new Guid(0x1cebb3ab, 0x7c10, 0x499a, 0xa4, 0x17, 0x92, 0xca, 0x16, 0xc4, 0xcb, 0x83);
  594. }
  595. }
  596. public const string IID_IOleWindow = "00000114-0000-0000-C000-000000000046";
  597. public const string IID_IModalWindow = "b4db1657-70d7-485e-8e3e-6fcb5a5c1802";
  598. public const string IID_IFileDialog = "42f85136-db7e-439c-85f1-e4075d135fc8";
  599. public const string IID_IFileOpenDialog = "d57c7288-d4ad-4768-be02-9d969532d960";
  600. public const string IID_IFileSaveDialog = "84bccd23-5fde-4cdb-aea4-af64b83d78ab";
  601. public const string IID_IFileDialogEvents = "973510DB-7D7F-452B-8975-74A85828D354";
  602. public const string IID_IFileDialogControlEvents = "36116642-D713-4b97-9B83-7484A9D00433";
  603. public const string IID_IFileDialogCustomize = "8016b7b3-3d49-4504-a0aa-2a37494e606f";
  604. public const string IID_IShellItem = "43826D1E-E718-42EE-BC55-A1E261C37BFE";
  605. public const string IID_IShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B";
  606. public const string IID_IKnownFolder = "38521333-6A87-46A7-AE10-0F16706816C3";
  607. public const string IID_IKnownFolderManager = "44BEAAEC-24F4-4E90-B3F0-23D258FBB146";
  608. public const string IID_IPropertyStore = "886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99";
  609. public const string IID_ISequentialStream = "0c733a30-2a1c-11ce-ade5-00aa0044773d";
  610. public const string IID_IStream = "0000000C-0000-0000-C000-000000000046";
  611. public const string IID_IFileOperation = "947aab5f-0a5c-4c13-b4d6-4bf7836fc9f8";
  612. public const string IID_IFileOperationProgressSink = "04b0f1a7-9490-44bc-96e1-4296a31252e2";
  613. public const string CLSID_FileOpenDialog = "DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7";
  614. public const string CLSID_FileSaveDialog = "C0B4E2F3-BA21-4773-8DBA-335EC946EB8B";
  615. public const string CLSID_KnownFolderManager = "4df0c730-df9d-4ae3-9153-aa6b82e9795a";
  616. public const string CLSID_FileOperation = "3ad05575-8857-4850-9277-11b85bdb8e09";
  617. public enum FOF
  618. : uint
  619. {
  620. FOF_MULTIDESTFILES = 0x0001,
  621. FOF_CONFIRMMOUSE = 0x0002,
  622. FOF_SILENT = 0x0004, // don't display progress UI (confirm prompts may be displayed still)
  623. FOF_RENAMEONCOLLISION = 0x0008, // automatically rename the source files to avoid the collisions
  624. FOF_NOCONFIRMATION = 0x0010, // don't display confirmation UI, assume "yes" for cases that can be bypassed, "no" for those that can not
  625. FOF_WANTMAPPINGHANDLE = 0x0020, // Fill in SHFILEOPSTRUCT.hNameMappings
  626. // Must be freed using SHFreeNameMappings
  627. FOF_ALLOWUNDO = 0x0040, // enable undo including Recycle behavior for IFileOperation::Delete()
  628. FOF_FILESONLY = 0x0080, // only operate on the files (non folders), both files and folders are assumed without this
  629. FOF_SIMPLEPROGRESS = 0x0100, // means don't show names of files
  630. FOF_NOCONFIRMMKDIR = 0x0200, // don't dispplay confirmatino UI before making any needed directories, assume "Yes" in these cases
  631. FOF_NOERRORUI = 0x0400, // don't put up error UI, other UI may be displayed, progress, confirmations
  632. FOF_NOCOPYSECURITYATTRIBS = 0x0800, // dont copy file security attributes (ACLs)
  633. FOF_NORECURSION = 0x1000, // don't recurse into directories for operations that would recurse
  634. FOF_NO_CONNECTED_ELEMENTS = 0x2000, // don't operate on connected elements ("xxx_files" folders that go with .htm files)
  635. FOF_WANTNUKEWARNING = 0x4000, // during delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)
  636. FOF_NORECURSEREPARSE = 0x8000, // deprecated; the operations engine always does the right thing on FolderLink objects (symlinks, reparse points, folder shortcuts)
  637. FOF_NO_UI = (FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR), // don't display any UI at all
  638. FOFX_NOSKIPJUNCTIONS = 0x00010000, // Don't avoid binding to junctions (like Task folder, Recycle-Bin)
  639. FOFX_PREFERHARDLINK = 0x00020000, // Create hard link if possible
  640. FOFX_SHOWELEVATIONPROMPT = 0x00040000, // Show elevation prompts when error UI is disabled (use with FOF_NOERRORUI)
  641. FOFX_EARLYFAILURE = 0x00100000, // Fail operation as soon as a single error occurs rather than trying to process other items (applies only when using FOF_NOERRORUI)
  642. FOFX_PRESERVEFILEEXTENSIONS = 0x00200000, // Rename collisions preserve file extns (use with FOF_RENAMEONCOLLISION)
  643. FOFX_KEEPNEWERFILE = 0x00400000, // Keep newer file on naming conflicts
  644. FOFX_NOCOPYHOOKS = 0x00800000, // Don't use copy hooks
  645. FOFX_NOMINIMIZEBOX = 0x01000000, // Don't allow minimizing the progress dialog
  646. FOFX_MOVEACLSACROSSVOLUMES = 0x02000000, // Copy security information when performing a cross-volume move operation
  647. FOFX_DONTDISPLAYSOURCEPATH = 0x04000000, // Don't display the path of source file in progress dialog
  648. FOFX_DONTDISPLAYDESTPATH = 0x08000000, // Don't display the path of destination file in progress dialog
  649. }
  650. public enum STATFLAG
  651. : uint
  652. {
  653. STATFLAG_DEFAULT = 0,
  654. STATFLAG_NONAME = 1,
  655. STATFLAG_NOOPEN = 2
  656. }
  657. public enum STGTY
  658. : uint
  659. {
  660. STGTY_STORAGE = 1,
  661. STGTY_STREAM = 2,
  662. STGTY_LOCKBYTES = 3,
  663. STGTY_PROPERTY = 4
  664. }
  665. [Flags]
  666. public enum STGC
  667. : uint
  668. {
  669. STGC_DEFAULT = 0,
  670. STGC_OVERWRITE = 1,
  671. STGC_ONLYIFCURRENT = 2,
  672. STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4,
  673. STGC_CONSOLIDATE = 8
  674. }
  675. public enum CDCONTROLSTATE
  676. {
  677. CDCS_INACTIVE = 0x00000000,
  678. CDCS_ENABLED = 0x00000001,
  679. CDCS_VISIBLE = 0x00000002
  680. }
  681. public enum FFFP_MODE
  682. {
  683. FFFP_EXACTMATCH,
  684. FFFP_NEARESTPARENTMATCH
  685. }
  686. public enum SIATTRIBFLAGS
  687. {
  688. SIATTRIBFLAGS_AND = 0x00000001, // if multiple items and the attirbutes together.
  689. SIATTRIBFLAGS_OR = 0x00000002, // if multiple items or the attributes together.
  690. SIATTRIBFLAGS_APPCOMPAT = 0x00000003, // Call GetAttributes directly on the ShellFolder for multiple attributes
  691. }
  692. public enum SIGDN : uint
  693. {
  694. SIGDN_NORMALDISPLAY = 0x00000000, // SHGDN_NORMAL
  695. SIGDN_PARENTRELATIVEPARSING = 0x80018001, // SHGDN_INFOLDER | SHGDN_FORPARSING
  696. SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000, // SHGDN_FORPARSING
  697. SIGDN_PARENTRELATIVEEDITING = 0x80031001, // SHGDN_INFOLDER | SHGDN_FOREDITING
  698. SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000, // SHGDN_FORPARSING | SHGDN_FORADDRESSBAR
  699. SIGDN_FILESYSPATH = 0x80058000, // SHGDN_FORPARSING
  700. SIGDN_URL = 0x80068000, // SHGDN_FORPARSING
  701. SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001, // SHGDN_INFOLDER | SHGDN_FORPARSING | SHGDN_FORADDRESSBAR
  702. SIGDN_PARENTRELATIVE = 0x80080001 // SHGDN_INFOLDER
  703. }
  704. public const uint DROPEFFECT_COPY = 1;
  705. public const uint DROPEFFECT_MOVE = 2;
  706. public const uint DROPEFFECT_LINK = 4;
  707. [Flags]
  708. public enum SFGAO : uint
  709. {
  710. SFGAO_CANCOPY = DROPEFFECT_COPY, // Objects can be copied (0x1)
  711. SFGAO_CANMOVE = DROPEFFECT_MOVE, // Objects can be moved (0x2)
  712. SFGAO_CANLINK = DROPEFFECT_LINK, // Objects can be linked (0x4)
  713. SFGAO_STORAGE = 0x00000008, // supports BindToObject(IID_IStorage)
  714. SFGAO_CANRENAME = 0x00000010, // Objects can be renamed
  715. SFGAO_CANDELETE = 0x00000020, // Objects can be deleted
  716. SFGAO_HASPROPSHEET = 0x00000040, // Objects have property sheets
  717. SFGAO_DROPTARGET = 0x00000100, // Objects are drop target
  718. SFGAO_CAPABILITYMASK = 0x00000177,
  719. SFGAO_ENCRYPTED = 0x00002000, // Object is encrypted (use alt color)
  720. SFGAO_ISSLOW = 0x00004000, // 'Slow' object
  721. SFGAO_GHOSTED = 0x00008000, // Ghosted icon
  722. SFGAO_LINK = 0x00010000, // Shortcut (link)
  723. SFGAO_SHARE = 0x00020000, // Shared
  724. SFGAO_READONLY = 0x00040000, // Read-only
  725. SFGAO_HIDDEN = 0x00080000, // Hidden object
  726. SFGAO_DISPLAYATTRMASK = 0x000FC000,
  727. SFGAO_FILESYSANCESTOR = 0x10000000, // May contain children with SFGAO_FILESYSTEM
  728. SFGAO_FOLDER = 0x20000000, // Support BindToObject(IID_IShellFolder)
  729. SFGAO_FILESYSTEM = 0x40000000, // Is a win32 file system object (file/folder/root)
  730. SFGAO_HASSUBFOLDER = 0x80000000, // May contain children with SFGAO_FOLDER (may be slow)
  731. SFGAO_CONTENTSMASK = 0x80000000,
  732. SFGAO_VALIDATE = 0x01000000, // Invalidate cached information (may be slow)
  733. SFGAO_REMOVABLE = 0x02000000, // Is this removeable media?
  734. SFGAO_COMPRESSED = 0x04000000, // Object is compressed (use alt color)
  735. SFGAO_BROWSABLE = 0x08000000, // Supports IShellFolder, but only implements CreateViewObject() (non-folder view)
  736. SFGAO_NONENUMERATED = 0x00100000, // Is a non-enumerated object (should be hidden)
  737. SFGAO_NEWCONTENT = 0x00200000, // Should show bold in explorer tree
  738. SFGAO_STREAM = 0x00400000, // Supports BindToObject(IID_IStream)
  739. SFGAO_CANMONIKER = 0x00400000, // Obsolete
  740. SFGAO_HASSTORAGE = 0x00400000, // Obsolete
  741. SFGAO_STORAGEANCESTOR = 0x00800000, // May contain children with SFGAO_STORAGE or SFGAO_STREAM
  742. SFGAO_STORAGECAPMASK = 0x70C50008, // For determining storage capabilities, ie for open/save semantics
  743. SFGAO_PKEYSFGAOMASK = 0x81044010 // Attributes that are masked out for PKEY_SFGAOFlags because they are considered to cause slow calculations or lack context (SFGAO_VALIDATE | SFGAO_ISSLOW | SFGAO_HASSUBFOLDER and others)
  744. }
  745. public enum FDE_OVERWRITE_RESPONSE
  746. {
  747. FDEOR_DEFAULT = 0x00000000,
  748. FDEOR_ACCEPT = 0x00000001,
  749. FDEOR_REFUSE = 0x00000002
  750. }
  751. public enum FDE_SHAREVIOLATION_RESPONSE
  752. {
  753. FDESVR_DEFAULT = 0x00000000,
  754. FDESVR_ACCEPT = 0x00000001,
  755. FDESVR_REFUSE = 0x00000002
  756. }
  757. public enum FDAP
  758. {
  759. FDAP_BOTTOM = 0x00000000,
  760. FDAP_TOP = 0x00000001,
  761. }
  762. [Flags]
  763. public enum FOS : uint
  764. {
  765. FOS_OVERWRITEPROMPT = 0x00000002,
  766. FOS_STRICTFILETYPES = 0x00000004,
  767. FOS_NOCHANGEDIR = 0x00000008,
  768. FOS_PICKFOLDERS = 0x00000020,
  769. FOS_FORCEFILESYSTEM = 0x00000040, // Ensure that items returned are filesystem items.
  770. FOS_ALLNONSTORAGEITEMS = 0x00000080, // Allow choosing items that have no storage.
  771. FOS_NOVALIDATE = 0x00000100,
  772. FOS_ALLOWMULTISELECT = 0x00000200,
  773. FOS_PATHMUSTEXIST = 0x00000800,
  774. FOS_FILEMUSTEXIST = 0x00001000,
  775. FOS_CREATEPROMPT = 0x00002000,
  776. FOS_SHAREAWARE = 0x00004000,
  777. FOS_NOREADONLYRETURN = 0x00008000,
  778. FOS_NOTESTFILECREATE = 0x00010000,
  779. FOS_HIDEMRUPLACES = 0x00020000,
  780. FOS_HIDEPINNEDPLACES = 0x00040000,
  781. FOS_NODEREFERENCELINKS = 0x00100000,
  782. FOS_DONTADDTORECENT = 0x02000000,
  783. FOS_FORCESHOWHIDDEN = 0x10000000,
  784. FOS_DEFAULTNOMINIMODE = 0x20000000
  785. }
  786. public enum KF_CATEGORY
  787. {
  788. KF_CATEGORY_VIRTUAL = 0x00000001,
  789. KF_CATEGORY_FIXED = 0x00000002,
  790. KF_CATEGORY_COMMON = 0x00000003,
  791. KF_CATEGORY_PERUSER = 0x00000004
  792. }
  793. [Flags]
  794. public enum KF_DEFINITION_FLAGS
  795. {
  796. KFDF_PERSONALIZE = 0x00000001,
  797. KFDF_LOCAL_REDIRECT_ONLY = 0x00000002,
  798. KFDF_ROAMABLE = 0x00000004,
  799. }
  800. public const uint DWMWA_NCRENDERING_ENABLED = 1; // [get] Is non-client rendering enabled/disabled
  801. public const uint DWMWA_NCRENDERING_POLICY = 2; // [set] Non-client rendering policy
  802. public const uint DWMWA_TRANSITIONS_FORCEDISABLED = 3; // [set] Potentially enable/forcibly disable transitions
  803. public const uint DWMWA_ALLOW_NCPAINT = 4; // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame.
  804. public const uint DWMWA_CAPTION_BUTTON_BOUNDS = 5; // [get] Bounds of the caption button area in window-relative space.
  805. public const uint DWMWA_NONCLIENT_RTL_LAYOUT = 6; // [set] Is non-client content RTL mirrored
  806. public const uint DWMWA_FORCE_ICONIC_REPRESENTATION = 7; // [set] Force this window to display iconic thumbnails.
  807. public const uint DWMWA_FLIP3D_POLICY = 8; // [set] Designates how Flip3D will treat the window.
  808. public const uint DWMWA_EXTENDED_FRAME_BOUNDS = 9; // [get] Gets the extended frame bounds rectangle in screen space
  809. public const uint DWMWA_LAST = 10;
  810. public const uint DWMNCRP_USEWINDOWSTYLE = 0;
  811. public const uint DWMNCRP_DISABLED = 1;
  812. public const uint DWMNCRP_ENABLED = 2;
  813. public const uint DWMNCRP_LAST = 3;
  814. public const byte VER_EQUAL = 1;
  815. public const byte VER_GREATER = 2;
  816. public const byte VER_GREATER_EQUAL = 3;
  817. public const byte VER_LESS = 4;
  818. public const byte VER_LESS_EQUAL = 5;
  819. public const byte VER_AND = 6;
  820. public const byte VER_OR = 7;
  821. public const uint VER_CONDITION_MASK = 7;
  822. public const uint VER_NUM_BITS_PER_CONDITION_MASK = 3;
  823. public const uint VER_MINORVERSION = 0x0000001;
  824. public const uint VER_MAJORVERSION = 0x0000002;
  825. public const uint VER_BUILDNUMBER = 0x0000004;
  826. public const uint VER_PLATFORMID = 0x0000008;
  827. public const uint VER_SERVICEPACKMINOR = 0x0000010;
  828. public const uint VER_SERVICEPACKMAJOR = 0x0000020;
  829. public const uint VER_SUITENAME = 0x0000040;
  830. public const uint VER_PRODUCT_TYPE = 0x0000080;
  831. public const uint VER_PLATFORM_WIN32s = 0;
  832. public const uint VER_PLATFORM_WIN32_WINDOWS = 1;
  833. public const uint VER_PLATFORM_WIN32_NT = 2;
  834. public const int THREAD_MODE_BACKGROUND_BEGIN = 0x10000;
  835. public const int THREAD_MODE_BACKGROUND_END = 0x20000;
  836. private static uint CTL_CODE(uint deviceType, uint function, uint method, uint access)
  837. {
  838. return (deviceType << 16) | (access << 14) | (function << 2) | method;
  839. }
  840. public const uint FILE_DEVICE_FILE_SYSTEM = 0x00000009;
  841. public const uint METHOD_BUFFERED = 0;
  842. public static readonly uint FSCTL_SET_COMPRESSION =
  843. CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA);
  844. public static ushort COMPRESSION_FORMAT_DEFAULT = 1;
  845. public const int SW_HIDE = 0;
  846. public const int SW_SHOWNORMAL = 1;
  847. public const int SW_NORMAL = 1;
  848. public const int SW_SHOWMINIMIZED = 2;
  849. public const int SW_SHOWMAXIMIZED = 3;
  850. public const int SW_MAXIMIZE = 3;
  851. public const int SW_SHOWNOACTIVATE = 4;
  852. public const int SW_SHOW = 5;
  853. public const int SW_MINIMIZE = 6;
  854. public const int SW_SHOWMINNOACTIVE = 7;
  855. public const int SW_SHOWNA = 8;
  856. public const int SW_RESTORE = 9;
  857. public const int SW_SHOWDEFAULT = 10;
  858. public const int SW_FORCEMINIMIZE = 11;
  859. public const int SW_MAX = 11;
  860. public const uint MF_BYCOMMAND = 0;
  861. public const uint MF_GRAYED = 1;
  862. public const uint MF_DISABLED = 2;
  863. public const uint SC_CLOSE = 0xf060;
  864. public const uint SEE_MASK_CLASSNAME = 0x00000001;
  865. public const uint SEE_MASK_CLASSKEY = 0x00000003;
  866. public const uint SEE_MASK_IDLIST = 0x00000004;
  867. public const uint SEE_MASK_INVOKEIDLIST = 0x0000000c;
  868. public const uint SEE_MASK_ICON = 0x00000010;
  869. public const uint SEE_MASK_HOTKEY = 0x00000020;
  870. public const uint SEE_MASK_NOCLOSEPROCESS = 0x00000040;
  871. public const uint SEE_MASK_CONNECTNETDRV = 0x00000080;
  872. public const uint SEE_MASK_FLAG_DDEWAIT = 0x00000100;
  873. public const uint SEE_MASK_DOENVSUBST = 0x00000200;
  874. public const uint SEE_MASK_FLAG_NO_UI = 0x00000400;
  875. public const uint SEE_MASK_UNICODE = 0x00004000;
  876. public const uint SEE_MASK_NO_CONSOLE = 0x00008000;
  877. public const uint SEE_MASK_ASYNCOK = 0x00100000;
  878. public const uint SEE_MASK_HMONITOR = 0x00200000;
  879. public const uint SEE_MASK_NOZONECHECKS = 0x00800000;
  880. public const uint SEE_MASK_NOQUERYCLASSSTORE = 0x01000000;
  881. public const uint SEE_MASK_WAITFORINPUTIDLE = 0x02000000;
  882. public const uint SEE_MASK_FLAG_LOG_USAGE = 0x04000000;
  883. public const uint SHARD_PIDL = 0x00000001;
  884. public const uint SHARD_PATHA = 0x00000002;
  885. public const uint SHARD_PATHW = 0x00000003;
  886. public const uint VER_NT_WORKSTATION = 0x0000001;
  887. public const uint VER_NT_DOMAIN_CONTROLLER = 0x0000002;
  888. public const uint VER_NT_SERVER = 0x0000003;
  889. public const uint LWA_COLORKEY = 0x00000001;
  890. public const uint LWA_ALPHA = 0x00000002;
  891. public const uint WS_EX_LAYERED = 0x00080000;
  892. public const ushort PROCESSOR_ARCHITECTURE_INTEL = 0;
  893. public const ushort PROCESSOR_ARCHITECTURE_IA64 = 6;
  894. public const ushort PROCESSOR_ARCHITECTURE_AMD64 = 9;
  895. public const ushort PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF;
  896. public const uint SHVIEW_THUMBNAIL = 0x702d;
  897. public const uint MA_ACTIVATE = 1;
  898. public const uint MA_ACTIVATEANDEAT = 2;
  899. public const uint MA_NOACTIVATE = 3;
  900. public const uint MA_NOACTIVATEANDEAT = 4;
  901. public const uint IDI_APPLICATION = 32512;
  902. public const int ERROR_SUCCESS = 0;
  903. public const int ERROR_ALREADY_EXISTS = 183;
  904. public const int ERROR_CANCELLED = 1223;
  905. public const int ERROR_IO_PENDING = 0x3e5;
  906. public const int ERROR_NO_MORE_ITEMS = 259;
  907. public const int ERROR_TIMEOUT = 1460;
  908. public const uint DIGCF_PRESENT = 2;
  909. public const int GWL_STYLE = -16;
  910. public const int GWL_EXSTYLE = -20;
  911. public const int GWLP_WNDPROC = -4;
  912. public const int GWLP_HINSTANCE = -6;
  913. public const int GWLP_HWNDPARENT = -8;
  914. public const int GWLP_USERDATA = -21;
  915. public const int GWLP_ID = -12;
  916. public const uint PBS_SMOOTH = 0x01;
  917. public const uint PBS_MARQUEE = 0x08;
  918. public const int PBM_SETMARQUEE = WM_USER + 10;
  919. public const int SBM_SETPOS = 0x00E0;
  920. public const int SBM_SETRANGE = 0x00E2;
  921. public const int SBM_SETRANGEREDRAW = 0x00E6;
  922. public const int SBM_SETSCROLLINFO = 0x00E9;
  923. public const int BCM_FIRST = 0x1600;
  924. public const int BCM_SETSHIELD = BCM_FIRST + 0x000C;
  925. public const int CB_SHOWDROPDOWN = 0x014f;
  926. public const uint WM_COMMAND = 0x111;
  927. public const uint WM_MOUSEACTIVATE = 0x21;
  928. public const uint WM_COPYDATA = 0x004a;
  929. public const uint SMTO_NORMAL = 0x0000;
  930. public const uint SMTO_BLOCK = 0x0001;
  931. public const uint SMTO_ABORTIFHUNG = 0x0002;
  932. public const uint SMTO_NOTIMEOUTIFNOTHUNG = 0x0008;
  933. public const int WM_USER = 0x400;
  934. public const int WM_HSCROLL = 0x114;
  935. public const int WM_VSCROLL = 0x115;
  936. public const int WM_SETFOCUS = 7;
  937. public const int WM_QUERYENDSESSION = 0x0011;
  938. public const int WM_ACTIVATE = 0x006;
  939. public const int WM_ACTIVATEAPP = 0x01C;
  940. public const int WM_PAINT = 0x000f;
  941. public const int WM_NCPAINT = 0x0085;
  942. public const int WM_NCACTIVATE = 0x086;
  943. public const int WM_SETREDRAW = 0x000B;
  944. public const uint WS_VSCROLL = 0x00200000;
  945. public const uint WS_HSCROLL = 0x00100000;
  946. public const uint BS_MULTILINE = 0x00002000;
  947. public const uint ANSI_CHARSET = 0;
  948. public const uint DEFAULT_CHARSET = 1;
  949. public const uint SYMBOL_CHARSET = 2;
  950. public const uint SHIFTJIS_CHARSET = 128;
  951. public const uint HANGEUL_CHARSET = 129;
  952. public const uint HANGUL_CHARSET = 129;
  953. public const uint GB2312_CHARSET = 134;
  954. public const uint CHINESEBIG5_CHARSET = 136;
  955. public const uint OEM_CHARSET = 255;
  956. public const uint JOHAB_CHARSET = 130;
  957. public const uint HEBREW_CHARSET = 177;
  958. public const uint ARABIC_CHARSET = 178;
  959. public const uint GREEK_CHARSET = 161;
  960. public const uint TURKISH_CHARSET = 162;
  961. public const uint VIETNAMESE_CHARSET = 163;
  962. public const uint THAI_CHARSET = 222;
  963. public const uint EASTEUROPE_CHARSET = 238;
  964. public const uint RUSSIAN_CHARSET = 204;
  965. public const uint MAC_CHARSET = 77;
  966. public const uint BALTIC_CHARSET = 186;
  967. public const uint SPI_GETBEEP = 0x0001;
  968. public const uint SPI_SETBEEP = 0x0002;
  969. public const uint SPI_GETMOUSE = 0x0003;
  970. public const uint SPI_SETMOUSE = 0x0004;
  971. public const uint SPI_GETBORDER = 0x0005;
  972. public const uint SPI_SETBORDER = 0x0006;
  973. public const uint SPI_GETKEYBOARDSPEED = 0x000A;
  974. public const uint SPI_SETKEYBOARDSPEED = 0x000B;
  975. public const uint SPI_LANGDRIVER = 0x000C;
  976. public const uint SPI_ICONHORIZONTALSPACING = 0x000D;
  977. public const uint SPI_GETSCREENSAVETIMEOUT = 0x000E;
  978. public const uint SPI_SETSCREENSAVETIMEOUT = 0x000F;
  979. public const uint SPI_GETSCREENSAVEACTIVE = 0x0010;
  980. public const uint SPI_SETSCREENSAVEACTIVE = 0x0011;
  981. public const uint SPI_GETGRIDGRANULARITY = 0x0012;
  982. public const uint SPI_SETGRIDGRANULARITY = 0x0013;
  983. public const uint SPI_SETDESKWALLPAPER = 0x0014;
  984. public const uint SPI_SETDESKPATTERN = 0x0015;
  985. public const uint SPI_GETKEYBOARDDELAY = 0x0016;
  986. public const uint SPI_SETKEYBOARDDELAY = 0x0017;
  987. public const uint SPI_ICONVERTICALSPACING = 0x0018;
  988. public const uint SPI_GETICONTITLEWRAP = 0x0019;
  989. public const uint SPI_SETICONTITLEWRAP = 0x001A;
  990. public const uint SPI_GETMENUDROPALIGNMENT = 0x001B;
  991. public const uint SPI_SETMENUDROPALIGNMENT = 0x001C;
  992. public const uint SPI_SETDOUBLECLKWIDTH = 0x001D;
  993. public const uint SPI_SETDOUBLECLKHEIGHT = 0x001E;
  994. public const uint SPI_GETICONTITLELOGFONT = 0x001F;
  995. public const uint SPI_SETDOUBLECLICKTIME = 0x0020;
  996. public const uint SPI_SETMOUSEBUTTONSWAP = 0x0021;
  997. public const uint SPI_SETICONTITLELOGFONT = 0x0022;
  998. public const uint SPI_GETFASTTASKSWITCH = 0x0023;
  999. public const uint SPI_SETFASTTASKSWITCH = 0x0024;
  1000. public const uint SPI_SETDRAGFULLWINDOWS = 0x0025;
  1001. public const uint SPI_GETDRAGFULLWINDOWS = 0x0026;
  1002. public const uint SPI_GETNONCLIENTMETRICS = 0x0029;
  1003. public const uint SPI_SETNONCLIENTMETRICS = 0x002A;
  1004. public const uint SPI_GETMINIMIZEDMETRICS = 0x002B;
  1005. public const uint SPI_SETMINIMIZEDMETRICS = 0x002C;
  1006. public const uint SPI_GETICONMETRICS = 0x002D;
  1007. public const uint SPI_SETICONMETRICS = 0x002E;
  1008. public const uint SPI_SETWORKAREA = 0x002F;
  1009. public const uint SPI_GETWORKAREA = 0x0030;
  1010. public const uint SPI_SETPENWINDOWS = 0x0031;
  1011. public const uint SPI_GETHIGHCONTRAST = 0x0042;
  1012. public const uint SPI_SETHIGHCONTRAST = 0x0043;
  1013. public const uint SPI_GETKEYBOARDPREF = 0x0044;
  1014. public const uint SPI_SETKEYBOARDPREF = 0x0045;
  1015. public const uint SPI_GETSCREENREADER = 0x0046;
  1016. public const uint SPI_SETSCREENREADER = 0x0047;
  1017. public const uint SPI_GETANIMATION = 0x0048;
  1018. public const uint SPI_SETANIMATION = 0x0049;
  1019. public const uint SPI_GETFONTSMOOTHING = 0x004A;
  1020. public const uint SPI_SETFONTSMOOTHING = 0x004B;
  1021. public const uint SPI_SETDRAGWIDTH = 0x004C;
  1022. public const uint SPI_SETDRAGHEIGHT = 0x004D;
  1023. public const uint SPI_SETHANDHELD = 0x004E;
  1024. public const uint SPI_GETLOWPOWERTIMEOUT = 0x004F;
  1025. public const uint SPI_GETPOWEROFFTIMEOUT = 0x0050;
  1026. public const uint SPI_SETLOWPOWERTIMEOUT = 0x0051;
  1027. public const uint SPI_SETPOWEROFFTIMEOUT = 0x0052;
  1028. public const uint SPI_GETLOWPOWERACTIVE = 0x0053;
  1029. public const uint SPI_GETPOWEROFFACTIVE = 0x0054;
  1030. public const uint SPI_SETLOWPOWERACTIVE = 0x0055;
  1031. public const uint SPI_SETPOWEROFFACTIVE = 0x0056;
  1032. public const uint SPI_SETCURSORS = 0x0057;
  1033. public const uint SPI_SETICONS = 0x0058;
  1034. public const uint SPI_GETDEFAULTINPUTLANG = 0x0059;
  1035. public const uint SPI_SETDEFAULTINPUTLANG = 0x005A;
  1036. public const uint SPI_SETLANGTOGGLE = 0x005B;
  1037. public const uint SPI_GETWINDOWSEXTENSION = 0x005C;
  1038. public const uint SPI_SETMOUSETRAILS = 0x005D;
  1039. public const uint SPI_GETMOUSETRAILS = 0x005E;
  1040. public const uint SPI_SETSCREENSAVERRUNNING = 0x0061;
  1041. public const uint SPI_SCREENSAVERRUNNING = SPI_SETSCREENSAVERRUNNING;
  1042. public const uint SPI_GETFILTERKEYS = 0x0032;
  1043. public const uint SPI_SETFILTERKEYS = 0x0033;
  1044. public const uint SPI_GETTOGGLEKEYS = 0x0034;
  1045. public const uint SPI_SETTOGGLEKEYS = 0x0035;
  1046. public const uint SPI_GETMOUSEKEYS = 0x0036;
  1047. public const uint SPI_SETMOUSEKEYS = 0x0037;
  1048. public const uint SPI_GETSHOWSOUNDS = 0x0038;
  1049. public const uint SPI_SETSHOWSOUNDS = 0x0039;
  1050. public const uint SPI_GETSTICKYKEYS = 0x003A;
  1051. public const uint SPI_SETSTICKYKEYS = 0x003B;
  1052. public const uint SPI_GETACCESSTIMEOUT = 0x003C;
  1053. public const uint SPI_SETACCESSTIMEOUT = 0x003D;
  1054. public const uint SPI_GETSERIALKEYS = 0x003E;
  1055. public const uint SPI_SETSERIALKEYS = 0x003F;
  1056. public const uint SPI_GETSOUNDSENTRY = 0x0040;
  1057. public const uint SPI_SETSOUNDSENTRY = 0x0041;
  1058. public const uint SPI_GETSNAPTODEFBUTTON = 0x005F;
  1059. public const uint SPI_SETSNAPTODEFBUTTON = 0x0060;
  1060. public const uint SPI_GETMOUSEHOVERWIDTH = 0x0062;
  1061. public const uint SPI_SETMOUSEHOVERWIDTH = 0x0063;
  1062. public const uint SPI_GETMOUSEHOVERHEIGHT = 0x0064;
  1063. public const uint SPI_SETMOUSEHOVERHEIGHT = 0x0065;
  1064. public const uint SPI_GETMOUSEHOVERTIME = 0x0066;
  1065. public const uint SPI_SETMOUSEHOVERTIME = 0x0067;
  1066. public const uint SPI_GETWHEELSCROLLLINES = 0x0068;
  1067. public const uint SPI_SETWHEELSCROLLLINES = 0x0069;
  1068. public const uint SPI_GETMENUSHOWDELAY = 0x006A;
  1069. public const uint SPI_SETMENUSHOWDELAY = 0x006B;
  1070. public const uint SPI_GETSHOWIMEUI = 0x006E;
  1071. public const uint SPI_SETSHOWIMEUI = 0x006F;
  1072. public const uint SPI_GETMOUSESPEED = 0x0070;
  1073. public const uint SPI_SETMOUSESPEED = 0x0071;
  1074. public const uint SPI_GETSCREENSAVERRUNNING = 0x0072;
  1075. public const uint SPI_GETDESKWALLPAPER = 0x0073;
  1076. public const uint SPI_GETACTIVEWINDOWTRACKING = 0x1000;
  1077. public const uint SPI_SETACTIVEWINDOWTRACKING = 0x1001;
  1078. public const uint SPI_GETMENUANIMATION = 0x1002;
  1079. public const uint SPI_SETMENUANIMATION = 0x1003;
  1080. public const uint SPI_GETCOMBOBOXANIMATION = 0x1004;
  1081. public const uint SPI_SETCOMBOBOXANIMATION = 0x1005;
  1082. public const uint SPI_GETLISTBOXSMOOTHSCROLLING = 0x1006;
  1083. public const uint SPI_SETLISTBOXSMOOTHSCROLLING = 0x1007;
  1084. public const uint SPI_GETGRADIENTCAPTIONS = 0x1008;
  1085. public const uint SPI_SETGRADIENTCAPTIONS = 0x1009;
  1086. public const uint SPI_GETKEYBOARDCUES = 0x100A;
  1087. public const uint SPI_SETKEYBOARDCUES = 0x100B;
  1088. public const uint SPI_GETMENUUNDERLINES = SPI_GETKEYBOARDCUES;
  1089. public const uint SPI_SETMENUUNDERLINES = SPI_SETKEYBOARDCUES;
  1090. public const uint SPI_GETACTIVEWNDTRKZORDER = 0x100C;
  1091. public const uint SPI_SETACTIVEWNDTRKZORDER = 0x100D;
  1092. public const uint SPI_GETHOTTRACKING = 0x100E;
  1093. public const uint SPI_SETHOTTRACKING = 0x100F;
  1094. public const uint SPI_GETMENUFADE = 0x1012;
  1095. public const uint SPI_SETMENUFADE = 0x1013;
  1096. public const uint SPI_GETSELECTIONFADE = 0x1014;
  1097. public const uint SPI_SETSELECTIONFADE = 0x1015;
  1098. public const uint SPI_GETTOOLTIPANIMATION = 0x1016;
  1099. public const uint SPI_SETTOOLTIPANIMATION = 0x1017;
  1100. public const uint SPI_GETTOOLTIPFADE = 0x1018;
  1101. public const uint SPI_SETTOOLTIPFADE = 0x1019;
  1102. public const uint SPI_GETCURSORSHADOW = 0x101A;
  1103. public const uint SPI_SETCURSORSHADOW = 0x101B;
  1104. public const uint SPI_GETMOUSESONAR = 0x101C;
  1105. public const uint SPI_SETMOUSESONAR = 0x101D;
  1106. public const uint SPI_GETMOUSECLICKLOCK = 0x101E;
  1107. public const uint SPI_SETMOUSECLICKLOCK = 0x101F;
  1108. public const uint SPI_GETMOUSEVANISH = 0x1020;
  1109. public const uint SPI_SETMOUSEVANISH = 0x1021;
  1110. public const uint SPI_GETFLATMENU = 0x1022;
  1111. public const uint SPI_SETFLATMENU = 0x1023;
  1112. public const uint SPI_GETDROPSHADOW = 0x1024;
  1113. public const uint SPI_SETDROPSHADOW = 0x1025;
  1114. public const uint SPI_GETBLOCKSENDINPUTRESETS = 0x1026;
  1115. public const uint SPI_SETBLOCKSENDINPUTRESETS = 0x1027;
  1116. public const uint SPI_GETUIEFFECTS = 0x103E;
  1117. public const uint SPI_SETUIEFFECTS = 0x103F;
  1118. public const uint SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000;
  1119. public const uint SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001;
  1120. public const uint SPI_GETACTIVEWNDTRKTIMEOUT = 0x2002;
  1121. public const uint SPI_SETACTIVEWNDTRKTIMEOUT = 0x2003;
  1122. public const uint SPI_GETFOREGROUNDFLASHCOUNT = 0x2004;
  1123. public const uint SPI_SETFOREGROUNDFLASHCOUNT = 0x2005;
  1124. public const uint SPI_GETCARETWIDTH = 0x2006;
  1125. public const uint SPI_SETCARETWIDTH = 0x2007;
  1126. public const uint SPI_GETMOUSECLICKLOCKTIME = 0x2008;
  1127. public const uint SPI_SETMOUSECLICKLOCKTIME = 0x2009;
  1128. public const uint SPI_GETFONTSMOOTHINGTYPE = 0x200A;
  1129. public const uint SPI_SETFONTSMOOTHINGTYPE = 0x200B;
  1130. public const uint SPI_GETFONTSMOOTHINGCONTRAST = 0x200C;
  1131. public const uint SPI_SETFONTSMOOTHINGCONTRAST = 0x200D;
  1132. public const uint SPI_GETFOCUSBORDERWIDTH = 0x200E;
  1133. public const uint SPI_SETFOCUSBORDERWIDTH = 0x200F;
  1134. public const uint SPI_GETFOCUSBORDERHEIGHT = 0x2010;
  1135. public const uint SPI_SETFOCUSBORDERHEIGHT = 0x2011;
  1136. public const uint SPI_GETFONTSMOOTHINGORIENTATION = 0x2012;
  1137. public const uint SPI_SETFONTSMOOTHINGORIENTATION = 0x2013;
  1138. public const uint INFINITE = 0xffffffff;
  1139. public const uint STATUS_WAIT_0 = 0;
  1140. public const uint STATUS_ABANDONED_WAIT_0 = 0x80;
  1141. public const uint WAIT_FAILED = 0xffffffff;
  1142. public const uint WAIT_TIMEOUT = 258;
  1143. public const uint WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 + 0;
  1144. public const uint WAIT_OBJECT_0 = STATUS_WAIT_0 + 0;
  1145. public const uint WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 + 0;
  1146. public const uint STATUS_USER_APC = 0x000000C0;
  1147. public const uint WAIT_IO_COMPLETION = STATUS_USER_APC;
  1148. public const int SM_REMOTESESSION = 0x1000;
  1149. public const int WM_WTSSESSION_CHANGE = 0x2b1;
  1150. public const int WM_MOVING = 0x0216;
  1151. public const uint NOTIFY_FOR_ALL_SESSIONS = 1;
  1152. public const uint NOTIFY_FOR_THIS_SESSION = 0;
  1153. public const int BP_PUSHBUTTON = 1;
  1154. public const int PBS_NORMAL = 1;
  1155. public const int PBS_HOT = 2;
  1156. public const int PBS_PRESSED = 3;
  1157. public const int PBS_DISABLED = 4;
  1158. public const int PBS_DEFAULTED = 5;
  1159. public const int PS_SOLID = 0;
  1160. public const int PS_DASH = 1; /* ------- */
  1161. public const int PS_DOT = 2; /* ....... */
  1162. public const int PS_DASHDOT = 3; /* _._._._ */
  1163. public const int PS_DASHDOTDOT = 4; /* _.._.._ */
  1164. public const int PS_NULL = 5;
  1165. public const int PS_INSIDEFRAME = 6;
  1166. public const int PS_USERSTYLE = 7;
  1167. public const int PS_ALTERNATE = 8;
  1168. public const int PS_ENDCAP_ROUND = 0x00000000;
  1169. public const int PS_ENDCAP_SQUARE = 0x00000100;
  1170. public const int PS_ENDCAP_FLAT = 0x00000200;
  1171. public const int PS_ENDCAP_MASK = 0x00000F00;
  1172. public const int PS_JOIN_ROUND = 0x00000000;
  1173. public const int PS_JOIN_BEVEL = 0x00001000;
  1174. public const int PS_JOIN_MITER = 0x00002000;
  1175. public const int PS_JOIN_MASK = 0x0000F000;
  1176. public const int PS_COSMETIC = 0x00000000;
  1177. public const int PS_GEOMETRIC = 0x00010000;
  1178. public const int PS_TYPE_MASK = 0x000F0000;
  1179. public const int BS_SOLID = 0;
  1180. public const int BS_NULL = 1;
  1181. public const int BS_HOLLOW = BS_NULL;
  1182. public const int BS_HATCHED = 2;
  1183. public const int BS_PATTERN = 3;
  1184. public const int BS_INDEXED = 4;
  1185. public const int BS_DIBPATTERN = 5;
  1186. public const int BS_DIBPATTERNPT = 6;
  1187. public const int BS_PATTERN8X8 = 7;
  1188. public const int BS_DIBPATTERN8X8 = 8;
  1189. public const int BS_MONOPATTERN = 9;
  1190. public const uint SRCCOPY = 0x00CC0020; /* dest = source */
  1191. public const uint SRCPAINT = 0x00EE0086; /* dest = source OR dest */
  1192. public const uint SRCAND = 0x008800C6; /* dest = source AND dest */
  1193. public const uint SRCINVERT = 0x00660046; /* dest = source XOR dest */
  1194. public const uint SRCERASE = 0x00440328; /* dest = source AND (NOT dest ) */
  1195. public const uint NOTSRCCOPY = 0x00330008; /* dest = (NOT source) */
  1196. public const uint NOTSRCERASE = 0x001100A6; /* dest = (NOT src) AND (NOT dest) */
  1197. public const uint MERGECOPY = 0x00C000CA; /* dest = (source AND pattern) */
  1198. public const uint MERGEPAINT = 0x00BB0226; /* dest = (NOT source) OR dest */
  1199. public const uint PATCOPY = 0x00F00021; /* dest = pattern */
  1200. public const uint PATPAINT = 0x00FB0A09; /* dest = DPSnoo */
  1201. public const uint PATINVERT = 0x005A0049; /* dest = pattern XOR dest */
  1202. public const uint DSTINVERT = 0x00550009; /* dest = (NOT dest) */
  1203. public const uint BLACKNESS = 0x00000042; /* dest = BLACK */
  1204. public const uint WHITENESS = 0x00FF0062; /* dest = WHITE */
  1205. public const uint NOMIRRORBITMAP = 0x80000000; /* Do not Mirror the bitmap in this call */
  1206. public const uint CAPTUREBLT = 0x40000000; /* Include layered windows */
  1207. // StretchBlt() Modes
  1208. public const int BLACKONWHITE = 1;
  1209. public const int WHITEONBLACK = 2;
  1210. public const int COLORONCOLOR = 3;
  1211. public const int HALFTONE = 4;
  1212. public const int MAXSTRETCHBLTMODE = 4;
  1213. public const int HeapCompatibilityInformation = 0;
  1214. public const uint HEAP_NO_SERIALIZE = 0x00000001;
  1215. public const uint HEAP_GROWABLE = 0x00000002;
  1216. public const uint HEAP_GENERATE_EXCEPTIONS = 0x00000004;
  1217. public const uint HEAP_ZERO_MEMORY = 0x00000008;
  1218. public const uint HEAP_REALLOC_IN_PLACE_ONLY = 0x00000010;
  1219. public const uint HEAP_TAIL_CHECKING_ENABLED = 0x00000020;
  1220. public const uint HEAP_FREE_CHECKING_ENABLED = 0x00000040;
  1221. public const uint HEAP_DISABLE_COALESCE_ON_FREE = 0x00000080;
  1222. public const uint HEAP_CREATE_ALIGN_16 = 0x00010000;
  1223. public const uint HEAP_CREATE_ENABLE_TRACING = 0x00020000;
  1224. public const uint HEAP_MAXIMUM_TAG = 0x0FFF;
  1225. public const uint HEAP_PSEUDO_TAG_FLAG = 0x8000;
  1226. public const uint HEAP_TAG_SHIFT = 18;
  1227. public const int SM_TABLETPC = 86;
  1228. public const uint MONITOR_DEFAULTTONULL = 0x00000000;
  1229. public const uint MONITOR_DEFAULTTOPRIMARY = 0x00000001;
  1230. public const uint MONITOR_DEFAULTTONEAREST = 0x00000002;
  1231. public const uint WTD_UI_ALL = 1;
  1232. public const uint WTD_UI_NONE = 2;
  1233. public const uint WTD_UI_NOBAD = 3;
  1234. public const uint WTD_UI_NOGOOD = 4;
  1235. public const uint WTD_REVOKE_NONE = 0;
  1236. public const uint WTD_REVOKE_WHOLECHAIN = 1;
  1237. public const uint WTD_CHOICE_FILE = 1;
  1238. public const uint WTD_CHOICE_CATALOG = 2;
  1239. public const uint WTD_CHOICE_BLOB = 3;
  1240. public const uint WTD_CHOICE_SIGNER = 4;
  1241. public const uint WTD_CHOICE_CERT = 5;
  1242. public const uint WTD_STATEACTION_IGNORE = 0;
  1243. public const uint WTD_STATEACTION_VERIFY = 1;
  1244. public const uint WTD_STATEACTION_CLOSE = 2;
  1245. public const uint WTD_STATEACTION_AUTO_CACHE = 3;
  1246. public const uint WTD_STATEACTION_AUTO_CACHE_FLUSH = 4;
  1247. public const uint WTD_PROV_FLAGS_MASK = 0x0000FFFF;
  1248. public const uint WTD_USE_IE4_TRUST_FLAG = 0x00000001;
  1249. public const uint WTD_NO_IE4_CHAIN_FLAG = 0x00000002;
  1250. public const uint WTD_NO_POLICY_USAGE_FLAG = 0x00000004;
  1251. public const uint WTD_REVOCATION_CHECK_NONE = 0x00000010;
  1252. public const uint WTD_REVOCATION_CHECK_END_CERT = 0x00000020;
  1253. public const uint WTD_REVOCATION_CHECK_CHAIN = 0x00000040;
  1254. public const uint WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT = 0x00000080;
  1255. public const uint WTD_SAFER_FLAG = 0x00000100;
  1256. public const uint WTD_HASH_ONLY_FLAG = 0x00000200;
  1257. public const uint WTD_USE_DEFAULT_OSVER_CHECK = 0x00000400;
  1258. public const uint WTD_LIFETIME_SIGNING_FLAG = 0x00000800;
  1259. public const uint WTD_CACHE_ONLY_URL_RETRIEVAL = 0x00001000;
  1260. public static Guid WINTRUST_ACTION_GENERIC_VERIFY_V2
  1261. {
  1262. get
  1263. {
  1264. return new Guid(0xaac56b, 0xcd44, 0x11d0, 0x8c, 0xc2, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee);
  1265. }
  1266. }
  1267. public const uint FILE_SHARE_READ = 0x00000001;
  1268. public const uint FILE_SHARE_WRITE = 0x00000002;
  1269. public const uint FILE_SHARE_DELETE = 0x00000004;
  1270. public const uint FILE_READ_DATA = 0x0001;
  1271. public const uint FILE_LIST_DIRECTORY = 0x0001;
  1272. public const uint FILE_WRITE_DATA = 0x0002;
  1273. public const uint FILE_ADD_FILE = 0x0002;
  1274. public const uint FILE_APPEND_DATA = 0x0004;
  1275. public const uint FILE_ADD_SUBDIRECTORY = 0x0004;
  1276. public const uint FILE_CREATE_PIPE_INSTANCE = 0x0004;
  1277. public const uint FILE_READ_EA = 0x0008;
  1278. public const uint FILE_WRITE_EA = 0x0010;
  1279. public const uint FILE_EXECUTE = 0x0020;
  1280. public const uint FILE_TRAVERSE = 0x0020;
  1281. public const uint FILE_DELETE_CHILD = 0x0040;
  1282. public const uint FILE_READ_ATTRIBUTES = 0x0080;
  1283. public const uint FILE_WRITE_ATTRIBUTES = 0x0100;
  1284. public const uint FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF);
  1285. public const uint FILE_GENERIC_READ = (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE);
  1286. public const uint FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE);
  1287. public const uint FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE);
  1288. public const uint READ_CONTROL = 0x00020000;
  1289. public const uint SYNCHRONIZE = 0x00100000;
  1290. public const uint STANDARD_RIGHTS_READ = READ_CONTROL;
  1291. public const uint STANDARD_RIGHTS_WRITE = READ_CONTROL;
  1292. public const uint STANDARD_RIGHTS_EXECUTE = READ_CONTROL;
  1293. public const uint STANDARD_RIGHTS_REQUIRED = 0x000F0000;
  1294. public const uint GENERIC_READ = 0x80000000;
  1295. public const uint GENERIC_WRITE = 0x40000000;
  1296. public const uint GENERIC_EXECUTE = 0x20000000;
  1297. public const uint CREATE_NEW = 1;
  1298. public const uint CREATE_ALWAYS = 2;
  1299. public const uint OPEN_EXISTING = 3;
  1300. public const uint OPEN_ALWAYS = 4;
  1301. public const uint TRUNCATE_EXISTING = 5;
  1302. public const uint FILE_ATTRIBUTE_READONLY = 0x00000001;
  1303. public const uint FILE_ATTRIBUTE_HIDDEN = 0x00000002;
  1304. public const uint FILE_ATTRIBUTE_SYSTEM = 0x00000004;
  1305. public const uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
  1306. public const uint FILE_ATTRIBUTE_ARCHIVE = 0x00000020;
  1307. public const uint FILE_ATTRIBUTE_DEVICE = 0x00000040;
  1308. public const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
  1309. public const uint FILE_ATTRIBUTE_TEMPORARY = 0x00000100;
  1310. public const uint FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200;
  1311. public const uint FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400;
  1312. public const uint FILE_ATTRIBUTE_COMPRESSED = 0x00000800;
  1313. public const uint FILE_ATTRIBUTE_OFFLINE = 0x00001000;
  1314. public const uint FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000;
  1315. public const uint FILE_ATTRIBUTE_ENCRYPTED = 0x00004000;
  1316. public const uint FILE_FLAG_WRITE_THROUGH = 0x80000000;
  1317. public const uint FILE_FLAG_OVERLAPPED = 0x40000000;
  1318. public const uint FILE_FLAG_NO_BUFFERING = 0x20000000;
  1319. public const uint FILE_FLAG_RANDOM_ACCESS = 0x10000000;
  1320. public const uint FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000;
  1321. public const uint FILE_FLAG_DELETE_ON_CLOSE = 0x04000000;
  1322. public const uint FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
  1323. public const uint FILE_FLAG_POSIX_SEMANTICS = 0x01000000;
  1324. public const uint FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
  1325. public const uint FILE_FLAG_OPEN_NO_RECALL = 0x00100000;
  1326. public const uint FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000;
  1327. public const uint FILE_BEGIN = 0;
  1328. public const uint FILE_CURRENT = 1;
  1329. public const uint FILE_END = 2;
  1330. public static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
  1331. public const uint HANDLE_FLAG_INHERIT = 0x1;
  1332. public const uint HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x2;
  1333. public const uint MEM_COMMIT = 0x1000;
  1334. public const uint MEM_RESERVE = 0x2000;
  1335. public const uint MEM_DECOMMIT = 0x4000;
  1336. public const uint MEM_RELEASE = 0x8000;
  1337. public const uint MEM_RESET = 0x80000;
  1338. public const uint MEM_TOP_DOWN = 0x100000;
  1339. public const uint MEM_PHYSICAL = 0x400000;
  1340. public const uint PAGE_NOACCESS = 0x01;
  1341. public const uint PAGE_READONLY = 0x02;
  1342. public const uint PAGE_READWRITE = 0x04;
  1343. public const uint PAGE_WRITECOPY = 0x08;
  1344. public const uint PAGE_EXECUTE = 0x10;
  1345. public const uint PAGE_EXECUTE_READ = 0x20;
  1346. public const uint PAGE_EXECUTE_READWRITE = 0x40;
  1347. public const uint PAGE_EXECUTE_WRITECOPY = 0x80;
  1348. public const uint PAGE_GUARD = 0x100;
  1349. public const uint PAGE_NOCACHE = 0x200;
  1350. public const uint PAGE_WRITECOMBINE = 0x400;
  1351. public const uint SEC_IMAGE = 0x1000000;
  1352. public const uint SEC_RESERVE = 0x4000000;
  1353. public const uint SEC_COMMIT = 0x8000000;
  1354. public const uint SEC_NOCACHE = 0x10000000;
  1355. public const uint SECTION_QUERY = 0x0001;
  1356. public const uint SECTION_MAP_WRITE = 0x0002;
  1357. public const uint SECTION_MAP_READ = 0x0004;
  1358. public const uint SECTION_MAP_EXECUTE_EXPLICIT = 0x0020;
  1359. public const uint FILE_MAP_COPY = SECTION_QUERY;
  1360. public const uint FILE_MAP_WRITE = SECTION_MAP_WRITE;
  1361. public const uint FILE_MAP_READ = SECTION_MAP_READ;
  1362. public const uint FILE_MAP_EXECUTE = SECTION_MAP_EXECUTE_EXPLICIT;
  1363. public const uint GMEM_FIXED = 0x0000;
  1364. public const uint GMEM_MOVEABLE = 0x0002;
  1365. public const uint GMEM_ZEROINIT = 0x0040;
  1366. public const uint GHND = 0x0042;
  1367. public const uint GPTR = 0x0040;
  1368. public const uint DIB_RGB_COLORS = 0; /* color table in RGBs */
  1369. public const uint DIB_PAL_COLORS = 1; /* color table in palette indices */
  1370. public const uint BI_RGB = 0;
  1371. public const uint BI_RLE8 = 1;
  1372. public const uint BI_RLE4 = 2;
  1373. public const uint BI_BITFIELDS = 3;
  1374. public const uint BI_JPEG = 4;
  1375. public const uint BI_PNG = 5;
  1376. public const uint DT_TOP = 0x00000000;
  1377. public const uint DT_LEFT = 0x00000000;
  1378. public const uint DT_CENTER = 0x00000001;
  1379. public const uint DT_RIGHT = 0x00000002;
  1380. public const uint DT_VCENTER = 0x00000004;
  1381. public const uint DT_BOTTOM = 0x00000008;
  1382. public const uint DT_WORDBREAK = 0x00000010;
  1383. public const uint DT_SINGLELINE = 0x00000020;
  1384. public const uint DT_EXPANDTABS = 0x00000040;
  1385. public const uint DT_TABSTOP = 0x00000080;
  1386. public const uint DT_NOCLIP = 0x00000100;
  1387. public const uint DT_EXTERNALLEADING = 0x00000200;
  1388. public const uint DT_CALCRECT = 0x00000400;
  1389. public const uint DT_NOPREFIX = 0x00000800;
  1390. public const uint DT_public = 0x00001000;
  1391. public const uint DT_EDITCONTROL = 0x00002000;
  1392. public const uint DT_PATH_ELLIPSIS = 0x00004000;
  1393. public const uint DT_END_ELLIPSIS = 0x00008000;
  1394. public const uint DT_MODIFYSTRING = 0x00010000;
  1395. public const uint DT_RTLREADING = 0x00020000;
  1396. public const uint DT_WORD_ELLIPSIS = 0x00040000;
  1397. public const uint DT_NOFULLWIDTHCHARBREAK = 0x00080000;
  1398. public const uint DT_HIDEPREFIX = 0x00100000;
  1399. public const uint DT_PREFIXONLY = 0x00200000;
  1400. public const uint FW_DONTCARE = 0;
  1401. public const uint FW_THIN = 100;
  1402. public const uint FW_EXTRALIGHT = 200;
  1403. public const uint FW_LIGHT = 300;
  1404. public const uint FW_NORMAL = 400;
  1405. public const uint FW_MEDIUM = 500;
  1406. public const uint FW_SEMIBOLD = 600;
  1407. public const uint FW_BOLD = 700;
  1408. public const uint FW_EXTRABOLD = 800;
  1409. public const uint FW_HEAVY = 900;
  1410. public const uint OUT_DEFAULT_PRECIS = 0;
  1411. public const uint OUT_STRING_PRECIS = 1;
  1412. public const uint OUT_CHARACTER_PRECIS = 2;
  1413. public const uint OUT_STROKE_PRECIS = 3;
  1414. public const uint OUT_TT_PRECIS = 4;
  1415. public const uint OUT_DEVICE_PRECIS = 5;
  1416. public const uint OUT_RASTER_PRECIS = 6;
  1417. public const uint OUT_TT_ONLY_PRECIS = 7;
  1418. public const uint OUT_OUTLINE_PRECIS = 8;
  1419. public const uint OUT_SCREEN_OUTLINE_PRECIS = 9;
  1420. public const uint OUT_PS_ONLY_PRECIS = 10;
  1421. public const uint CLIP_DEFAULT_PRECIS = 0;
  1422. public const uint CLIP_CHARACTER_PRECIS = 1;
  1423. public const uint CLIP_STROKE_PRECIS = 2;
  1424. public const uint CLIP_MASK = 0xf;
  1425. public const uint CLIP_LH_ANGLES = (1 << 4);
  1426. public const uint CLIP_TT_ALWAYS = (2 << 4);
  1427. public const uint CLIP_EMBEDDED = (8 << 4);
  1428. public const uint DEFAULT_QUALITY = 0;
  1429. public const uint DRAFT_QUALITY = 1;
  1430. public const uint PROOF_QUALITY = 2;
  1431. public const uint NONANTIALIASED_QUALITY = 3;
  1432. public const uint ANTIALIASED_QUALITY = 4;
  1433. public const uint CLEARTYPE_QUALITY = 5;
  1434. public const uint CLEARTYPE_NATURAL_QUALITY = 6;
  1435. public const uint DEFAULT_PITCH = 0;
  1436. public const uint FIXED_PITCH = 1;
  1437. public const uint VARIABLE_PITCH = 2;
  1438. public const uint MONO_FONT = 8;
  1439. public const uint FF_DONTCARE = (0 << 4);
  1440. public const uint FF_ROMAN = (1 << 4);
  1441. public const uint FF_SWISS = (2 << 4);
  1442. public const uint FF_MODERN = (3 << 4);
  1443. public const uint FF_SCRIPT = (4 << 4);
  1444. public const uint FF_DECORATIVE = (5 << 4);
  1445. public const int SB_HORZ = 0;
  1446. public const int SB_VERT = 1;
  1447. public const int S_OK = 0;
  1448. public const int S_FALSE = 1;
  1449. public const int E_NOTIMPL = unchecked((int)0x80004001);
  1450. }
  1451. #endregion
  1452. }
  1453. }