ProgressThreadProcClass.cs 79 KB

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