Facebook
From Ano, 9 Years ago, written in AutoIT.
Embed
Download Paste or View Raw
Hits: 737
  1. #NoTrayIcon
  2. $sversionnumber = "2.1.0.0"
  3. Global Const $opt_coordsrelative = 0
  4. Global Const $opt_coordsabsolute = 1
  5. Global Const $opt_coordsclient = 2
  6. Global Const $opt_errorsilent = 0
  7. Global Const $opt_errorfatal = 1
  8. Global Const $opt_capsnostore = 0
  9. Global Const $opt_capsstore = 1
  10. Global Const $opt_matchstart = 1
  11. Global Const $opt_matchany = 2
  12. Global Const $opt_matchexact = 3
  13. Global Const $opt_matchadvanced = 4
  14. Global Const $ccs_top = 1
  15. Global Const $ccs_nomovey = 2
  16. Global Const $ccs_bottom = 3
  17. Global Const $ccs_noresize = 4
  18. Global Const $ccs_noparentalign = 8
  19. Global Const $ccs_nohilite = 16
  20. Global Const $ccs_adjustable = 32
  21. Global Const $ccs_nodivider = 64
  22. Global Const $ccs_vert = 128
  23. Global Const $ccs_left = 129
  24. Global Const $ccs_nomovex = 130
  25. Global Const $ccs_right = 131
  26. Global Const $dt_drivetype = 1
  27. Global Const $dt_ssdstatus = 2
  28. Global Const $dt_bustype = 3
  29. Global Const $objid_window = 0
  30. Global Const $objid_titlebar = -2
  31. Global Const $objid_sizegrip = -7
  32. Global Const $objid_caret = -8
  33. Global Const $objid_cursor = -9
  34. Global Const $objid_alert = -10
  35. Global Const $objid_sound = -11
  36. Global Const $dlg_notitle = 1
  37. Global Const $dlg_notontop = 2
  38. Global Const $dlg_textleft = 4
  39. Global Const $dlg_textright = 8
  40. Global Const $dlg_moveable = 16
  41. Global Const $dlg_textvcenter = 32
  42. Global Const $idc_unknown = 0
  43. Global Const $idc_appstarting = 1
  44. Global Const $idc_arrow = 2
  45. Global Const $idc_cross = 3
  46. Global Const $idc_hand = 32649
  47. Global Const $idc_help = 4
  48. Global Const $idc_ibeam = 5
  49. Global Const $idc_icon = 6
  50. Global Const $idc_no = 7
  51. Global Const $idc_size = 8
  52. Global Const $idc_sizeall = 9
  53. Global Const $idc_sizenesw = 10
  54. Global Const $idc_sizens = 11
  55. Global Const $idc_sizenwse = 12
  56. Global Const $idc_sizewe = 13
  57. Global Const $idc_uparrow = 14
  58. Global Const $idc_wait = 15
  59. Global Const $idi_application = 32512
  60. Global Const $idi_asterisk = 32516
  61. Global Const $idi_exclamation = 32515
  62. Global Const $idi_hand = 32513
  63. Global Const $idi_question = 32514
  64. Global Const $idi_winlogo = 32517
  65. Global Const $idi_shield = 32518
  66. Global Const $idi_error = $idi_hand
  67. Global Const $idi_information = $idi_asterisk
  68. Global Const $idi_warning = $idi_exclamation
  69. Global Const $sd_logoff = 0
  70. Global Const $sd_shutdown = 1
  71. Global Const $sd_reboot = 2
  72. Global Const $sd_force = 4
  73. Global Const $sd_powerdown = 8
  74. Global Const $sd_forcehung = 16
  75. Global Const $sd_standby = 32
  76. Global Const $sd_hibernate = 64
  77. Global Const $stdin_child = 1
  78. Global Const $stdout_child = 2
  79. Global Const $stderr_child = 4
  80. Global Const $stderr_merged = 8
  81. Global Const $stdio_inherit_parent = 16
  82. Global Const $run_create_new_console = 65536
  83. Global Const $ubound_dimensions = 0
  84. Global Const $ubound_rows = 1
  85. Global Const $ubound_columns = 2
  86. Global Const $mouseeventf_absolute = 32768
  87. Global Const $mouseeventf_move = 1
  88. Global Const $mouseeventf_leftdown = 2
  89. Global Const $mouseeventf_leftup = 4
  90. Global Const $mouseeventf_rightdown = 8
  91. Global Const $mouseeventf_rightup = 16
  92. Global Const $mouseeventf_middledown = 32
  93. Global Const $mouseeventf_middleup = 64
  94. Global Const $mouseeventf_wheel = 2048
  95. Global Const $mouseeventf_xdown = 128
  96. Global Const $mouseeventf_xup = 256
  97. Global Const $reg_none = 0
  98. Global Const $reg_sz = 1
  99. Global Const $reg_expand_sz = 2
  100. Global Const $reg_binary = 3
  101. Global Const $reg_dword = 4
  102. Global Const $reg_dword_little_endian = 4
  103. Global Const $reg_dword_big_endian = 5
  104. Global Const $reg_link = 6
  105. Global Const $reg_multi_sz = 7
  106. Global Const $reg_resource_list = 8
  107. Global Const $reg_full_resource_descriptor = 9
  108. Global Const $reg_resource_requirements_list = 10
  109. Global Const $reg_qword = 11
  110. Global Const $reg_qword_little_endian = 11
  111. Global Const $hwnd_bottom = 1
  112. Global Const $hwnd_notopmost = -2
  113. Global Const $hwnd_top = 0
  114. Global Const $hwnd_topmost = -1
  115. Global Const $swp_nosize = 1
  116. Global Const $swp_nomove = 2
  117. Global Const $swp_nozorder = 4
  118. Global Const $swp_noredraw = 8
  119. Global Const $swp_noactivate = 16
  120. Global Const $swp_framechanged = 32
  121. Global Const $swp_drawframe = 32
  122. Global Const $swp_showwindow = 64
  123. Global Const $swp_hidewindow = 128
  124. Global Const $swp_nocopybits = 256
  125. Global Const $swp_noownerzorder = 512
  126. Global Const $swp_noreposition = 512
  127. Global Const $swp_nosendchanging = 1024
  128. Global Const $swp_defererase = 8192
  129. Global Const $swp_asyncwindowpos = 16384
  130. Global Const $keyword_default = 1
  131. Global Const $keyword_null = 2
  132. Global Const $color_aqua = 65535
  133. Global Const $color_black = 0
  134. Global Const $color_blue = 255
  135. Global Const $color_cream = 16776176
  136. Global Const $color_fuchsia = 16711935
  137. Global Const $color_gray = 8421504
  138. Global Const $color_green = 32768
  139. Global Const $color_lime = 65280
  140. Global Const $color_maroon = 9116770
  141. Global Const $color_medblue = 708
  142. Global Const $color_medgray = 10526884
  143. Global Const $color_moneygreen = 12639424
  144. Global Const $color_navy = 128
  145. Global Const $color_olive = 8421376
  146. Global Const $color_purple = 8388736
  147. Global Const $color_red = 16711680
  148. Global Const $color_silver = 12632256
  149. Global Const $color_skyblue = 10930928
  150. Global Const $color_teal = 32896
  151. Global Const $color_white = 16777215
  152. Global Const $color_yellow = 16776960
  153. Global Const $clr_none = -1
  154. Global Const $clr_default = -16777216
  155. Global Const $clr_aqua = 16776960
  156. Global Const $clr_black = 0
  157. Global Const $clr_blue = 16711680
  158. Global Const $clr_cream = 15793151
  159. Global Const $clr_fuchsia = 16711935
  160. Global Const $clr_gray = 8421504
  161. Global Const $clr_green = 32768
  162. Global Const $clr_lime = 65280
  163. Global Const $clr_maroon = 6429835
  164. Global Const $clr_medblue = 12845568
  165. Global Const $clr_medgray = 10789024
  166. Global Const $clr_moneygreen = 12639424
  167. Global Const $clr_navy = 8388608
  168. Global Const $clr_olive = 32896
  169. Global Const $clr_purple = 8388736
  170. Global Const $clr_red = 255
  171. Global Const $clr_silver = 12632256
  172. Global Const $clr_skyblue = 15780518
  173. Global Const $clr_teal = 8421376
  174. Global Const $clr_white = 16777215
  175. Global Const $clr_yellow = 65535
  176. Global Const $cc_anycolor = 256
  177. Global Const $cc_fullopen = 2
  178. Global Const $cc_rgbinit = 1
  179. Global Const $ddl_archive = 32
  180. Global Const $ddl_directory = 16
  181. Global Const $ddl_drives = 16384
  182. Global Const $ddl_exclusive = 32768
  183. Global Const $ddl_hidden = 2
  184. Global Const $ddl_readonly = 1
  185. Global Const $ddl_readwrite = 0
  186. Global Const $ddl_system = 4
  187. Global Const $fc_nooverwrite = 0
  188. Global Const $fc_overwrite = 1
  189. Global Const $fc_createpath = 8
  190. Global Const $ft_modified = 0
  191. Global Const $ft_created = 1
  192. Global Const $ft_accessed = 2
  193. Global Const $fo_read = 0
  194. Global Const $fo_append = 1
  195. Global Const $fo_overwrite = 2
  196. Global Const $fo_createpath = 8
  197. Global Const $fo_binary = 16
  198. Global Const $fo_unicode = 32
  199. Global Const $fo_utf16_le = 32
  200. Global Const $fo_utf16_be = 64
  201. Global Const $fo_utf8 = 128
  202. Global Const $fo_utf8_nobom = 256
  203. Global Const $fo_utf8_full = 16384
  204. Global Const $eof = -1
  205. Global Const $fd_filemustexist = 1
  206. Global Const $fd_pathmustexist = 2
  207. Global Const $fd_multiselect = 4
  208. Global Const $fd_promptcreatenew = 8
  209. Global Const $fd_promptoverwrite = 16
  210. Global Const $create_new = 1
  211. Global Const $create_always = 2
  212. Global Const $open_existing = 3
  213. Global Const $open_always = 4
  214. Global Const $truncate_existing = 5
  215. Global Const $invalid_set_file_pointer = -1
  216. Global Const $file_begin = 0
  217. Global Const $file_current = 1
  218. Global Const $file_end = 2
  219. Global Const $file_attribute_readonly = 1
  220. Global Const $file_attribute_hidden = 2
  221. Global Const $file_attribute_system = 4
  222. Global Const $file_attribute_directory = 16
  223. Global Const $file_attribute_archive = 32
  224. Global Const $file_attribute_device = 64
  225. Global Const $file_attribute_normal = 128
  226. Global Const $file_attribute_temporary = 256
  227. Global Const $file_attribute_sparse_file = 512
  228. Global Const $file_attribute_reparse_point = 1024
  229. Global Const $file_attribute_compressed = 2048
  230. Global Const $file_attribute_offline = 4096
  231. Global Const $file_attribute_not_content_indexed = 8192
  232. Global Const $file_attribute_encrypted = 16384
  233. Global Const $file_share_read = 1
  234. Global Const $file_share_write = 2
  235. Global Const $file_share_delete = 4
  236. Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write)
  237. Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
  238. Global Const $generic_all = 268435456
  239. Global Const $generic_execute = 536870912
  240. Global Const $generic_write = 1073741824
  241. Global Const $generic_read = -2147483648
  242. Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
  243. Global Const $frta_nocount = 0
  244. Global Const $frta_count = 1
  245. Global Const $frta_intarrays = 2
  246. Global Const $frta_entiresplit = 4
  247. Global Const $flta_filesfolders = 0
  248. Global Const $flta_files = 1
  249. Global Const $flta_folders = 2
  250. Global Const $fltar_filesfolders = 0
  251. Global Const $fltar_files = 1
  252. Global Const $fltar_folders = 2
  253. Global Const $fltar_nohidden = 4
  254. Global Const $fltar_nosystem = 8
  255. Global Const $fltar_nolink = 16
  256. Global Const $fltar_norecur = 0
  257. Global Const $fltar_recur = 1
  258. Global Const $fltar_nosort = 0
  259. Global Const $fltar_sort = 1
  260. Global Const $fltar_fastsort = 2
  261. Global Const $fltar_nopath = 0
  262. Global Const $fltar_relpath = 1
  263. Global Const $fltar_fullpath = 2
  264. Global Const $mb_ok = 0
  265. Global Const $mb_okcancel = 1
  266. Global Const $mb_abortretryignore = 2
  267. Global Const $mb_yesnocancel = 3
  268. Global Const $mb_yesno = 4
  269. Global Const $mb_retrycancel = 5
  270. Global Const $mb_canceltrycontinue = 6
  271. Global Const $mb_help = 16384
  272. Global Const $mb_iconstop = 16
  273. Global Const $mb_iconerror = 16
  274. Global Const $mb_iconhand = 16
  275. Global Const $mb_iconquestion = 32
  276. Global Const $mb_iconexclamation = 48
  277. Global Const $mb_iconwarning = 48
  278. Global Const $mb_iconinformation = 64
  279. Global Const $mb_iconasterisk = 64
  280. Global Const $mb_usericon = 128
  281. Global Const $mb_defbutton1 = 0
  282. Global Const $mb_defbutton2 = 256
  283. Global Const $mb_defbutton3 = 512
  284. Global Const $mb_defbutton4 = 768
  285. Global Const $mb_applmodal = 0
  286. Global Const $mb_systemmodal = 4096
  287. Global Const $mb_taskmodal = 8192
  288. Global Const $mb_default_desktop_only = 131072
  289. Global Const $mb_right = 524288
  290. Global Const $mb_rtlreading = 1048576
  291. Global Const $mb_setforeground = 65536
  292. Global Const $mb_topmost = 262144
  293. Global Const $mb_service_notification = 2097152
  294. Global Const $mb_rightjustified = $mb_right
  295. Global Const $idtimeout = -1
  296. Global Const $idok = 1
  297. Global Const $idcancel = 2
  298. Global Const $idabort = 3
  299. Global Const $idretry = 4
  300. Global Const $idignore = 5
  301. Global Const $idyes = 6
  302. Global Const $idno = 7
  303. Global Const $idclose = 8
  304. Global Const $idhelp = 9
  305. Global Const $idtryagain = 10
  306. Global Const $idcontinue = 11
  307. Global Const $process_terminate = 1
  308. Global Const $process_create_thread = 2
  309. Global Const $process_set_sessionid = 4
  310. Global Const $process_vm_operation = 8
  311. Global Const $process_vm_read = 16
  312. Global Const $process_vm_write = 32
  313. Global Const $process_dup_handle = 64
  314. Global Const $process_create_process = 128
  315. Global Const $process_set_quota = 256
  316. Global Const $process_set_information = 512
  317. Global Const $process_query_information = 1024
  318. Global Const $process_query_limited_information = 4096
  319. Global Const $process_suspend_resume = 2048
  320. Global Const $process_all_access = 2035711
  321. Global Const $str_nocasesense = 0
  322. Global Const $str_casesense = 1
  323. Global Const $str_nocasesensebasic = 2
  324. Global Const $str_stripleading = 1
  325. Global Const $str_striptrailing = 2
  326. Global Const $str_stripspaces = 4
  327. Global Const $str_stripall = 8
  328. Global Const $str_chrsplit = 0
  329. Global Const $str_entiresplit = 1
  330. Global Const $str_nocount = 2
  331. Global Const $str_regexpmatch = 0
  332. Global Const $str_regexparraymatch = 1
  333. Global Const $str_regexparrayfullmatch = 2
  334. Global Const $str_regexparrayglobalmatch = 3
  335. Global Const $str_regexparrayglobalfullmatch = 4
  336. Global Const $str_endisstart = 0
  337. Global Const $str_endnotstart = 1
  338. Global Const $tray_item_exit = 3
  339. Global Const $tray_item_pause = 4
  340. Global Const $tray_item_first = 7
  341. Global Const $tray_checked = 1
  342. Global Const $tray_unchecked = 4
  343. Global Const $tray_enable = 64
  344. Global Const $tray_disable = 128
  345. Global Const $tray_focus = 256
  346. Global Const $tray_default = 512
  347. Global Const $tray_event_showicon = -3
  348. Global Const $tray_event_hideicon = -4
  349. Global Const $tray_event_flashicon = -5
  350. Global Const $tray_event_noflashicon = -6
  351. Global Const $tray_event_primarydown = -7
  352. Global Const $tray_event_primaryup = -8
  353. Global Const $tray_event_secondarydown = -9
  354. Global Const $tray_event_secondaryup = -10
  355. Global Const $tray_event_mouseover = -11
  356. Global Const $tray_event_mouseout = -12
  357. Global Const $tray_event_primarydouble = -13
  358. Global Const $tray_event_secondarydouble = -14
  359. Global Const $tip_iconnone = 0
  360. Global Const $tip_iconasterisk = 1
  361. Global Const $tip_iconexclamation = 2
  362. Global Const $tip_iconhand = 3
  363. Global Const $tip_nosound = 16
  364. Global Const $tray_iconstate_show = 1
  365. Global Const $tray_iconstate_hide = 2
  366. Global Const $tray_iconstate_flash = 4
  367. Global Const $tray_iconstate_stopflash = 8
  368. Global Const $tray_iconstate_reset = 16
  369. Global Const $fw_dontcare = 0
  370. Global Const $fw_thin = 100
  371. Global Const $fw_extralight = 200
  372. Global Const $fw_ultralight = 200
  373. Global Const $fw_light = 300
  374. Global Const $fw_normal = 400
  375. Global Const $fw_regular = 400
  376. Global Const $fw_medium = 500
  377. Global Const $fw_semibold = 600
  378. Global Const $fw_demibold = 600
  379. Global Const $fw_bold = 700
  380. Global Const $fw_extrabold = 800
  381. Global Const $fw_ultrabold = 800
  382. Global Const $fw_heavy = 900
  383. Global Const $fw_black = 900
  384. Global Const $cf_effects = 256
  385. Global Const $cf_printerfonts = 2
  386. Global Const $cf_screenfonts = 1
  387. Global Const $cf_noscriptsel = 8388608
  388. Global Const $cf_inittologfontstruct = 64
  389. Global Const $logpixelsx = 88
  390. Global Const $logpixelsy = 90
  391. Global Const $ansi_charset = 0
  392. Global Const $arabic_charset = 178
  393. Global Const $baltic_charset = 186
  394. Global Const $chinesebig5_charset = 136
  395. Global Const $default_charset = 1
  396. Global Const $easteurope_charset = 238
  397. Global Const $gb2312_charset = 134
  398. Global Const $greek_charset = 161
  399. Global Const $hangeul_charset = 129
  400. Global Const $hebrew_charset = 177
  401. Global Const $johab_charset = 130
  402. Global Const $mac_charset = 77
  403. Global Const $oem_charset = 255
  404. Global Const $russian_charset = 204
  405. Global Const $shiftjis_charset = 128
  406. Global Const $symbol_charset = 2
  407. Global Const $thai_charset = 222
  408. Global Const $turkish_charset = 162
  409. Global Const $vietnamese_charset = 163
  410. Global Const $out_character_precis = 2
  411. Global Const $out_default_precis = 0
  412. Global Const $out_device_precis = 5
  413. Global Const $out_outline_precis = 8
  414. Global Const $out_ps_only_precis = 10
  415. Global Const $out_raster_precis = 6
  416. Global Const $out_string_precis = 1
  417. Global Const $out_stroke_precis = 3
  418. Global Const $out_tt_only_precis = 7
  419. Global Const $out_tt_precis = 4
  420. Global Const $clip_character_precis = 1
  421. Global Const $clip_default_precis = 0
  422. Global Const $clip_dfa_disable = 48
  423. Global Const $clip_embedded = 128
  424. Global Const $clip_lh_angles = 16
  425. Global Const $clip_mask = 15
  426. Global Const $clip_dfa_override = 64
  427. Global Const $clip_stroke_precis = 2
  428. Global Const $clip_tt_always = 32
  429. Global Const $antialiased_quality = 4
  430. Global Const $default_quality = 0
  431. Global Const $draft_quality = 1
  432. Global Const $nonantialiased_quality = 3
  433. Global Const $proof_quality = 2
  434. Global Const $cleartype_quality = 5
  435. Global Const $default_pitch = 0
  436. Global Const $fixed_pitch = 1
  437. Global Const $variable_pitch = 2
  438. Global Const $ff_decorative = 80
  439. Global Const $ff_dontcare = 0
  440. Global Const $ff_modern = 48
  441. Global Const $ff_roman = 16
  442. Global Const $ff_script = 64
  443. Global Const $ff_swiss = 32
  444. Global Const $fs_regular = 0
  445. Global Const $fs_bold = 1
  446. Global Const $fs_italic = 2
  447. Global Const $tagpoint = "struct;long X;long Y;endstruct"
  448. Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
  449. Global Const $tagsize = "struct;long X;long Y;endstruct"
  450. Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
  451. Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
  452. Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
  453. Global Const $tagtime_zone_information = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct"
  454. Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
  455. Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
  456. Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
  457. Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
  458. Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
  459. Global Const $tagdtprange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & "word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & "word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid"
  460. Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  461. Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
  462. Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
  463. Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
  464. Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  465. Global Const $tageventlogrecord = "dword Length;dword Reserved;dword RecordNumber;dword TimeGenerated;dword TimeWritten;dword EventID;" & "word EventType;word NumStrings;word EventCategory;word ReservedFlags;dword ClosingRecordNumber;dword StringOffset;" & "dword UserSidLength;dword UserSidOffset;dword DataLength;dword DataOffset"
  466. Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge"
  467. Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel"
  468. Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue"
  469. Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue"
  470. Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]"
  471. Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel"
  472. Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow"
  473. Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas"
  474. Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount"
  475. Global Const $taggdip_effectparams_tint = "int Hue; int Amount"
  476. Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
  477. Global Const $taggdipcolormatrix = "float m[25]"
  478. Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct"
  479. Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam
  480. Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct"
  481. Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
  482. Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
  483. Global Const $taggdipimagecodecinfo = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & "ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask"
  484. Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
  485. Global Const $taghditem = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State"
  486. Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
  487. Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
  488. Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
  489. Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
  490. Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
  491. Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
  492. Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
  493. Global Const $taglvitem = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct"
  494. Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
  495. Global Const $tagnmlvcustomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStage;handle hdc;" & $tagrect & ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartId;int iStateId;struct;long TextLeft;long TextTop;long TextRight;long TextBottom;endstruct;uint uAlign"
  496. Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  497. Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
  498. Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
  499. Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
  500. Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  501. Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  502. Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
  503. Global Const $tagmcmonthrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short Span"
  504. Global Const $tagmcrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short MinSet;short MaxSet"
  505. Global Const $tagmcselrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds"
  506. Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
  507. Global Const $tagnmselchange = $tagnmhdr & ";struct;word BegYear;word BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;word BegSecond;word BegMSeconds;endstruct;" & "struct;word EndYear;word EndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds;endstruct"
  508. Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
  509. Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  510. Global Const $tagtvitem = "struct;uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param;endstruct"
  511. Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
  512. Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & "struct;long PointX;long PointY;endstruct"
  513. Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
  514. Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  515. Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
  516. Global Const $tagnmtvitemchange = $tagnmhdr & ";uint Changed;handle hItem;uint StateNew;uint StateOld;lparam lParam;"
  517. Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
  518. Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  519. Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
  520. Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  521. Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
  522. Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
  523. Global Const $tagmenuiteminfo = "uint Size;uint Mask;uint Type;uint State;uint ID;handle SubMenu;handle BmpChecked;handle BmpUnchecked;" & "ulong_ptr ItemData;ptr TypeData;uint CCH;handle BmpItem"
  524. Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uint uChevronState")
  525. Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
  526. Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "struct;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;endstruct;" & "struct;long ActualLeft;long ActualTop;long ActualRight;long ActualBottom;endstruct"
  527. Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
  528. Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
  529. Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;" & "struct;long CLeft;long CTop;long CRight;long CBottom;endstruct;" & "struct;long BLeft;long BTop;long BRight;long BBottom;endstruct"
  530. Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
  531. Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "struct;int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString;endstruct" & ";int cchText;ptr pszText;" & $tagrect
  532. Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
  533. Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String"
  534. Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
  535. Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
  536. Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
  537. Global Const $tagopenfilename = "dword StructSize;hwnd hwndOwner;handle hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & "dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;" & "ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;word nFileOffset;word nFileExtension;ptr lpstrDefExt;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx"
  538. Global Const $tagbitmapinfoheader = "struct;dword biSize;long biWidth;long biHeight;word biPlanes;word biBitCount;" & "dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;endstruct"
  539. Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]"
  540. Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
  541. Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
  542. Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
  543. Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
  544. Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
  545. Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
  546. Global Const $taglogfont = "struct;long Height;long Width;long Escapement;long Orientation;long Weight;byte Italic;byte Underline;" & "byte Strikeout;byte CharSet;byte OutPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;wchar FaceName[32];endstruct"
  547. Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
  548. Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
  549. Global Const $tagstartupinfo = "dword Size;ptr Reserved1;ptr Desktop;ptr Title;dword X;dword Y;dword XSize;dword YSize;dword XCountChars;" & "dword YCountChars;dword FillAttribute;dword Flags;word ShowWindow;word Reserved2;ptr Reserved3;handle StdInput;" & "handle StdOutput;handle StdError"
  550. Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
  551. Global Const $tagwin32_find_data = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]"
  552. Global Const $tagtextmetric = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & "wchar tmFirstChar;wchar tmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & "byte tmPitchAndFamily;byte tmCharSet"
  553.  
  554. Func _winapi_getlasterror($ierror = @error, $iextended = @extended)
  555.         Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  556.         Return SetError($ierror, $iextended, $aresult[0])
  557.  
  558. Func _winapi_setlasterror($ierrorcode, $ierror = @error, $iextended = @extended)
  559.         DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
  560.         Return SetError($ierror, $iextended, NULL )
  561.  
  562. Global Const $__miscconstant_cc_anycolor = 256
  563. Global Const $__miscconstant_cc_fullopen = 2
  564. Global Const $__miscconstant_cc_rgbinit = 1
  565. Global Const $tagchoosecolor = "dword Size;hwnd hWndOwnder;handle hInstance;dword rgbResult;ptr CustColors;dword Flags;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName"
  566. Global Const $tagchoosefont = "dword Size;hwnd hWndOwner;handle hDC;ptr LogFont;int PointSize;dword Flags;dword rgbColors;lparam CustData;" & "ptr fnHook;ptr TemplateName;handle hInstance;ptr szStyle;word FontType;int SizeMin;int SizeMax"
  567.  
  568. Func _choosecolor($ireturntype = 0, $icolorref = 0, $ireftype = 0, $hwndownder = 0)
  569.         Local $tagcustcolors = "dword[16]"
  570.         Local $tchoose = DllStructCreate($tagchoosecolor)
  571.         Local $tcc = DllStructCreate($tagcustcolors)
  572.         If $ireftype = 1 Then
  573.                 $icolorref = Int($icolorref)
  574.         ElseIf $ireftype = 2 Then
  575.                 $icolorref = Hex(String($icolorref), 6)
  576.                 $icolorref = "0x" & StringMid($icolorref, 5, 2) & StringMid($icolorref, 3, 2) & StringMid($icolorref, 1, 2)
  577.         EndIf
  578.         DllStructSetData($tchoose, "Size", DllStructGetSize($tchoose))
  579.         DllStructSetData($tchoose, "hWndOwnder", $hwndownder)
  580.         DllStructSetData($tchoose, "rgbResult", $icolorref)
  581.         DllStructSetData($tchoose, "CustColors", DllStructGetPtr($tcc))
  582.         DllStructSetData($tchoose, "Flags", BitOR($__miscconstant_cc_anycolor, $__miscconstant_cc_fullopen, $__miscconstant_cc_rgbinit))
  583.         Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseColor", "struct*", $tchoose)
  584.         If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
  585.         Local $scolor_picked = DllStructGetData($tchoose, "rgbResult")
  586.         If $ireturntype = 1 Then
  587.                 Return "0x" & Hex(String($scolor_picked), 6)
  588.         ElseIf $ireturntype = 2 Then
  589.                 $scolor_picked = Hex(String($scolor_picked), 6)
  590.                 Return "0x" & StringMid($scolor_picked, 5, 2) & StringMid($scolor_picked, 3, 2) & StringMid($scolor_picked, 1, 2)
  591.         ElseIf $ireturntype = 0 Then
  592.                 Return $scolor_picked
  593.         Else
  594.                 Return SetError(-4, -4, -1)
  595.         EndIf
  596.  
  597. Func _choosefont($sfontname = "Courier New", $ipointsize = 10, $ifontcolorref = 0, $ifontweight = 0, $bitalic = False, $bunderline = False, $bstrikethru = False, $hwndowner = 0)
  598.         Local $iitalic = 0, $iunderline = 0, $istrikeout = 0
  599.         Local $hdc = __misc_getdc(0)
  600.         Local $iheight = Round(($ipointsize * __misc_getdevicecaps($hdc, $logpixelsx)) / 72, 0)
  601.         __misc_releasedc(0, $hdc)
  602.         Local $tchoosefont = DllStructCreate($tagchoosefont)
  603.         Local $tlogfont = DllStructCreate($taglogfont)
  604.         DllStructSetData($tchoosefont, "Size", DllStructGetSize($tchoosefont))
  605.         DllStructSetData($tchoosefont, "hWndOwner", $hwndowner)
  606.         DllStructSetData($tchoosefont, "LogFont", DllStructGetPtr($tlogfont))
  607.         DllStructSetData($tchoosefont, "PointSize", $ipointsize)
  608.         DllStructSetData($tchoosefont, "Flags", BitOR($cf_screenfonts, $cf_printerfonts, $cf_effects, $cf_inittologfontstruct, $cf_noscriptsel))
  609.         DllStructSetData($tchoosefont, "rgbColors", $ifontcolorref)
  610.         DllStructSetData($tchoosefont, "FontType", 0)
  611.         DllStructSetData($tlogfont, "Height", $iheight)
  612.         DllStructSetData($tlogfont, "Weight", $ifontweight)
  613.         DllStructSetData($tlogfont, "Italic", $bitalic)
  614.         DllStructSetData($tlogfont, "Underline", $bunderline)
  615.         DllStructSetData($tlogfont, "Strikeout", $bstrikethru)
  616.         DllStructSetData($tlogfont, "FaceName", $sfontname)
  617.         Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseFontW", "struct*", $tchoosefont)
  618.         If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
  619.         Local $sfacename = DllStructGetData($tlogfont, "FaceName")
  620.         If StringLen($sfacename) = 0 AND StringLen($sfontname) > 0 Then $sfacename = $sfontname
  621.         If DllStructGetData($tlogfont, "Italic") Then $iitalic = 2
  622.         If DllStructGetData($tlogfont, "Underline") Then $iunderline = 4
  623.         If DllStructGetData($tlogfont, "Strikeout") Then $istrikeout = 8
  624.         Local $iattributes = BitOR($iitalic, $iunderline, $istrikeout)
  625.         Local $isize = DllStructGetData($tchoosefont, "PointSize") / 10
  626.         Local $icolorref = DllStructGetData($tchoosefont, "rgbColors")
  627.         Local $iweight = DllStructGetData($tlogfont, "Weight")
  628.         Local $scolor_picked = Hex(String($icolorref), 6)
  629.         Return StringSplit($iattributes & "," & $sfacename & "," & $isize & "," & $iweight & "," & $icolorref & "," & "0x" & $scolor_picked & "," & "0x" & StringMid($scolor_picked, 5, 2) & StringMid($scolor_picked, 3, 2) & StringMid($scolor_picked, 1, 2), ",")
  630.  
  631. Func _clipputfile($sfile, $sseparator = "|")
  632.         Local Const $gmem_moveable = 2, $cf_hdrop = 15
  633.         $sfile &= $sseparator & $sseparator
  634.         Local $nglobmemsize = 2 * (StringLen($sfile) + 20)
  635.         Local $aresult = DllCall("user32.dll", "bool", "OpenClipboard", "hwnd", 0)
  636.         If @error OR $aresult[0] = 0 Then Return SetError(1, _winapi_getlasterror(), False)
  637.         Local $ierror = 0, $ilasterror = 0
  638.         $aresult = DllCall("user32.dll", "bool", "EmptyClipboard")
  639.         If @error OR NOT $aresult[0] Then
  640.                 $ierror = 2
  641.                 $ilasterror = _winapi_getlasterror()
  642.         Else
  643.                 $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $gmem_moveable, "ulong_ptr", $nglobmemsize)
  644.                 If @error OR NOT $aresult[0] Then
  645.                         $ierror = 3
  646.                         $ilasterror = _winapi_getlasterror()
  647.                 Else
  648.                         Local $hglobal = $aresult[0]
  649.                         $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hglobal)
  650.                         If @error OR NOT $aresult[0] Then
  651.                                 $ierror = 4
  652.                                 $ilasterror = _winapi_getlasterror()
  653.                         Else
  654.                                 Local $hlock = $aresult[0]
  655.                                 Local $tdropfiles = DllStructCreate("dword pFiles;" & $tagpoint & ";bool fNC;bool fWide;wchar[" & StringLen($sfile) + 1 & "]", $hlock)
  656.                                 If @error Then Return SetError(5, 6, False)
  657.                                 Local $tstruct = DllStructCreate("dword;long;long;bool;bool")
  658.                                 DllStructSetData($tdropfiles, "pFiles", DllStructGetSize($tstruct))
  659.                                 DllStructSetData($tdropfiles, "X", 0)
  660.                                 DllStructSetData($tdropfiles, "Y", 0)
  661.                                 DllStructSetData($tdropfiles, "fNC", 0)
  662.                                 DllStructSetData($tdropfiles, "fWide", 1)
  663.                                 DllStructSetData($tdropfiles, 6, $sfile)
  664.                                 For $i = 1 To StringLen($sfile)
  665.                                         If DllStructGetData($tdropfiles, 6, $i) = $sseparator Then DllStructSetData($tdropfiles, 6, Chr(0), $i)
  666.                                 Next
  667.                                 $aresult = DllCall("user32.dll", "handle", "SetClipboardData", "uint", $cf_hdrop, "handle", $hglobal)
  668.                                 If @error OR NOT $aresult[0] Then
  669.                                         $ierror = 6
  670.                                         $ilasterror = _winapi_getlasterror()
  671.                                 EndIf
  672.                                 $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hglobal)
  673.                                 If (@error OR NOT $aresult[0]) AND NOT $ierror AND _winapi_getlasterror() Then
  674.                                         $ierror = 8
  675.                                         $ilasterror = _winapi_getlasterror()
  676.                                 EndIf
  677.                         EndIf
  678.                         $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hglobal)
  679.                         If (@error OR $aresult[0]) AND NOT $ierror Then
  680.                                 $ierror = 9
  681.                                 $ilasterror = _winapi_getlasterror()
  682.                         EndIf
  683.                 EndIf
  684.         EndIf
  685.         $aresult = DllCall("user32.dll", "bool", "CloseClipboard")
  686.         If (@error OR NOT $aresult[0]) AND NOT $ierror Then Return SetError(7, _winapi_getlasterror(), False)
  687.         If $ierror Then Return SetError($ierror, $ilasterror, False)
  688.         Return True
  689.  
  690. Func _mousetrap($ileft = 0, $itop = 0, $iright = 0, $ibottom = 0)
  691.         Local $areturn = 0
  692.         If $ileft = Default Then $ileft = 0
  693.         If $itop = Default Then $itop = 0
  694.         If $iright = Default Then $iright = 0
  695.         If $ibottom = Default Then $ibottom = 0
  696.         If @NumParams = 0 Then
  697.                 $areturn = DllCall("user32.dll", "bool", "ClipCursor", "ptr", 0)
  698.                 If @error OR NOT $areturn[0] Then Return SetError(1, _winapi_getlasterror(), False)
  699.         Else
  700.                 If @NumParams = 2 Then
  701.                         $iright = $ileft + 1
  702.                         $ibottom = $itop + 1
  703.                 EndIf
  704.                 Local $trect = DllStructCreate($tagrect)
  705.                 DllStructSetData($trect, "Left", $ileft)
  706.                 DllStructSetData($trect, "Top", $itop)
  707.                 DllStructSetData($trect, "Right", $iright)
  708.                 DllStructSetData($trect, "Bottom", $ibottom)
  709.                 $areturn = DllCall("user32.dll", "bool", "ClipCursor", "struct*", $trect)
  710.                 If @error OR NOT $areturn[0] Then Return SetError(2, _winapi_getlasterror(), False)
  711.         EndIf
  712.         Return True
  713.  
  714. Func _singleton($soccurencename, $iflag = 0)
  715.         Local Const $error_already_exists = 183
  716.         Local Const $security_descriptor_revision = 1
  717.         Local $tsecurityattributes = 0
  718.         If BitAND($iflag, 2) Then
  719.                 Local $tsecuritydescriptor = DllStructCreate("byte;byte;word;ptr[4]")
  720.                 Local $aret = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "struct*", $tsecuritydescriptor, "dword", $security_descriptor_revision)
  721.                 If @error Then Return SetError(@error, @extended, 0)
  722.                 If $aret[0] Then
  723.                         $aret = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "struct*", $tsecuritydescriptor, "bool", 1, "ptr", 0, "bool", 0)
  724.                         If @error Then Return SetError(@error, @extended, 0)
  725.                         If $aret[0] Then
  726.                                 $tsecurityattributes = DllStructCreate($tagsecurity_attributes)
  727.                                 DllStructSetData($tsecurityattributes, 1, DllStructGetSize($tsecurityattributes))
  728.                                 DllStructSetData($tsecurityattributes, 2, DllStructGetPtr($tsecuritydescriptor))
  729.                                 DllStructSetData($tsecurityattributes, 3, 0)
  730.                         EndIf
  731.                 EndIf
  732.         EndIf
  733.         Local $ahandle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", $tsecurityattributes, "bool", 1, "wstr", $soccurencename)
  734.         Local $alasterror = DllCall("kernel32.dll", "dword", "GetLastError")
  735.         If $alasterror[0] = $error_already_exists Then
  736.                 If BitAND($iflag, 1) Then
  737.                         DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $ahandle[0])
  738.                         If @error Then Return SetError(@error, @extended, 0)
  739.                         Return SetError($alasterror[0], $alasterror[0], 0)
  740.                 Else
  741.                         Exit -1
  742.                 EndIf
  743.         EndIf
  744.         Return $ahandle[0]
  745.  
  746. Func _ispressed($shexkey, $vdll = "user32.dll")
  747.         Local $a_r = DllCall($vdll, "short", "GetAsyncKeyState", "int", "0x" & $shexkey)
  748.         Return BitAND($a_r[0], 32768) <> 0
  749.  
  750. Func _versioncompare($sversion1, $sversion2)
  751.         If $sversion1 = $sversion2 Then Return 0
  752.         Local $aversion1 = StringSplit($sversion1, ".,"), $aversion2 = StringSplit($sversion2, ".,")
  753.         If UBound($aversion1) <> UBound($aversion2) OR UBound($aversion1) = 0 Then
  754.                 If $sversion1 > $sversion2 Then
  755.                         Return SetExtended(1, 1)
  756.                 ElseIf $sversion1 < $sversion2 Then
  757.                         Return SetExtended(1, -1)
  758.                 EndIf
  759.         Else
  760.                 For $i = 1 To UBound($aversion1) - 1
  761.                         If StringIsDigit($aversion1[$i]) AND StringIsDigit($aversion2[$i]) Then
  762.                                 If Number($aversion1[$i]) > Number($aversion2[$i]) Then
  763.                                         Return SetExtended(2, 1)
  764.                                 ElseIf Number($aversion1[$i]) < Number($aversion2[$i]) Then
  765.                                         Return SetExtended(2, -1)
  766.                                 EndIf
  767.                         Else
  768.                                 If $aversion1[$i] > $aversion2[$i] Then
  769.                                         Return SetExtended(1, 1)
  770.                                 ElseIf $aversion1[$i] < $aversion2[$i] Then
  771.                                         Return SetExtended(1, -1)
  772.                                 EndIf
  773.                         EndIf
  774.                 Next
  775.         EndIf
  776.         Return SetError(2, 0, 0)
  777.  
  778. Func __misc_getdc($hwnd)
  779.         Local $aresult = DllCall("User32.dll", "handle", "GetDC", "hwnd", $hwnd)
  780.         If @error OR NOT $aresult[0] Then Return SetError(1, _winapi_getlasterror(), 0)
  781.         Return $aresult[0]
  782.  
  783. Func __misc_getdevicecaps($hdc, $iindex)
  784.         Local $aresult = DllCall("GDI32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  785.         Return $aresult[0]
  786.  
  787. Func __misc_releasedc($hwnd, $hdc)
  788.         Local $aresult = DllCall("User32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  789.         Return $aresult[0] <> 0
  790.  
  791. Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege"
  792. Global Const $se_audit_name = "SeAuditPrivilege"
  793. Global Const $se_backup_name = "SeBackupPrivilege"
  794. Global Const $se_change_notify_name = "SeChangeNotifyPrivilege"
  795. Global Const $se_create_global_name = "SeCreateGlobalPrivilege"
  796. Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege"
  797. Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege"
  798. Global Const $se_create_symbolic_link_name = "SeCreateSymbolicLinkPrivilege"
  799. Global Const $se_create_token_name = "SeCreateTokenPrivilege"
  800. Global Const $se_debug_name = "SeDebugPrivilege"
  801. Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege"
  802. Global Const $se_impersonate_name = "SeImpersonatePrivilege"
  803. Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege"
  804. Global Const $se_inc_working_set_name = "SeIncreaseWorkingSetPrivilege"
  805. Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege"
  806. Global Const $se_load_driver_name = "SeLoadDriverPrivilege"
  807. Global Const $se_lock_memory_name = "SeLockMemoryPrivilege"
  808. Global Const $se_machine_account_name = "SeMachineAccountPrivilege"
  809. Global Const $se_manage_volume_name = "SeManageVolumePrivilege"
  810. Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege"
  811. Global Const $se_relabel_name = "SeRelabelPrivilege"
  812. Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege"
  813. Global Const $se_restore_name = "SeRestorePrivilege"
  814. Global Const $se_security_name = "SeSecurityPrivilege"
  815. Global Const $se_shutdown_name = "SeShutdownPrivilege"
  816. Global Const $se_sync_agent_name = "SeSyncAgentPrivilege"
  817. Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege"
  818. Global Const $se_system_profile_name = "SeSystemProfilePrivilege"
  819. Global Const $se_systemtime_name = "SeSystemtimePrivilege"
  820. Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege"
  821. Global Const $se_tcb_name = "SeTcbPrivilege"
  822. Global Const $se_time_zone_name = "SeTimeZonePrivilege"
  823. Global Const $se_trusted_credman_access_name = "SeTrustedCredManAccessPrivilege"
  824. Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege"
  825. Global Const $se_undock_name = "SeUndockPrivilege"
  826. Global Const $se_privilege_enabled_by_default = 1
  827. Global Const $se_privilege_enabled = 2
  828. Global Const $se_privilege_removed = 4
  829. Global Const $se_privilege_used_for_access = -2147483648
  830. Global Const $se_group_mandatory = 1
  831. Global Const $se_group_enabled_by_default = 2
  832. Global Const $se_group_enabled = 4
  833. Global Const $se_group_owner = 8
  834. Global Const $se_group_use_for_deny_only = 16
  835. Global Const $se_group_integrity = 32
  836. Global Const $se_group_integrity_enabled = 64
  837. Global Const $se_group_resource = 536870912
  838. Global Const $se_group_logon_id = -1073741824
  839. Global Enum $tokenprimary = 1, $tokenimpersonation
  840. Global Enum $securityanonymous = 0, $securityidentification, $securityimpersonation, $securitydelegation
  841. Global Enum $tokenuser = 1, $tokengroups, $tokenprivileges, $tokenowner, $tokenprimarygroup, $tokendefaultdacl, $tokensource, $tokentype, $tokenimpersonationlevel, $tokenstatistics, $tokenrestrictedsids, $tokensessionid, $tokengroupsandprivileges, $tokensessionreference, $tokensandboxinert, $tokenauditpolicy, $tokenorigin, $tokenelevationtype, $tokenlinkedtoken, $tokenelevation, $tokenhasrestrictions, $tokenaccessinformation, $tokenvirtualizationallowed, $tokenvirtualizationenabled, $tokenintegritylevel, $tokenuiaccess, $tokenmandatorypolicy, $tokenlogonsid
  842. Global Const $token_assign_primary = 1
  843. Global Const $token_duplicate = 2
  844. Global Const $token_impersonate = 4
  845. Global Const $token_query = 8
  846. Global Const $token_query_source = 16
  847. Global Const $token_adjust_privileges = 32
  848. Global Const $token_adjust_groups = 64
  849. Global Const $token_adjust_default = 128
  850. Global Const $token_adjust_sessionid = 256
  851. Global Const $token_all_access = 983551
  852. Global Const $token_read = 131080
  853. Global Const $token_write = 131296
  854. Global Const $token_execute = 131072
  855. Global Const $token_has_traverse_privilege = 1
  856. Global Const $token_has_backup_privilege = 2
  857. Global Const $token_has_restore_privilege = 4
  858. Global Const $token_has_admin_group = 8
  859. Global Const $token_is_restricted = 16
  860. Global Const $token_session_not_referenced = 32
  861. Global Const $token_sandbox_inert = 64
  862. Global Const $token_has_impersonate_privilege = 128
  863. Global Const $rights_delete = 65536
  864. Global Const $read_control = 131072
  865. Global Const $write_dac = 262144
  866. Global Const $write_owner = 524288
  867. Global Const $synchronize = 1048576
  868. Global Const $access_system_security = 16777216
  869. Global Const $standard_rights_required = 983040
  870. Global Const $standard_rights_read = $read_control
  871. Global Const $standard_rights_write = $read_control
  872. Global Const $standard_rights_execute = $read_control
  873. Global Const $standard_rights_all = 2031616
  874. Global Const $specific_rights_all = 65535
  875. Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $set_audit_success, $set_audit_failure
  876. Global Enum $trustee_is_unknown = 0, $trustee_is_user, $trustee_is_group, $trustee_is_domain, $trustee_is_alias, $trustee_is_well_known_group, $trustee_is_deleted, $trustee_is_invalid, $trustee_is_computer
  877. Global Const $logon_with_profile = 1
  878. Global Const $logon_netcredentials_only = 2
  879. Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypewellknowngroup, $sidtypedeletedaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel
  880. Global Const $sid_administrators = "S-1-5-32-544"
  881. Global Const $sid_users = "S-1-5-32-545"
  882. Global Const $sid_guests = "S-1-5-32-546"
  883. Global Const $sid_account_operators = "S-1-5-32-548"
  884. Global Const $sid_server_operators = "S-1-5-32-549"
  885. Global Const $sid_print_operators = "S-1-5-32-550"
  886. Global Const $sid_backup_operators = "S-1-5-32-551"
  887. Global Const $sid_replicator = "S-1-5-32-552"
  888. Global Const $sid_owner = "S-1-3-0"
  889. Global Const $sid_everyone = "S-1-1-0"
  890. Global Const $sid_network = "S-1-5-2"
  891. Global Const $sid_interactive = "S-1-5-4"
  892. Global Const $sid_system = "S-1-5-18"
  893. Global Const $sid_authenticated_users = "S-1-5-11"
  894. Global Const $sid_schannel_authentication = "S-1-5-64-14"
  895. Global Const $sid_digest_authentication = "S-1-5-64-21"
  896. Global Const $sid_nt_service = "S-1-5-80"
  897. Global Const $sid_untrusted_mandatory_level = "S-1-16-0"
  898. Global Const $sid_low_mandatory_level = "S-1-16-4096"
  899. Global Const $sid_medium_mandatory_level = "S-1-16-8192"
  900. Global Const $sid_medium_plus_mandatory_level = "S-1-16-8448"
  901. Global Const $sid_high_mandatory_level = "S-1-16-12288"
  902. Global Const $sid_system_mandatory_level = "S-1-16-16384"
  903. Global Const $sid_protected_process_mandatory_level = "S-1-16-20480"
  904. Global Const $sid_secure_process_mandatory_level = "S-1-16-28672"
  905. Global Const $sid_all_services = "S-1-5-80-0"
  906.  
  907. Func _security__adjusttokenprivileges($htoken, $bdisableall, $pnewstate, $ibufferlen, $pprevstate = 0, $prequired = 0)
  908.         Local $acall = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $bdisableall, "struct*", $pnewstate, "dword", $ibufferlen, "struct*", $pprevstate, "struct*", $prequired)
  909.         Return NOT ($acall[0] = 0)
  910.  
  911. Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocess_information)
  912.         Local $acall = DllCall("advapi32.dll", "bool", "CreateProcessWithTokenW", "handle", $htoken, "dword", $ilogonflags, "ptr", 0, "wstr", $scommandline, "dword", $icreationflags, "struct*", 0, "wstr", $scurdir, "struct*", $tstartupinfo, "struct*", $tprocess_information)
  913.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  914.         Return True
  915.  
  916. Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpersonationlevel, $itokentype)
  917.         Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpersonationlevel, "int", $itokentype, "handle*", 0)
  918.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  919.         Return $acall[6]
  920.  
  921. Func _security__getaccountsid($saccount, $ssystem = "")
  922.         Local $aacct = _security__lookupaccountname($saccount, $ssystem)
  923.         If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0])
  924.         Return ""
  925.  
  926. Func _security__getlengthsid($psid)
  927.         If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  928.         Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid)
  929.         Return $acall[0]
  930.  
  931. Func _security__gettokeninformation($htoken, $iclass)
  932.         Local $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0)
  933.         If @error OR NOT $acall[5] Then Return SetError(@error + 10, @extended, 0)
  934.         Local $ilen = $acall[5]
  935.         Local $tbuffer = DllStructCreate("byte[" & $ilen & "]")
  936.         $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0)
  937.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  938.         Return $tbuffer
  939.  
  940. Func _security__impersonateself($ilevel = $securityimpersonation)
  941.         Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
  942.         Return NOT ($acall[0] = 0)
  943.  
  944. Func _security__isvalidsid($psid)
  945.         Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid)
  946.         Return NOT ($acall[0] = 0)
  947.  
  948. Func _security__lookupaccountname($saccount, $ssystem = "")
  949.         Local $tdata = DllStructCreate("byte SID[256]")
  950.         Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0)
  951.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  952.         Local $aacct[3]
  953.         $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID"))
  954.         $aacct[1] = $acall[5]
  955.         $aacct[2] = $acall[7]
  956.         Return $aacct
  957.  
  958. Func _security__lookupaccountsid($vsid, $ssystem = "")
  959.         Local $psid, $aacct[3]
  960.         If IsString($vsid) Then
  961.                 $psid = _security__stringsidtosid($vsid)
  962.         Else
  963.                 $psid = $vsid
  964.         EndIf
  965.         If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  966.         Local $stypesystem = "ptr"
  967.         If $ssystem Then $stypesystem = "wstr"
  968.         Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountSidW", $stypesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0)
  969.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  970.         Local $aacct[3]
  971.         $aacct[0] = $acall[3]
  972.         $aacct[1] = $acall[5]
  973.         $aacct[2] = $acall[7]
  974.         Return $aacct
  975.  
  976. Func _security__lookupprivilegevalue($ssystem, $sname)
  977.         Local $acall = DllCall("advapi32.dll", "bool", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
  978.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  979.         Return $acall[3]
  980.  
  981. Func _security__openprocesstoken($hprocess, $iaccess)
  982.         Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0)
  983.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  984.         Return $acall[3]
  985.  
  986. Func _security__openthreadtoken($iaccess, $hthread = 0, $bopenasself = False)
  987.         If $hthread = 0 Then
  988.                 Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  989.                 If @error Then Return SetError(@error + 10, @extended, 0)
  990.                 $hthread = $aresult[0]
  991.         EndIf
  992.         Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $bopenasself, "handle*", 0)
  993.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  994.         Return $acall[4]
  995.  
  996. Func _security__openthreadtokenex($iaccess, $hthread = 0, $bopenasself = False)
  997.         Local $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  998.         If $htoken = 0 Then
  999.                 Local Const $error_no_token = 1008
  1000.                 If _winapi_getlasterror() <> $error_no_token Then Return SetError(20, _winapi_getlasterror(), 0)
  1001.                 If NOT _security__impersonateself() Then Return SetError(@error + 10, _winapi_getlasterror(), 0)
  1002.                 $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  1003.                 If $htoken = 0 Then Return SetError(@error, _winapi_getlasterror(), 0)
  1004.         EndIf
  1005.         Return $htoken
  1006.  
  1007. Func _security__setprivilege($htoken, $sprivilege, $benable)
  1008.         Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
  1009.         If $iluid = 0 Then Return SetError(@error + 10, @extended, False)
  1010.         Local Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  1011.         Local $tcurrstate = DllStructCreate($tagtoken_privileges)
  1012.         Local $icurrstate = DllStructGetSize($tcurrstate)
  1013.         Local $tprevstate = DllStructCreate($tagtoken_privileges)
  1014.         Local $iprevstate = DllStructGetSize($tprevstate)
  1015.         Local $trequired = DllStructCreate("int Data")
  1016.         DllStructSetData($tcurrstate, "Count", 1)
  1017.         DllStructSetData($tcurrstate, "LUID", $iluid)
  1018.         If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False)
  1019.         DllStructSetData($tprevstate, "Count", 1)
  1020.         DllStructSetData($tprevstate, "LUID", $iluid)
  1021.         Local $iattributes = DllStructGetData($tprevstate, "Attributes")
  1022.         If $benable Then
  1023.                 $iattributes = BitOR($iattributes, $se_privilege_enabled)
  1024.         Else
  1025.                 $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled))
  1026.         EndIf
  1027.         DllStructSetData($tprevstate, "Attributes", $iattributes)
  1028.         If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False)
  1029.         Return True
  1030.  
  1031. Func _security__settokeninformation($htoken, $itokeninformation, $vtokeninformation, $itokeninformationlength)
  1032.         Local $acall = DllCall("advapi32.dll", "bool", "SetTokenInformation", "handle", $htoken, "int", $itokeninformation, "struct*", $vtokeninformation, "dword", $itokeninformationlength)
  1033.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  1034.         Return True
  1035.  
  1036. Func _security__sidtostringsid($psid)
  1037.         If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, 0, "")
  1038.         Local $acall = DllCall("advapi32.dll", "bool", "ConvertSidToStringSidW", "struct*", $psid, "ptr*", 0)
  1039.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, "")
  1040.         Local $pstringsid = $acall[2]
  1041.         Local $alen = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $pstringsid)
  1042.         Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & $alen[0] + 1 & "]", $pstringsid), "Text")
  1043.         DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pstringsid)
  1044.         Return $ssid
  1045.  
  1046. Func _security__sidtypestr($itype)
  1047.         Switch $itype
  1048.                 Case $sidtypeuser
  1049.                         Return "User"
  1050.                 Case $sidtypegroup
  1051.                         Return "Group"
  1052.                 Case $sidtypedomain
  1053.                         Return "Domain"
  1054.                 Case $sidtypealias
  1055.                         Return "Alias"
  1056.                 Case $sidtypewellknowngroup
  1057.                         Return "Well Known Group"
  1058.                 Case $sidtypedeletedaccount
  1059.                         Return "Deleted Account"
  1060.                 Case $sidtypeinvalid
  1061.                         Return "Invalid"
  1062.                 Case $sidtypeunknown
  1063.                         Return "Unknown Type"
  1064.                 Case $sidtypecomputer
  1065.                         Return "Computer"
  1066.                 Case $sidtypelabel
  1067.                         Return "A mandatory integrity label SID"
  1068.                 Case Else
  1069.                         Return "Unknown SID Type"
  1070.         EndSwitch
  1071.  
  1072. Func _security__stringsidtosid($ssid)
  1073.         Local $acall = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
  1074.         If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1075.         Local $psid = $acall[2]
  1076.         Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid)
  1077.         Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]")
  1078.         DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
  1079.         DllCall("kernel32.dll", "handle", "LocalFree", "handle", $psid)
  1080.         Return $tsid
  1081.  
  1082. Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  1083.         Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  1084.         If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  1085.         Return $aresult
  1086.  
  1087. Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  1088.         Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  1089.         If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  1090.         Return $aresult
  1091.  
  1092. Global Const $hgdi_error = Ptr(-1)
  1093. Global Const $invalid_handle_value = Ptr(-1)
  1094. Global Const $clr_invalid = -1
  1095. Global Const $null_brush = 5
  1096. Global Const $null_pen = 8
  1097. Global Const $black_brush = 4
  1098. Global Const $dkgray_brush = 3
  1099. Global Const $dc_brush = 18
  1100. Global Const $gray_brush = 2
  1101. Global Const $hollow_brush = $null_brush
  1102. Global Const $ltgray_brush = 1
  1103. Global Const $white_brush = 0
  1104. Global Const $black_pen = 7
  1105. Global Const $dc_pen = 19
  1106. Global Const $white_pen = 6
  1107. Global Const $ansi_fixed_font = 11
  1108. Global Const $ansi_var_font = 12
  1109. Global Const $device_default_font = 14
  1110. Global Const $default_gui_font = 17
  1111. Global Const $oem_fixed_font = 10
  1112. Global Const $system_font = 13
  1113. Global Const $system_fixed_font = 16
  1114. Global Const $default_palette = 15
  1115. Global Const $mb_precomposed = 1
  1116. Global Const $mb_composite = 2
  1117. Global Const $mb_useglyphchars = 4
  1118. Global Const $ulw_alpha = 2
  1119. Global Const $ulw_colorkey = 1
  1120. Global Const $ulw_opaque = 4
  1121. Global Const $ulw_ex_noresize = 8
  1122. Global Const $wh_callwndproc = 4
  1123. Global Const $wh_callwndprocret = 12
  1124. Global Const $wh_cbt = 5
  1125. Global Const $wh_debug = 9
  1126. Global Const $wh_foregroundidle = 11
  1127. Global Const $wh_getmessage = 3
  1128. Global Const $wh_journalplayback = 1
  1129. Global Const $wh_journalrecord = 0
  1130. Global Const $wh_keyboard = 2
  1131. Global Const $wh_keyboard_ll = 13
  1132. Global Const $wh_mouse = 7
  1133. Global Const $wh_mouse_ll = 14
  1134. Global Const $wh_msgfilter = -1
  1135. Global Const $wh_shell = 10
  1136. Global Const $wh_sysmsgfilter = 6
  1137. Global Const $wpf_asyncwindowplacement = 4
  1138. Global Const $wpf_restoretomaximized = 2
  1139. Global Const $wpf_setminposition = 1
  1140. Global Const $kf_extended = 256
  1141. Global Const $kf_altdown = 8192
  1142. Global Const $kf_up = 32768
  1143. Global Const $llkhf_extended = BitShift($kf_extended, 8)
  1144. Global Const $llkhf_injected = 16
  1145. Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
  1146. Global Const $llkhf_up = BitShift($kf_up, 8)
  1147. Global Const $ofn_allowmultiselect = 512
  1148. Global Const $ofn_createprompt = 8192
  1149. Global Const $ofn_dontaddtorecent = 33554432
  1150. Global Const $ofn_enablehook = 32
  1151. Global Const $ofn_enableincludenotify = 4194304
  1152. Global Const $ofn_enablesizing = 8388608
  1153. Global Const $ofn_enabletemplate = 64
  1154. Global Const $ofn_enabletemplatehandle = 128
  1155. Global Const $ofn_explorer = 524288
  1156. Global Const $ofn_extensiondifferent = 1024
  1157. Global Const $ofn_filemustexist = 4096
  1158. Global Const $ofn_forceshowhidden = 268435456
  1159. Global Const $ofn_hidereadonly = 4
  1160. Global Const $ofn_longnames = 2097152
  1161. Global Const $ofn_nochangedir = 8
  1162. Global Const $ofn_nodereferencelinks = 1048576
  1163. Global Const $ofn_nolongnames = 262144
  1164. Global Const $ofn_nonetworkbutton = 131072
  1165. Global Const $ofn_noreadonlyreturn = 32768
  1166. Global Const $ofn_notestfilecreate = 65536
  1167. Global Const $ofn_novalidate = 256
  1168. Global Const $ofn_overwriteprompt = 2
  1169. Global Const $ofn_pathmustexist = 2048
  1170. Global Const $ofn_readonly = 1
  1171. Global Const $ofn_shareaware = 16384
  1172. Global Const $ofn_showhelp = 16
  1173. Global Const $ofn_ex_noplacesbar = 1
  1174. Global Const $tmpf_fixed_pitch = 1
  1175. Global Const $tmpf_vector = 2
  1176. Global Const $tmpf_truetype = 4
  1177. Global Const $tmpf_device = 8
  1178. Global Const $duplicate_close_source = 1
  1179. Global Const $duplicate_same_access = 2
  1180. Global Const $di_mask = 1
  1181. Global Const $di_image = 2
  1182. Global Const $di_normal = 3
  1183. Global Const $di_compat = 4
  1184. Global Const $di_defaultsize = 8
  1185. Global Const $di_nomirror = 16
  1186. Global Const $display_device_attached_to_desktop = 1
  1187. Global Const $display_device_multi_driver = 2
  1188. Global Const $display_device_primary_device = 4
  1189. Global Const $display_device_mirroring_driver = 8
  1190. Global Const $display_device_vga_compatible = 16
  1191. Global Const $display_device_removable = 32
  1192. Global Const $display_device_disconnect = 33554432
  1193. Global Const $display_device_remote = 67108864
  1194. Global Const $display_device_modespruned = 134217728
  1195. Global Const $flashw_caption = 1
  1196. Global Const $flashw_tray = 2
  1197. Global Const $flashw_timer = 4
  1198. Global Const $flashw_timernofg = 12
  1199. Global Const $format_message_allocate_buffer = 256
  1200. Global Const $format_message_ignore_inserts = 512
  1201. Global Const $format_message_from_string = 1024
  1202. Global Const $format_message_from_hmodule = 2048
  1203. Global Const $format_message_from_system = 4096
  1204. Global Const $format_message_argument_array = 8192
  1205. Global Const $gw_hwndfirst = 0
  1206. Global Const $gw_hwndlast = 1
  1207. Global Const $gw_hwndnext = 2
  1208. Global Const $gw_hwndprev = 3
  1209. Global Const $gw_owner = 4
  1210. Global Const $gw_child = 5
  1211. Global Const $gw_enabledpopup = 6
  1212. Global Const $gwl_wndproc = -4
  1213. Global Const $gwl_hinstance = -6
  1214. Global Const $gwl_hwndparent = -8
  1215. Global Const $gwl_id = -12
  1216. Global Const $gwl_style = -16
  1217. Global Const $gwl_exstyle = -20
  1218. Global Const $gwl_userdata = -21
  1219. Global Const $std_cut = 0
  1220. Global Const $std_copy = 1
  1221. Global Const $std_paste = 2
  1222. Global Const $std_undo = 3
  1223. Global Const $std_redow = 4
  1224. Global Const $std_delete = 5
  1225. Global Const $std_filenew = 6
  1226. Global Const $std_fileopen = 7
  1227. Global Const $std_filesave = 8
  1228. Global Const $std_printpre = 9
  1229. Global Const $std_properties = 10
  1230. Global Const $std_help = 11
  1231. Global Const $std_find = 12
  1232. Global Const $std_replace = 13
  1233. Global Const $std_print = 14
  1234. Global Const $image_bitmap = 0
  1235. Global Const $image_icon = 1
  1236. Global Const $image_cursor = 2
  1237. Global Const $image_enhmetafile = 3
  1238. Global Const $kb_sendspecial = 0
  1239. Global Const $kb_sendraw = 1
  1240. Global Const $kb_capsoff = 0
  1241. Global Const $kb_capson = 1
  1242. Global Const $dont_resolve_dll_references = 1
  1243. Global Const $load_library_as_datafile = 2
  1244. Global Const $load_with_altered_search_path = 8
  1245. Global Const $load_ignore_code_authz_level = 16
  1246. Global Const $load_library_as_datafile_exclusive = 64
  1247. Global Const $load_library_as_image_resource = 32
  1248. Global Const $load_library_search_application_dir = 512
  1249. Global Const $load_library_search_default_dirs = 4096
  1250. Global Const $load_library_search_dll_load_dir = 256
  1251. Global Const $load_library_search_system32 = 2048
  1252. Global Const $load_library_search_user_dirs = 1024
  1253. Global Const $s_ok = 0
  1254. Global Const $e_abort = -2147467260
  1255. Global Const $e_accessdenied = -2147024891
  1256. Global Const $e_fail = -2147467259
  1257. Global Const $e_handle = -2147024890
  1258. Global Const $e_invalidarg = -2147024809
  1259. Global Const $e_nointerface = -2147467262
  1260. Global Const $e_notimpl = -2147467263
  1261. Global Const $e_outofmemory = -2147024882
  1262. Global Const $e_pointer = -2147467261
  1263. Global Const $e_unexpected = -2147418113
  1264. Global Const $lr_defaultcolor = 0
  1265. Global Const $lr_monochrome = 1
  1266. Global Const $lr_color = 2
  1267. Global Const $lr_copyreturnorg = 4
  1268. Global Const $lr_copydeleteorg = 8
  1269. Global Const $lr_loadfromfile = 16
  1270. Global Const $lr_loadtransparent = 32
  1271. Global Const $lr_defaultsize = 64
  1272. Global Const $lr_vgacolor = 128
  1273. Global Const $lr_loadmap3dcolors = 4096
  1274. Global Const $lr_createdibsection = 8192
  1275. Global Const $lr_copyfromresource = 16384
  1276. Global Const $lr_shared = 32768
  1277. Global Const $obm_trtype = 32732
  1278. Global Const $obm_lfarrowi = 32734
  1279. Global Const $obm_rgarrowi = 32735
  1280. Global Const $obm_dnarrowi = 32736
  1281. Global Const $obm_uparrowi = 32737
  1282. Global Const $obm_combo = 32738
  1283. Global Const $obm_mnarrow = 32739
  1284. Global Const $obm_lfarrowd = 32740
  1285. Global Const $obm_rgarrowd = 32741
  1286. Global Const $obm_dnarrowd = 32742
  1287. Global Const $obm_uparrowd = 32743
  1288. Global Const $obm_restored = 32744
  1289. Global Const $obm_zoomd = 32745
  1290. Global Const $obm_reduced = 32746
  1291. Global Const $obm_restore = 32747
  1292. Global Const $obm_zoom = 32748
  1293. Global Const $obm_reduce = 32749
  1294. Global Const $obm_lfarrow = 32750
  1295. Global Const $obm_rgarrow = 32751
  1296. Global Const $obm_dnarrow = 32752
  1297. Global Const $obm_uparrow = 32753
  1298. Global Const $obm_close = 32754
  1299. Global Const $obm_old_restore = 32755
  1300. Global Const $obm_old_zoom = 32756
  1301. Global Const $obm_old_reduce = 32757
  1302. Global Const $obm_btncorners = 32758
  1303. Global Const $obm_checkboxes = 32759
  1304. Global Const $obm_check = 32760
  1305. Global Const $obm_btsize = 32761
  1306. Global Const $obm_old_lfarrow = 32762
  1307. Global Const $obm_old_rgarrow = 32763
  1308. Global Const $obm_old_dnarrow = 32764
  1309. Global Const $obm_old_uparrow = 32765
  1310. Global Const $obm_size = 32766
  1311. Global Const $obm_old_close = 32767
  1312. Global Const $oic_sample = 32512
  1313. Global Const $oic_hand = 32513
  1314. Global Const $oic_ques = 32514
  1315. Global Const $oic_bang = 32515
  1316. Global Const $oic_note = 32516
  1317. Global Const $oic_winlogo = 32517
  1318. Global Const $oic_warning = $oic_bang
  1319. Global Const $oic_error = $oic_hand
  1320. Global Const $oic_information = $oic_note
  1321. Global $__g_ainprocess_winapi[64][2] = [[0, 0]]
  1322. Global $__g_awinlist_winapi[64][2] = [[0, 0]]
  1323. Global Const $__winapiconstant_wm_setfont = 48
  1324. Global Const $__winapiconstant_fw_normal = 400
  1325. Global Const $__winapiconstant_default_charset = 1
  1326. Global Const $__winapiconstant_out_default_precis = 0
  1327. Global Const $__winapiconstant_clip_default_precis = 0
  1328. Global Const $__winapiconstant_default_quality = 0
  1329. Global Const $__winapiconstant_logpixelsx = 88
  1330. Global Const $__winapiconstant_logpixelsy = 90
  1331. Global Const $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint
  1332. Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
  1333. Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
  1334. Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
  1335. Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
  1336.  
  1337. Func _winapi_attachconsole($ipid = -1)
  1338.         Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $ipid)
  1339.         Return $aresult[0]
  1340.  
  1341. Func _winapi_attachthreadinput($iattach, $iattachto, $battach)
  1342.         Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $battach)
  1343.         Return $aresult[0]
  1344.  
  1345. Func _winapi_beep($ifreq = 500, $iduration = 1000)
  1346.         Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
  1347.         Return $aresult[0]
  1348.  
  1349. Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
  1350.         Local $aresult = DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidth, "int", $iheight, "handle", $hsrcdc, "int", $ixsrc, "int", $iysrc, "dword", $irop)
  1351.         Return $aresult[0]
  1352.  
  1353. Func _winapi_callnexthookex($hhk, $icode, $wparam, $lparam)
  1354.         Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $icode, "wparam", $wparam, "lparam", $lparam)
  1355.         Return $aresult[0]
  1356.  
  1357. Func _winapi_callwindowproc($pprevwndfunc, $hwnd, $imsg, $wparam, $lparam)
  1358.         Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $pprevwndfunc, "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  1359.         Return $aresult[0]
  1360.  
  1361. Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
  1362.         Local $aret = DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint)
  1363.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1364.         Return $tpoint
  1365.  
  1366. Func _winapi_closehandle($hobject)
  1367.         Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
  1368.         Return $aresult[0]
  1369.  
  1370. Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
  1371.         Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
  1372.         Return $aresult[0]
  1373.  
  1374. Func _winapi_commdlgextendederror()
  1375.         Local Const $cderr_dialogfailure = 65535
  1376.         Local Const $cderr_findresfailure = 6
  1377.         Local Const $cderr_initialization = 2
  1378.         Local Const $cderr_loadresfailure = 7
  1379.         Local Const $cderr_loadstrfailure = 5
  1380.         Local Const $cderr_lockresfailure = 8
  1381.         Local Const $cderr_memallocfailure = 9
  1382.         Local Const $cderr_memlockfailure = 10
  1383.         Local Const $cderr_nohinstance = 4
  1384.         Local Const $cderr_nohook = 11
  1385.         Local Const $cderr_notemplate = 3
  1386.         Local Const $cderr_registermsgfail = 12
  1387.         Local Const $cderr_structsize = 1
  1388.         Local Const $fnerr_buffertoosmall = 12291
  1389.         Local Const $fnerr_invalidfilename = 12290
  1390.         Local Const $fnerr_subclassfailure = 12289
  1391.         Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
  1392.         If NOT @error Then
  1393.                 Switch $aresult[0]
  1394.                         Case $cderr_dialogfailure
  1395.                                 Return SetError($aresult[0], 0, "The dialog box could not be created." & @LF & "The common dialog box function's call to the DialogBox function failed." & @LF & "For example, this error occurs if the common dialog box call specifies an invalid window handle.")
  1396.                         Case $cderr_findresfailure
  1397.                                 Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.")
  1398.                         Case $cderr_initialization
  1399.                                 Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.")
  1400.                         Case $cderr_loadresfailure
  1401.                                 Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.")
  1402.                         Case $cderr_loadstrfailure
  1403.                                 Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.")
  1404.                         Case $cderr_lockresfailure
  1405.                                 Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.")
  1406.                         Case $cderr_memallocfailure
  1407.                                 Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.")
  1408.                         Case $cderr_memlockfailure
  1409.                                 Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.")
  1410.                         Case $cderr_nohinstance
  1411.                                 Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding instance handle.")
  1412.                         Case $cderr_nohook
  1413.                                 Return SetError($aresult[0], 0, "The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a pointer to a corresponding hook procedure.")
  1414.                         Case $cderr_notemplate
  1415.                                 Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding template.")
  1416.                         Case $cderr_registermsgfail
  1417.                                 Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.")
  1418.                         Case $cderr_structsize
  1419.                                 Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid")
  1420.                         Case $fnerr_buffertoosmall
  1421.                                 Return SetError($aresult[0], 0, "The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user." & @LF & "The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name.")
  1422.                         Case $fnerr_invalidfilename
  1423.                                 Return SetError($aresult[0], 0, "A file name is invalid.")
  1424.                         Case $fnerr_subclassfailure
  1425.                                 Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.")
  1426.                 EndSwitch
  1427.         EndIf
  1428.         Return SetError(@error, @extended, "0x" & Hex($aresult[0]))
  1429.  
  1430. Func _winapi_copyicon($hicon)
  1431.         Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
  1432.         Return $aresult[0]
  1433.  
  1434. Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
  1435.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "ptr", $pbits)
  1436.         Return $aresult[0]
  1437.  
  1438. Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  1439.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
  1440.         Return $aresult[0]
  1441.  
  1442. Func _winapi_createcompatibledc($hdc)
  1443.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
  1444.         Return $aresult[0]
  1445.  
  1446. Func _winapi_createevent($pattributes = 0, $bmanualreset = True, $binitialstate = True, $sname = "")
  1447.         Local $snametype = "wstr"
  1448.         If $sname = "" Then
  1449.                 $sname = 0
  1450.                 $snametype = "ptr"
  1451.         EndIf
  1452.         Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "ptr", $pattributes, "bool", $bmanualreset, "bool", $binitialstate, $snametype, $sname)
  1453.         Return $aresult[0]
  1454.  
  1455. Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $psecurity = 0)
  1456.         Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
  1457.         If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
  1458.         If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
  1459.         If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
  1460.         If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete)
  1461.         If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
  1462.         If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
  1463.         Switch $icreation
  1464.                 Case 0
  1465.                         $icd = $create_new
  1466.                 Case 1
  1467.                         $icd = $create_always
  1468.                 Case 2
  1469.                         $icd = $open_existing
  1470.                 Case 3
  1471.                         $icd = $open_always
  1472.                 Case 4
  1473.                         $icd = $truncate_existing
  1474.         EndSwitch
  1475.         If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive)
  1476.         If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden)
  1477.         If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly)
  1478.         If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system)
  1479.         Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "ptr", $psecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
  1480.         If @error OR ($aresult[0] = $invalid_handle_value) Then Return SetError(@error, @extended, 0)
  1481.         Return $aresult[0]
  1482.  
  1483. Func _winapi_createfont($iheight, $iwidth, $iescape = 0, $iorientn = 0, $iweight = $__winapiconstant_fw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $icharset = $__winapiconstant_default_charset, $ioutputprec = $__winapiconstant_out_default_precis, $iclipprec = $__winapiconstant_clip_default_precis, $iquality = $__winapiconstant_default_quality, $ipitch = 0, $sface = "Arial")
  1484.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $iheight, "int", $iwidth, "int", $iescape, "int", $iorientn, "int", $iweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $icharset, "dword", $ioutputprec, "dword", $iclipprec, "dword", $iquality, "dword", $ipitch, "wstr", $sface)
  1485.         Return $aresult[0]
  1486.  
  1487. Func _winapi_createfontindirect($tlogfont)
  1488.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "struct*", $tlogfont)
  1489.         Return $aresult[0]
  1490.  
  1491. Func _winapi_createpen($ipenstyle, $iwidth, $ncolor)
  1492.         Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "INT", $ncolor)
  1493.         Return $aresult[0]
  1494.  
  1495. Func _winapi_createprocess($sappname, $scommand, $psecurity, $pthread, $binherit, $iflags, $penviron, $sdir, $pstartupinfo, $pprocess)
  1496.         Local $tcommand = 0
  1497.         Local $sappnametype = "wstr", $sdirtype = "wstr"
  1498.         If $sappname = "" Then
  1499.                 $sappnametype = "ptr"
  1500.                 $sappname = 0
  1501.         EndIf
  1502.         If $scommand <> "" Then
  1503.                 $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
  1504.                 DllStructSetData($tcommand, "Text", $scommand)
  1505.         EndIf
  1506.         If $sdir = "" Then
  1507.                 $sdirtype = "ptr"
  1508.                 $sdir = 0
  1509.         EndIf
  1510.         Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "struct*", $tcommand, "ptr", $psecurity, "ptr", $pthread, "bool", $binherit, "dword", $iflags, "ptr", $penviron, $sdirtype, $sdir, "ptr", $pstartupinfo, "ptr", $pprocess)
  1511.         Return $aresult[0]
  1512.  
  1513. Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
  1514.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
  1515.         Return $aresult[0]
  1516.  
  1517. Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
  1518.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
  1519.         Return $aresult[0]
  1520.  
  1521. Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
  1522.         Local $hdc = _winapi_getdc($hwnd)
  1523.         Local $hdestdc = _winapi_createcompatibledc($hdc)
  1524.         Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  1525.         Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
  1526.         Local $trect = DllStructCreate($tagrect)
  1527.         DllStructSetData($trect, 1, 0)
  1528.         DllStructSetData($trect, 2, 0)
  1529.         DllStructSetData($trect, 3, $iwidth)
  1530.         DllStructSetData($trect, 4, $iheight)
  1531.         If $brgb Then
  1532.                 $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  1533.         EndIf
  1534.         Local $hbrush = _winapi_createsolidbrush($icolor)
  1535.         If NOT _winapi_fillrect($hdestdc, $trect, $hbrush) Then
  1536.                 _winapi_deleteobject($hbitmap)
  1537.                 $hbitmap = 0
  1538.         EndIf
  1539.         _winapi_deleteobject($hbrush)
  1540.         _winapi_releasedc($hwnd, $hdc)
  1541.         _winapi_selectobject($hdestdc, $hold)
  1542.         _winapi_deletedc($hdestdc)
  1543.         If NOT $hbitmap Then Return SetError(1, 0, 0)
  1544.         Return $hbitmap
  1545.  
  1546. Func _winapi_createsolidbrush($ncolor)
  1547.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "INT", $ncolor)
  1548.         Return $aresult[0]
  1549.  
  1550. Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
  1551.         If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
  1552.         Local $aresult = DllCall("user32.dll", "hwnd", "CreateWindowExW", "dword", $iexstyle, "wstr", $sclass, "wstr", $sname, "dword", $istyle, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "hwnd", $hparent, "handle", $hmenu, "handle", $hinstance, "ptr", $pparam)
  1553.         Return $aresult[0]
  1554.  
  1555. Func _winapi_defwindowproc($hwnd, $imsg, $iwparam, $ilparam)
  1556.         Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  1557.         Return $aresult[0]
  1558.  
  1559. Func _winapi_deletedc($hdc)
  1560.         Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
  1561.         Return $aresult[0]
  1562.  
  1563. Func _winapi_deleteobject($hobject)
  1564.         Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
  1565.         Return $aresult[0]
  1566.  
  1567. Func _winapi_destroyicon($hicon)
  1568.         Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
  1569.         Return $aresult[0]
  1570.  
  1571. Func _winapi_destroywindow($hwnd)
  1572.         Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
  1573.         Return $aresult[0]
  1574.  
  1575. Func _winapi_drawedge($hdc, $prect, $iedgetype, $iflags)
  1576.         Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "ptr", $prect, "uint", $iedgetype, "uint", $iflags)
  1577.         Return $aresult[0]
  1578.  
  1579. Func _winapi_drawframecontrol($hdc, $prect, $itype, $istate)
  1580.         Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "ptr", $prect, "uint", $itype, "uint", $istate)
  1581.         Return $aresult[0]
  1582.  
  1583. Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
  1584.         Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
  1585.         Return $aresult[0]
  1586.  
  1587. Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
  1588.         Local $ioptions
  1589.         Switch $iflags
  1590.                 Case 1
  1591.                         $ioptions = $di_mask
  1592.                 Case 2
  1593.                         $ioptions = $di_image
  1594.                 Case 3
  1595.                         $ioptions = $di_normal
  1596.                 Case 4
  1597.                         $ioptions = $di_compat
  1598.                 Case 5
  1599.                         $ioptions = $di_defaultsize
  1600.                 Case Else
  1601.                         $ioptions = $di_nomirror
  1602.         EndSwitch
  1603.         Local $aresult = DllCall("user32.dll", "bool", "DrawIconEx", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon, "int", $iwidth, "int", $iheight, "uint", $istep, "handle", $hbrush, "uint", $ioptions)
  1604.         Return $aresult[0]
  1605.  
  1606. Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
  1607.         _winapi_moveto($hdc, $ix1, $iy1)
  1608.         _winapi_lineto($hdc, $ix2, $iy2)
  1609.         Return True
  1610.  
  1611. Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
  1612.         Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags)
  1613.         Return $aresult[0]
  1614.  
  1615. Func _winapi_duplicatehandle($hsourceprocesshandle, $hsourcehandle, $htargetprocesshandle, $idesiredaccess, $binherithandle, $ioptions)
  1616.         Local $aresult = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsourceprocesshandle, "handle", $hsourcehandle, "handle", $htargetprocesshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $binherithandle, "dword", $ioptions)
  1617.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  1618.         Return $aresult[4]
  1619.  
  1620. Func _winapi_enablewindow($hwnd, $benable = True)
  1621.         Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $benable)
  1622.         Return $aresult[0]
  1623.  
  1624. Func _winapi_enumdisplaydevices($sdevice, $idevnum)
  1625.         Local $tname = 0, $iflags = 0, $adevice[5]
  1626.         If $sdevice <> "" Then
  1627.                 $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
  1628.                 DllStructSetData($tname, "Text", $sdevice)
  1629.         EndIf
  1630.         Local $tdevice = DllStructCreate($tagdisplay_device)
  1631.         Local $idevice = DllStructGetSize($tdevice)
  1632.         DllStructSetData($tdevice, "Size", $idevice)
  1633.         Local $aret = DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1)
  1634.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1635.         Local $in = DllStructGetData($tdevice, "Flags")
  1636.         If BitAND($in, $display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
  1637.         If BitAND($in, $display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
  1638.         If BitAND($in, $display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
  1639.         If BitAND($in, $display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
  1640.         If BitAND($in, $display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
  1641.         If BitAND($in, $display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32)
  1642.         $adevice[0] = True
  1643.         $adevice[1] = DllStructGetData($tdevice, "Name")
  1644.         $adevice[2] = DllStructGetData($tdevice, "String")
  1645.         $adevice[3] = $iflags
  1646.         $adevice[4] = DllStructGetData($tdevice, "ID")
  1647.         Return $adevice
  1648.  
  1649. Func _winapi_enumwindows($bvisible = True, $hwnd = Default)
  1650.         __winapi_enumwindowsinit()
  1651.         If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
  1652.         __winapi_enumwindowschild($hwnd, $bvisible)
  1653.         Return $__g_awinlist_winapi
  1654.  
  1655. Func __winapi_enumwindowsadd($hwnd, $sclass = "")
  1656.         If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
  1657.         $__g_awinlist_winapi[0][0] += 1
  1658.         Local $icount = $__g_awinlist_winapi[0][0]
  1659.         If $icount >= $__g_awinlist_winapi[0][1] Then
  1660.                 ReDim $__g_awinlist_winapi[$icount + 64][2]
  1661.                 $__g_awinlist_winapi[0][1] += 64
  1662.         EndIf
  1663.         $__g_awinlist_winapi[$icount][0] = $hwnd
  1664.         $__g_awinlist_winapi[$icount][1] = $sclass
  1665.  
  1666. Func __winapi_enumwindowschild($hwnd, $bvisible = True)
  1667.         $hwnd = _winapi_getwindow($hwnd, $gw_child)
  1668.         While $hwnd <> 0
  1669.                 If (NOT $bvisible) OR _winapi_iswindowvisible($hwnd) Then
  1670.                         __winapi_enumwindowsadd($hwnd)
  1671.                         __winapi_enumwindowschild($hwnd, $bvisible)
  1672.                 EndIf
  1673.                 $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  1674.         WEnd
  1675.  
  1676. Func __winapi_enumwindowsinit()
  1677.         ReDim $__g_awinlist_winapi[64][2]
  1678.         $__g_awinlist_winapi[0][0] = 0
  1679.         $__g_awinlist_winapi[0][1] = 64
  1680.  
  1681. Func _winapi_enumwindowspopup()
  1682.         __winapi_enumwindowsinit()
  1683.         Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  1684.         Local $sclass
  1685.         While $hwnd <> 0
  1686.                 If _winapi_iswindowvisible($hwnd) Then
  1687.                         $sclass = _winapi_getclassname($hwnd)
  1688.                         If $sclass = "#32768" Then
  1689.                                 __winapi_enumwindowsadd($hwnd)
  1690.                         ElseIf $sclass = "ToolbarWindow32" Then
  1691.                                 __winapi_enumwindowsadd($hwnd)
  1692.                         ElseIf $sclass = "ToolTips_Class32" Then
  1693.                                 __winapi_enumwindowsadd($hwnd)
  1694.                         ElseIf $sclass = "BaseBar" Then
  1695.                                 __winapi_enumwindowschild($hwnd)
  1696.                         EndIf
  1697.                 EndIf
  1698.                 $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  1699.         WEnd
  1700.         Return $__g_awinlist_winapi
  1701.  
  1702. Func _winapi_enumwindowstop()
  1703.         __winapi_enumwindowsinit()
  1704.         Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  1705.         While $hwnd <> 0
  1706.                 If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
  1707.                 $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  1708.         WEnd
  1709.         Return $__g_awinlist_winapi
  1710.  
  1711. Func _winapi_expandenvironmentstrings($sstring)
  1712.         Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
  1713.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  1714.         Return $aresult[2]
  1715.  
  1716. Func _winapi_extracticonex($sfile, $iindex, $plarge, $psmall, $iicons)
  1717.         Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfile, "int", $iindex, "struct*", $plarge, "struct*", $psmall, "uint", $iicons)
  1718.         Return $aresult[0]
  1719.  
  1720. Func _winapi_fatalappexit($smessage)
  1721.         DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
  1722.  
  1723. Func _winapi_fillrect($hdc, $prect, $hbrush)
  1724.         Local $aresult
  1725.         If IsPtr($hbrush) Then
  1726.                 $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $prect, "handle", $hbrush)
  1727.         Else
  1728.                 $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $prect, "dword_ptr", $hbrush)
  1729.         EndIf
  1730.         Return $aresult[0]
  1731.  
  1732. Func _winapi_findexecutable($sfilename, $sdirectory = "")
  1733.         Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
  1734.         If $aresult[0] <= 32 Then Return SetError(10, $aresult[0], "")
  1735.         Return SetExtended($aresult[0], $aresult[3])
  1736.  
  1737. Func _winapi_findwindow($sclassname, $swindowname)
  1738.         Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
  1739.         Return $aresult[0]
  1740.  
  1741. Func _winapi_flashwindow($hwnd, $binvert = True)
  1742.         Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $binvert)
  1743.         Return $aresult[0]
  1744.  
  1745. Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
  1746.         Local $tflash = DllStructCreate($tagflashwinfo)
  1747.         Local $iflash = DllStructGetSize($tflash)
  1748.         Local $imode = 0
  1749.         If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $flashw_caption)
  1750.         If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $flashw_tray)
  1751.         If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $flashw_timer)
  1752.         If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $flashw_timernofg)
  1753.         DllStructSetData($tflash, "Size", $iflash)
  1754.         DllStructSetData($tflash, "hWnd", $hwnd)
  1755.         DllStructSetData($tflash, "Flags", $imode)
  1756.         DllStructSetData($tflash, "Count", $icount)
  1757.         DllStructSetData($tflash, "Timeout", $itimeout)
  1758.         Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash)
  1759.         Return $aresult[0]
  1760.  
  1761. Func _winapi_floattoint($nfloat)
  1762.         Local $tfloat = DllStructCreate("float")
  1763.         Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  1764.         DllStructSetData($tfloat, 1, $nfloat)
  1765.         Return DllStructGetData($tint, 1)
  1766.  
  1767. Func _winapi_flushfilebuffers($hfile)
  1768.         Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
  1769.         Return $aresult[0]
  1770.  
  1771. Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
  1772.         Local $sbuffertype = "struct*"
  1773.         If IsString($pbuffer) Then $sbuffertype = "wstr"
  1774.         Local $aresult = DllCall("Kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "ptr", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
  1775.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  1776.         If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
  1777.         Return $aresult[0]
  1778.  
  1779. Func _winapi_framerect($hdc, $prect, $hbrush)
  1780.         Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "ptr", $prect, "handle", $hbrush)
  1781.         Return $aresult[0]
  1782.  
  1783. Func _winapi_freelibrary($hmodule)
  1784.         Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  1785.         Return $aresult[0]
  1786.  
  1787. Func _winapi_getancestor($hwnd, $iflags = 1)
  1788.         Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
  1789.         Return $aresult[0]
  1790.  
  1791. Func _winapi_getasynckeystate($ikey)
  1792.         Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey)
  1793.         Return $aresult[0]
  1794.  
  1795. Func _winapi_getbkmode($hdc)
  1796.         Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
  1797.         Return $aresult[0]
  1798.  
  1799. Func _winapi_getclassname($hwnd)
  1800.         If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  1801.         Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  1802.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  1803.         Return SetExtended($aresult[0], $aresult[2])
  1804.  
  1805. Func _winapi_getclientheight($hwnd)
  1806.         Local $trect = _winapi_getclientrect($hwnd)
  1807.         Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  1808.  
  1809. Func _winapi_getclientwidth($hwnd)
  1810.         Local $trect = _winapi_getclientrect($hwnd)
  1811.         Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  1812.  
  1813. Func _winapi_getclientrect($hwnd)
  1814.         Local $trect = DllStructCreate($tagrect)
  1815.         Local $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  1816.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1817.         Return $trect
  1818.  
  1819. Func _winapi_getcurrentprocess()
  1820.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess")
  1821.         Return $aresult[0]
  1822.  
  1823. Func _winapi_getcurrentprocessid()
  1824.         Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentProcessId")
  1825.         Return $aresult[0]
  1826.  
  1827. Func _winapi_getcurrentthread()
  1828.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  1829.         Return $aresult[0]
  1830.  
  1831. Func _winapi_getcurrentthreadid()
  1832.         Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId")
  1833.         Return $aresult[0]
  1834.  
  1835. Func _winapi_getcursorinfo()
  1836.         Local $tcursor = DllStructCreate($tagcursorinfo)
  1837.         Local $icursor = DllStructGetSize($tcursor)
  1838.         DllStructSetData($tcursor, "Size", $icursor)
  1839.         Local $aret = DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor)
  1840.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1841.         Local $acursor[5]
  1842.         $acursor[0] = True
  1843.         $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
  1844.         $acursor[2] = DllStructGetData($tcursor, "hCursor")
  1845.         $acursor[3] = DllStructGetData($tcursor, "X")
  1846.         $acursor[4] = DllStructGetData($tcursor, "Y")
  1847.         Return $acursor
  1848.  
  1849. Func _winapi_getdc($hwnd)
  1850.         Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  1851.         Return $aresult[0]
  1852.  
  1853. Func _winapi_getdesktopwindow()
  1854.         Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
  1855.         Return $aresult[0]
  1856.  
  1857. Func _winapi_getdevicecaps($hdc, $iindex)
  1858.         Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  1859.         Return $aresult[0]
  1860.  
  1861. Func _winapi_getdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbi, $iusage)
  1862.         Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbi, "uint", $iusage)
  1863.         Return $aresult[0]
  1864.  
  1865. Func _winapi_getdlgctrlid($hwnd)
  1866.         Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
  1867.         Return $aresult[0]
  1868.  
  1869. Func _winapi_getdlgitem($hwnd, $iitemid)
  1870.         Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
  1871.         Return $aresult[0]
  1872.  
  1873. Func _winapi_getfilesizeex($hfile)
  1874.         Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
  1875.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, -1)
  1876.         Return $aresult[2]
  1877.  
  1878. Func _winapi_getfocus()
  1879.         Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
  1880.         Return $aresult[0]
  1881.  
  1882. Func _winapi_getforegroundwindow()
  1883.         Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow")
  1884.         Return $aresult[0]
  1885.  
  1886. Func _winapi_getguiresources($iflag = 0, $hprocess = -1)
  1887.         If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess()
  1888.         Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag)
  1889.         Return $aresult[0]
  1890.  
  1891. Func _winapi_geticoninfo($hicon)
  1892.         Local $tinfo = DllStructCreate($tagiconinfo)
  1893.         Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo)
  1894.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1895.         Local $aicon[6]
  1896.         $aicon[0] = True
  1897.         $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
  1898.         $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
  1899.         $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
  1900.         $aicon[4] = DllStructGetData($tinfo, "hMask")
  1901.         $aicon[5] = DllStructGetData($tinfo, "hColor")
  1902.         Return $aicon
  1903.  
  1904. Func _winapi_getlasterrormessage()
  1905.         Local $ilasterror = _winapi_getlasterror()
  1906.         Local $tbufferptr = DllStructCreate("ptr")
  1907.         Local $ncount = _winapi_formatmessage(BitOR($format_message_allocate_buffer, $format_message_from_system), 0, $ilasterror, 0, $tbufferptr, 0, 0)
  1908.         If @error Then Return SetError(@error, 0, "")
  1909.         Local $stext = ""
  1910.         Local $pbuffer = DllStructGetData($tbufferptr, 1)
  1911.         If $pbuffer Then
  1912.                 If $ncount > 0 Then
  1913.                         Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
  1914.                         $stext = DllStructGetData($tbuffer, 1)
  1915.                 EndIf
  1916.                 _winapi_localfree($pbuffer)
  1917.         EndIf
  1918.         Return $stext
  1919.  
  1920. Func _winapi_getlayeredwindowattributes($hwnd, ByRef $itranscolor, ByRef $itransparency, $bcolorref = False)
  1921.         $itranscolor = -1
  1922.         $itransparency = -1
  1923.         Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "INT*", $itranscolor, "byte*", $itransparency, "dword*", 0)
  1924.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  1925.         If NOT $bcolorref Then
  1926.                 $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1))
  1927.         EndIf
  1928.         $itranscolor = $aresult[2]
  1929.         $itransparency = $aresult[3]
  1930.         Return $aresult[4]
  1931.  
  1932. Func _winapi_getmodulehandle($smodulename)
  1933.         Local $smodulenametype = "wstr"
  1934.         If $smodulename = "" Then
  1935.                 $smodulename = 0
  1936.                 $smodulenametype = "ptr"
  1937.         EndIf
  1938.         Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
  1939.         Return $aresult[0]
  1940.  
  1941. Func _winapi_getmousepos($btoclient = False, $hwnd = 0)
  1942.         Local $imode = Opt("MouseCoordMode", 1)
  1943.         Local $apos = MouseGetPos()
  1944.         Opt("MouseCoordMode", $imode)
  1945.         Local $tpoint = DllStructCreate($tagpoint)
  1946.         DllStructSetData($tpoint, "X", $apos[0])
  1947.         DllStructSetData($tpoint, "Y", $apos[1])
  1948.         If $btoclient AND NOT _winapi_screentoclient($hwnd, $tpoint) Then Return SetError(@error + 20, @extended, 0)
  1949.         Return $tpoint
  1950.  
  1951. Func _winapi_getmouseposx($btoclient = False, $hwnd = 0)
  1952.         Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  1953.         Return DllStructGetData($tpoint, "X")
  1954.  
  1955. Func _winapi_getmouseposy($btoclient = False, $hwnd = 0)
  1956.         Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  1957.         Return DllStructGetData($tpoint, "Y")
  1958.  
  1959. Func _winapi_getobject($hobject, $isize, $pobject)
  1960.         Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "ptr", $pobject)
  1961.         Return $aresult[0]
  1962.  
  1963. Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  1964.         Local $ipathlen = 4096
  1965.         Local $inulls = 0
  1966.         Local $tofn = DllStructCreate($tagopenfilename)
  1967.         Local $afiles[1] = [0]
  1968.         Local $iflag = $iflags
  1969.         Local $asflines = StringSplit($sfilter, "|")
  1970.         Local $asfilter[$asflines[0] * 2 + 1]
  1971.         Local $istart, $ifinal, $tagfilter
  1972.         $asfilter[0] = $asflines[0] * 2
  1973.         For $i = 1 To $asflines[0]
  1974.                 $istart = StringInStr($asflines[$i], "(", 0, 1)
  1975.                 $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  1976.                 $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $str_striptrailing)
  1977.                 $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $str_striptrailing)
  1978.                 $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  1979.         Next
  1980.         Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  1981.         Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  1982.         Local $tfilter = DllStructCreate($tagfilter & "wchar")
  1983.         Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  1984.         Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  1985.         For $i = 1 To $asfilter[0]
  1986.                 DllStructSetData($tfilter, $i, $asfilter[$i])
  1987.         Next
  1988.         DllStructSetData($ttitle, "Title", $stitle)
  1989.         DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  1990.         DllStructSetData($tpath, "Path", $sdefaultfile)
  1991.         DllStructSetData($textn, "Extension", $sdefaultext)
  1992.         DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  1993.         DllStructSetData($tofn, "hwndOwner", $hwndowner)
  1994.         DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  1995.         DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  1996.         DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  1997.         DllStructSetData($tofn, "nMaxFile", $ipathlen)
  1998.         DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  1999.         DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  2000.         DllStructSetData($tofn, "Flags", $iflag)
  2001.         DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  2002.         DllStructSetData($tofn, "FlagsEx", $iflagsex)
  2003.         Local $ares = DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "struct*", $tofn)
  2004.         If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
  2005.         If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
  2006.                 For $x = 1 To $ipathlen
  2007.                         If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
  2008.                                 DllStructSetData($tpath, "Path", "|", $x)
  2009.                                 $inulls += 1
  2010.                         Else
  2011.                                 $inulls = 0
  2012.                         EndIf
  2013.                         If $inulls = 2 Then ExitLoop
  2014.                 Next
  2015.                 DllStructSetData($tpath, "Path", Chr(0), $x - 1)
  2016.                 $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
  2017.                 If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2018.                 Return StringSplit(DllStructGetData($tpath, "Path"), "|")
  2019.         ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then
  2020.                 $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
  2021.                 If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2022.                 Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
  2023.         Else
  2024.                 Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2025.         EndIf
  2026.  
  2027. Func _winapi_getoverlappedresult($hfile, $poverlapped, ByRef $ibytes, $bwait = False)
  2028.         Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "ptr", $poverlapped, "dword*", 0, "bool", $bwait)
  2029.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, False)
  2030.         $ibytes = $aresult[3]
  2031.         Return $aresult[0]
  2032.  
  2033. Func _winapi_getparent($hwnd)
  2034.         Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
  2035.         Return $aresult[0]
  2036.  
  2037. Func _winapi_getprocaddress($hmodule, $vname)
  2038.         Local $stype = "str"
  2039.         If IsNumber($vname) Then $stype = "word"
  2040.         Local $aresult = DllCall("kernel32.dll", "ptr", "GetProcAddress", "handle", $hmodule, $stype, $vname)
  2041.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  2042.         Return $aresult[0]
  2043.  
  2044. Func _winapi_getprocessaffinitymask($hprocess)
  2045.         Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
  2046.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2047.         Local $amask[3]
  2048.         $amask[0] = True
  2049.         $amask[1] = $aresult[2]
  2050.         $amask[2] = $aresult[3]
  2051.         Return $amask
  2052.  
  2053. Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  2054.         Local $ipathlen = 4096
  2055.         Local $tofn = DllStructCreate($tagopenfilename)
  2056.         Local $afiles[1] = [0]
  2057.         Local $iflag = $iflags
  2058.         Local $asflines = StringSplit($sfilter, "|")
  2059.         Local $asfilter[$asflines[0] * 2 + 1]
  2060.         Local $istart, $ifinal, $tagfilter
  2061.         $asfilter[0] = $asflines[0] * 2
  2062.         For $i = 1 To $asflines[0]
  2063.                 $istart = StringInStr($asflines[$i], "(", 0, 1)
  2064.                 $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  2065.                 $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $str_striptrailing)
  2066.                 $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $str_striptrailing)
  2067.                 $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  2068.         Next
  2069.         Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  2070.         Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  2071.         Local $tfilter = DllStructCreate($tagfilter & "wchar")
  2072.         Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  2073.         Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  2074.         For $i = 1 To $asfilter[0]
  2075.                 DllStructSetData($tfilter, $i, $asfilter[$i])
  2076.         Next
  2077.         DllStructSetData($ttitle, "Title", $stitle)
  2078.         DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  2079.         DllStructSetData($tpath, "Path", $sdefaultfile)
  2080.         DllStructSetData($textn, "Extension", $sdefaultext)
  2081.         DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  2082.         DllStructSetData($tofn, "hwndOwner", $hwndowner)
  2083.         DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  2084.         DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  2085.         DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  2086.         DllStructSetData($tofn, "nMaxFile", $ipathlen)
  2087.         DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  2088.         DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  2089.         DllStructSetData($tofn, "Flags", $iflag)
  2090.         DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  2091.         DllStructSetData($tofn, "FlagsEx", $iflagsex)
  2092.         Local $ares = DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "struct*", $tofn)
  2093.         If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
  2094.         Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2095.  
  2096. Func _winapi_getstockobject($iobject)
  2097.         Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
  2098.         Return $aresult[0]
  2099.  
  2100. Func _winapi_getstdhandle($istdhandle)
  2101.         If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
  2102.         Local Const $ahandle[3] = [-10, -11, -12]
  2103.         Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
  2104.         Return $aresult[0]
  2105.  
  2106. Func _winapi_getsyscolor($iindex)
  2107.         Local $aresult = DllCall("user32.dll", "INT", "GetSysColor", "int", $iindex)
  2108.         Return $aresult[0]
  2109.  
  2110. Func _winapi_getsyscolorbrush($iindex)
  2111.         Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
  2112.         Return $aresult[0]
  2113.  
  2114. Func _winapi_getsystemmetrics($iindex)
  2115.         Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
  2116.         Return $aresult[0]
  2117.  
  2118. Func _winapi_gettextextentpoint32($hdc, $stext)
  2119.         Local $tsize = DllStructCreate($tagsize)
  2120.         Local $isize = StringLen($stext)
  2121.         Local $aret = DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize)
  2122.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2123.         Return $tsize
  2124.  
  2125. Func _winapi_gettextmetrics($hdc)
  2126.         Local $ttextmetric = DllStructCreate($tagtextmetric)
  2127.         Local $aret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric)
  2128.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2129.         Return $ttextmetric
  2130.  
  2131. Func _winapi_getwindow($hwnd, $icmd)
  2132.         Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
  2133.         Return $aresult[0]
  2134.  
  2135. Func _winapi_getwindowdc($hwnd)
  2136.         Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
  2137.         Return $aresult[0]
  2138.  
  2139. Func _winapi_getwindowheight($hwnd)
  2140.         Local $trect = _winapi_getwindowrect($hwnd)
  2141.         Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  2142.  
  2143. Func _winapi_getwindowlong($hwnd, $iindex)
  2144.         Local $sfuncname = "GetWindowLongW"
  2145.         If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW"
  2146.         Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
  2147.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2148.         Return $aresult[0]
  2149.  
  2150. Func _winapi_getwindowplacement($hwnd)
  2151.         Local $twindowplacement = DllStructCreate($tagwindowplacement)
  2152.         DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
  2153.         Local $aret = DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  2154.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2155.         Return $twindowplacement
  2156.  
  2157. Func _winapi_getwindowrect($hwnd)
  2158.         Local $trect = DllStructCreate($tagrect)
  2159.         Local $aret = DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect)
  2160.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2161.         Return $trect
  2162.  
  2163. Func _winapi_getwindowrgn($hwnd, $hrgn)
  2164.         Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
  2165.         Return $aresult[0]
  2166.  
  2167. Func _winapi_getwindowtext($hwnd)
  2168.         Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  2169.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2170.         Return SetExtended($aresult[0], $aresult[2])
  2171.  
  2172. Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
  2173.         Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
  2174.         $ipid = $aresult[2]
  2175.         Return $aresult[0]
  2176.  
  2177. Func _winapi_getwindowwidth($hwnd)
  2178.         Local $trect = _winapi_getwindowrect($hwnd)
  2179.         Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  2180.  
  2181. Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
  2182.         $ix = DllStructGetData($tpoint, "X")
  2183.         $iy = DllStructGetData($tpoint, "Y")
  2184.  
  2185. Func _winapi_globalmemorystatus()
  2186.         Local $tmem = DllStructCreate($tagmemorystatusex)
  2187.         DllStructSetData($tmem, 1, DllStructGetSize($tmem))
  2188.         Local $aret = DllCall("kernel32.dll", "bool", "GlobalMemoryStatusEx", "struct*", $tmem)
  2189.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2190.         Local $amem[7]
  2191.         $amem[0] = DllStructGetData($tmem, 2)
  2192.         $amem[1] = DllStructGetData($tmem, 3)
  2193.         $amem[2] = DllStructGetData($tmem, 4)
  2194.         $amem[3] = DllStructGetData($tmem, 5)
  2195.         $amem[4] = DllStructGetData($tmem, 6)
  2196.         $amem[5] = DllStructGetData($tmem, 7)
  2197.         $amem[6] = DllStructGetData($tmem, 8)
  2198.         Return $amem
  2199.  
  2200. Func _winapi_guidfromstring($sguid)
  2201.         Local $tguid = DllStructCreate($tagguid)
  2202.         _winapi_guidfromstringex($sguid, $tguid)
  2203.         If @error Then Return SetError(@error + 10, @extended, 0)
  2204.         Return $tguid
  2205.  
  2206. Func _winapi_guidfromstringex($sguid, $pguid)
  2207.         Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $pguid)
  2208.         Return $aresult[0]
  2209.  
  2210. Func _winapi_hiword($ilong)
  2211.         Return BitShift($ilong, 16)
  2212.  
  2213. Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
  2214.         If $hwnd = $hlastwnd Then Return True
  2215.         For $ii = $__g_ainprocess_winapi[0][0] To 1 Step -1
  2216.                 If $hwnd = $__g_ainprocess_winapi[$ii][0] Then
  2217.                         If $__g_ainprocess_winapi[$ii][1] Then
  2218.                                 $hlastwnd = $hwnd
  2219.                                 Return True
  2220.                         Else
  2221.                                 Return False
  2222.                         EndIf
  2223.                 EndIf
  2224.         Next
  2225.         Local $ipid
  2226.         _winapi_getwindowthreadprocessid($hwnd, $ipid)
  2227.         Local $icount = $__g_ainprocess_winapi[0][0] + 1
  2228.         If $icount >= 64 Then $icount = 1
  2229.         $__g_ainprocess_winapi[0][0] = $icount
  2230.         $__g_ainprocess_winapi[$icount][0] = $hwnd
  2231.         $__g_ainprocess_winapi[$icount][1] = ($ipid = @AutoItPID)
  2232.         Return $__g_ainprocess_winapi[$icount][1]
  2233.  
  2234. Func _winapi_inttofloat($iint)
  2235.         Local $tint = DllStructCreate("int")
  2236.         Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
  2237.         DllStructSetData($tint, 1, $iint)
  2238.         Return DllStructGetData($tfloat, 1)
  2239.  
  2240. Func _winapi_isclassname($hwnd, $sclassname)
  2241.         Local $sseparator = Opt("GUIDataSeparatorChar")
  2242.         Local $aclassname = StringSplit($sclassname, $sseparator)
  2243.         If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  2244.         Local $sclasscheck = _winapi_getclassname($hwnd)
  2245.         For $x = 1 To UBound($aclassname) - 1
  2246.                 If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
  2247.         Next
  2248.         Return False
  2249.  
  2250. Func _winapi_iswindow($hwnd)
  2251.         Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
  2252.         Return $aresult[0]
  2253.  
  2254. Func _winapi_iswindowvisible($hwnd)
  2255.         Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  2256.         Return $aresult[0]
  2257.  
  2258. Func _winapi_invalidaterect($hwnd, $trect = 0, $berase = True)
  2259.         Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $berase)
  2260.         Return $aresult[0]
  2261.  
  2262. Func _winapi_lineto($hdc, $ix, $iy)
  2263.         Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
  2264.         Return $aresult[0]
  2265.  
  2266. Func _winapi_loadbitmap($hinstance, $sbitmap)
  2267.         Local $sbitmaptype = "int"
  2268.         If IsString($sbitmap) Then $sbitmaptype = "wstr"
  2269.         Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
  2270.         Return $aresult[0]
  2271.  
  2272. Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
  2273.         Local $aresult, $simagetype = "int"
  2274.         If IsString($simage) Then $simagetype = "wstr"
  2275.         $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
  2276.         Return $aresult[0]
  2277.  
  2278. Func _winapi_loadlibrary($sfilename)
  2279.         Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
  2280.         Return $aresult[0]
  2281.  
  2282. Func _winapi_loadlibraryex($sfilename, $iflags = 0)
  2283.         Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
  2284.         Return $aresult[0]
  2285.  
  2286. Func _winapi_loadshell32icon($iiconid)
  2287.         Local $ticons = DllStructCreate("ptr Data")
  2288.         Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1)
  2289.         If $iicons <= 0 Then Return SetError(10, 0, 0)
  2290.         Return DllStructGetData($ticons, "Data")
  2291.  
  2292. Func _winapi_loadstring($hinstance, $istringid)
  2293.         Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
  2294.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2295.         Return SetExtended($aresult[0], $aresult[3])
  2296.  
  2297. Func _winapi_localfree($hmem)
  2298.         Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmem)
  2299.         Return $aresult[0]
  2300.  
  2301. Func _winapi_loword($ilong)
  2302.         Return BitAND($ilong, 65535)
  2303.  
  2304. Func _winapi_makelangid($iprimary, $isub)
  2305.         Return BitOR(BitShift($isub, -10), $iprimary)
  2306.  
  2307. Func _winapi_makelcid($ilgid, $isrtid)
  2308.         Return BitOR(BitShift($isrtid, -16), $ilgid)
  2309.  
  2310. Func _winapi_makelong($ilo, $ihi)
  2311.         Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
  2312.  
  2313. Func _winapi_makeqword($ilodword, $ihidword)
  2314.         Local $tint64 = DllStructCreate("uint64")
  2315.         Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  2316.         DllStructSetData($tdwords, 1, $ilodword)
  2317.         DllStructSetData($tdwords, 2, $ihidword)
  2318.         Return DllStructGetData($tint64, 1)
  2319.  
  2320. Func _winapi_messagebeep($itype = 1)
  2321.         Local $isound
  2322.         Switch $itype
  2323.                 Case 1
  2324.                         $isound = 0
  2325.                 Case 2
  2326.                         $isound = 16
  2327.                 Case 3
  2328.                         $isound = 32
  2329.                 Case 4
  2330.                         $isound = 48
  2331.                 Case 5
  2332.                         $isound = 64
  2333.                 Case Else
  2334.                         $isound = -1
  2335.         EndSwitch
  2336.         Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
  2337.         Return $aresult[0]
  2338.  
  2339. Func _winapi_msgbox($iflags, $stitle, $stext)
  2340.         BlockInput(0)
  2341.         MsgBox($iflags, $stitle, $stext & "      ")
  2342.  
  2343. Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0)
  2344.         DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo)
  2345.  
  2346. Func _winapi_moveto($hdc, $ix, $iy)
  2347.         Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
  2348.         Return $aresult[0]
  2349.  
  2350. Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $brepaint = True)
  2351.         Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $brepaint)
  2352.         Return $aresult[0]
  2353.  
  2354. Func _winapi_muldiv($inumber, $inumerator, $idenominator)
  2355.         Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
  2356.         Return $aresult[0]
  2357.  
  2358. Func _winapi_multibytetowidechar($stext, $icodepage = 0, $iflags = 0, $bretstring = False)
  2359.         Local $stexttype = "str"
  2360.         If NOT IsString($stext) Then $stexttype = "struct*"
  2361.         Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "ptr", 0, "int", 0)
  2362.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2363.         Local $iout = $aresult[0]
  2364.         Local $tout = DllStructCreate("wchar[" & $iout & "]")
  2365.         $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "struct*", $tout, "int", $iout)
  2366.         If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, 0)
  2367.         If $bretstring Then Return DllStructGetData($tout, 1)
  2368.         Return $tout
  2369.  
  2370. Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
  2371.         Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2)
  2372.         Return $aresult[0]
  2373.  
  2374. Func _winapi_openprocess($iaccess, $binherit, $ipid, $bdebugpriv = False)
  2375.         Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid)
  2376.         If $aresult[0] Then Return $aresult[0]
  2377.         If NOT $bdebugpriv Then Return SetError(100, 0, 0)
  2378.         Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
  2379.         If @error Then Return SetError(@error + 10, @extended, 0)
  2380.         _security__setprivilege($htoken, "SeDebugPrivilege", True)
  2381.         Local $ierror = @error
  2382.         Local $iextended = @extended
  2383.         Local $iret = 0
  2384.         If NOT @error Then
  2385.                 $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid)
  2386.                 $ierror = @error
  2387.                 $iextended = @extended
  2388.                 If $aresult[0] Then $iret = $aresult[0]
  2389.                 _security__setprivilege($htoken, "SeDebugPrivilege", False)
  2390.                 If @error Then
  2391.                         $ierror = @error + 20
  2392.                         $iextended = @extended
  2393.                 EndIf
  2394.         Else
  2395.                 $ierror = @error + 30
  2396.         EndIf
  2397.         _winapi_closehandle($htoken)
  2398.         Return SetError($ierror, $iextended, $iret)
  2399.  
  2400. Func __winapi_parsefiledialogpath($spath)
  2401.         Local $afiles[3]
  2402.         $afiles[0] = 2
  2403.         Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
  2404.         $afiles[1] = $stemp
  2405.         $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
  2406.         Return $afiles
  2407.  
  2408. Func _winapi_pathfindonpath(Const $sfile, $aextrapaths = "", Const $spathdelimiter = @LF)
  2409.         Local $iextracount = 0
  2410.         If IsString($aextrapaths) Then
  2411.                 If StringLen($aextrapaths) Then
  2412.                         $aextrapaths = StringSplit($aextrapaths, $spathdelimiter, $str_entiresplit + $str_nocount)
  2413.                         $iextracount = UBound($aextrapaths, $ubound_rows)
  2414.                 EndIf
  2415.         ElseIf IsArray($aextrapaths) Then
  2416.                 $iextracount = UBound($aextrapaths)
  2417.         EndIf
  2418.         Local $tpaths, $tpathptrs
  2419.         If $iextracount Then
  2420.                 Local $tagstruct = ""
  2421.                 For $path In $aextrapaths
  2422.                         $tagstruct &= "wchar[" & StringLen($path) + 1 & "];"
  2423.                 Next
  2424.                 $tpaths = DllStructCreate($tagstruct)
  2425.                 $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
  2426.                 For $i = 1 To $iextracount
  2427.                         DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
  2428.                         DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
  2429.                 Next
  2430.                 DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
  2431.         EndIf
  2432.         Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $sfile, "struct*", $tpathptrs)
  2433.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, $sfile)
  2434.         Return $aresult[1]
  2435.  
  2436. Func _winapi_pointfromrect(ByRef $trect, $bcenter = True)
  2437.         Local $ix1 = DllStructGetData($trect, "Left")
  2438.         Local $iy1 = DllStructGetData($trect, "Top")
  2439.         Local $ix2 = DllStructGetData($trect, "Right")
  2440.         Local $iy2 = DllStructGetData($trect, "Bottom")
  2441.         If $bcenter Then
  2442.                 $ix1 = $ix1 + (($ix2 - $ix1) / 2)
  2443.                 $iy1 = $iy1 + (($iy2 - $iy1) / 2)
  2444.         EndIf
  2445.         Local $tpoint = DllStructCreate($tagpoint)
  2446.         DllStructSetData($tpoint, "X", $ix1)
  2447.         DllStructSetData($tpoint, "Y", $iy1)
  2448.         Return $tpoint
  2449.  
  2450. Func _winapi_postmessage($hwnd, $imsg, $iwparam, $ilparam)
  2451.         Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  2452.         Return $aresult[0]
  2453.  
  2454. Func _winapi_primarylangid($ilgid)
  2455.         Return BitAND($ilgid, 1023)
  2456.  
  2457. Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
  2458.         Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint)
  2459.         Return $aresult[0]
  2460.  
  2461. Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $poverlapped = 0)
  2462.         Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itoread, "dword*", 0, "ptr", $poverlapped)
  2463.         $iread = $aresult[4]
  2464.         Return $aresult[0]
  2465.  
  2466. Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
  2467.         Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "ptr", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  2468.         $iread = $aresult[5]
  2469.         Return $aresult[0]
  2470.  
  2471. Func _winapi_rectisempty(ByRef $trect)
  2472.         Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
  2473.  
  2474. Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
  2475.         Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags)
  2476.         Return $aresult[0]
  2477.  
  2478. Func _winapi_registerwindowmessage($smessage)
  2479.         Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage)
  2480.         Return $aresult[0]
  2481.  
  2482. Func _winapi_releasecapture()
  2483.         Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
  2484.         Return $aresult[0]
  2485.  
  2486. Func _winapi_releasedc($hwnd, $hdc)
  2487.         Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  2488.         Return $aresult[0]
  2489.  
  2490. Func _winapi_screentoclient($hwnd, ByRef $tpoint)
  2491.         Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint)
  2492.         Return $aresult[0]
  2493.  
  2494. Func _winapi_selectobject($hdc, $hgdiobj)
  2495.         Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
  2496.         Return $aresult[0]
  2497.  
  2498. Func _winapi_setbkcolor($hdc, $icolor)
  2499.         Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "INT", $icolor)
  2500.         Return $aresult[0]
  2501.  
  2502. Func _winapi_setbkmode($hdc, $ibkmode)
  2503.         Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
  2504.         Return $aresult[0]
  2505.  
  2506. Func _winapi_setcapture($hwnd)
  2507.         Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd)
  2508.         Return $aresult[0]
  2509.  
  2510. Func _winapi_setcursor($hcursor)
  2511.         Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
  2512.         Return $aresult[0]
  2513.  
  2514. Func _winapi_setdefaultprinter($sprinter)
  2515.         Local $aresult = DllCall("winspool.drv", "bool", "SetDefaultPrinterW", "wstr", $sprinter)
  2516.         Return $aresult[0]
  2517.  
  2518. Func _winapi_setdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbmi, $icoloruse = 0)
  2519.         Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbmi, "INT", $icoloruse)
  2520.         Return $aresult[0]
  2521.  
  2522. Func _winapi_setendoffile($hfile)
  2523.         Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
  2524.         Return $aresult[0]
  2525.  
  2526. Func _winapi_setevent($hevent)
  2527.         Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent)
  2528.         Return $aresult[0]
  2529.  
  2530. Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0)
  2531.         Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
  2532.         Return $aresult[0]
  2533.  
  2534. Func _winapi_setfocus($hwnd)
  2535.         Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
  2536.         Return $aresult[0]
  2537.  
  2538. Func _winapi_setfont($hwnd, $hfont, $bredraw = True)
  2539.         _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $bredraw, 0, "hwnd")
  2540.  
  2541. Func _winapi_sethandleinformation($hobject, $imask, $iflags)
  2542.         Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags)
  2543.         Return $aresult[0]
  2544.  
  2545. Func _winapi_setlayeredwindowattributes($hwnd, $itranscolor, $itransgui = 255, $iflags = 3, $bcolorref = False)
  2546.         If $iflags = Default OR $iflags = "" OR $iflags < 0 Then $iflags = 3
  2547.         If NOT $bcolorref Then
  2548.                 $itranscolor = Int(BinaryMid($itranscolor, 3, 1) & BinaryMid($itranscolor, 2, 1) & BinaryMid($itranscolor, 1, 1))
  2549.         EndIf
  2550.         Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "INT", $itranscolor, "byte", $itransgui, "dword", $iflags)
  2551.         Return $aresult[0]
  2552.  
  2553. Func _winapi_setparent($hwndchild, $hwndparent)
  2554.         Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
  2555.         Return $aresult[0]
  2556.  
  2557. Func _winapi_setprocessaffinitymask($hprocess, $imask)
  2558.         Local $aresult = DllCall("kernel32.dll", "bool", "SetProcessAffinityMask", "handle", $hprocess, "ulong_ptr", $imask)
  2559.         Return $aresult[0]
  2560.  
  2561. Func _winapi_setsyscolors($velements, $vcolors)
  2562.         Local $bisearray = IsArray($velements), $biscarray = IsArray($vcolors)
  2563.         Local $ielementnum
  2564.         If NOT $biscarray AND NOT $bisearray Then
  2565.                 $ielementnum = 1
  2566.         ElseIf $biscarray OR $bisearray Then
  2567.                 If NOT $biscarray OR NOT $bisearray Then Return SetError(-1, -1, False)
  2568.                 If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
  2569.                 $ielementnum = UBound($velements)
  2570.         EndIf
  2571.         Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
  2572.         Local $tcolors = DllStructCreate("INT NewColor[" & $ielementnum & "]")
  2573.         If NOT $bisearray Then
  2574.                 DllStructSetData($telements, "Element", $velements, 1)
  2575.         Else
  2576.                 For $x = 0 To $ielementnum - 1
  2577.                         DllStructSetData($telements, "Element", $velements[$x], $x + 1)
  2578.                 Next
  2579.         EndIf
  2580.         If NOT $biscarray Then
  2581.                 DllStructSetData($tcolors, "NewColor", $vcolors, 1)
  2582.         Else
  2583.                 For $x = 0 To $ielementnum - 1
  2584.                         DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
  2585.                 Next
  2586.         EndIf
  2587.         Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors)
  2588.         Return $aresult[0]
  2589.  
  2590. Func _winapi_settextcolor($hdc, $icolor)
  2591.         Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "INT", $icolor)
  2592.         Return $aresult[0]
  2593.  
  2594. Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
  2595.         _winapi_setlasterror(0)
  2596.         Local $sfuncname = "SetWindowLongW"
  2597.         If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW"
  2598.         Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
  2599.         Return $aresult[0]
  2600.  
  2601. Func _winapi_setwindowplacement($hwnd, $pwindowplacement)
  2602.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
  2603.         Return $aresult[0]
  2604.  
  2605. Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
  2606.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
  2607.         Return $aresult[0]
  2608.  
  2609. Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
  2610.         Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
  2611.         Return $aresult[0]
  2612.  
  2613. Func _winapi_setwindowshookex($idhook, $pfn, $hmod, $ithreadid = 0)
  2614.         Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idhook, "ptr", $pfn, "handle", $hmod, "dword", $ithreadid)
  2615.         Return $aresult[0]
  2616.  
  2617. Func _winapi_setwindowtext($hwnd, $stext)
  2618.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
  2619.         Return $aresult[0]
  2620.  
  2621. Func _winapi_showcursor($bshow)
  2622.         Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $bshow)
  2623.         Return $aresult[0]
  2624.  
  2625. Func _winapi_showerror($stext, $bexit = True)
  2626.         _winapi_msgbox($mb_systemmodal, "Error", $stext)
  2627.         If $bexit Then Exit
  2628.  
  2629. Func _winapi_showmsg($stext)
  2630.         _winapi_msgbox($mb_systemmodal, "Information", $stext)
  2631.  
  2632. Func _winapi_showwindow($hwnd, $icmdshow = 5)
  2633.         Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
  2634.         Return $aresult[0]
  2635.  
  2636. Func _winapi_stringfromguid($pguid)
  2637.         Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $pguid, "wstr", "", "int", 40)
  2638.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  2639.         Return SetExtended($aresult[0], $aresult[2])
  2640.  
  2641. Func _winapi_stringlena(Const ByRef $tstring)
  2642.         Local $aresult = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $tstring)
  2643.         Return $aresult[0]
  2644.  
  2645. Func _winapi_stringlenw(Const ByRef $tstring)
  2646.         Local $aresult = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $tstring)
  2647.         Return $aresult[0]
  2648.  
  2649. Func _winapi_sublangid($ilgid)
  2650.         Return BitShift($ilgid, 10)
  2651.  
  2652. Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
  2653.         Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "ptr", $vparam, "uint", $iwinini)
  2654.         Return $aresult[0]
  2655.  
  2656. Func _winapi_twipsperpixelx()
  2657.         Local $hdc, $itwipsperpixelx
  2658.         $hdc = _winapi_getdc(0)
  2659.         $itwipsperpixelx = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsx)
  2660.         _winapi_releasedc(0, $hdc)
  2661.         Return $itwipsperpixelx
  2662.  
  2663. Func _winapi_twipsperpixely()
  2664.         Local $hdc, $itwipsperpixely
  2665.         $hdc = _winapi_getdc(0)
  2666.         $itwipsperpixely = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsy)
  2667.         _winapi_releasedc(0, $hdc)
  2668.         Return $itwipsperpixely
  2669.  
  2670. Func _winapi_unhookwindowshookex($hhk)
  2671.         Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhk)
  2672.         Return $aresult[0]
  2673.  
  2674. Func _winapi_updatelayeredwindow($hwnd, $hdcdest, $pptdest, $psize, $hdcsrce, $pptsrce, $irgb, $pblend, $iflags)
  2675.         Local $aresult = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdcdest, "ptr", $pptdest, "ptr", $psize, "handle", $hdcsrce, "ptr", $pptsrce, "dword", $irgb, "ptr", $pblend, "dword", $iflags)
  2676.         Return $aresult[0]
  2677.  
  2678. Func _winapi_updatewindow($hwnd)
  2679.         Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
  2680.         Return $aresult[0]
  2681.  
  2682. Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
  2683.         Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout)
  2684.         Return $aresult[0]
  2685.  
  2686. Func _winapi_waitformultipleobjects($icount, $phandles, $bwaitall = False, $itimeout = -1)
  2687.         Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "ptr", $phandles, "bool", $bwaitall, "dword", $itimeout)
  2688.         Return $aresult[0]
  2689.  
  2690. Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
  2691.         Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout)
  2692.         Return $aresult[0]
  2693.  
  2694. Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True)
  2695.         Local $sunicodetype = "wstr"
  2696.         If NOT IsString($punicode) Then $sunicodetype = "struct*"
  2697.         Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
  2698.         If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "")
  2699.         Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
  2700.         $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
  2701.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2702.         If $bretstring Then Return DllStructGetData($tmultibyte, 1)
  2703.         Return $tmultibyte
  2704.  
  2705. Func _winapi_windowfrompoint(ByRef $tpoint)
  2706.         Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint)
  2707.         Return $aresult[0]
  2708.  
  2709. Func _winapi_writeconsole($hconsole, $stext)
  2710.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0)
  2711.         Return $aresult[0]
  2712.  
  2713. Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0)
  2714.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped)
  2715.         $iwritten = $aresult[4]
  2716.         Return $aresult[0]
  2717.  
  2718. Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
  2719.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  2720.         $iwritten = $aresult[5]
  2721.         Return $aresult[0]
  2722.  
  2723. Global Const $sini = @ScriptDir & "\config.ini"
  2724. Global Const $sappname = "Windowed Borderless Gaming"
  2725. Global Const $sfriendlyname = "WindowedBorderlessGaming"
  2726. AutoItWinSetTitle("winborderlessgaming")
  2727. Global Const $bs_groupbox = 7
  2728. Global Const $bs_bottom = 2048
  2729. Global Const $bs_center = 768
  2730. Global Const $bs_defpushbutton = 1
  2731. Global Const $bs_left = 256
  2732. Global Const $bs_multiline = 8192
  2733. Global Const $bs_pushbox = 10
  2734. Global Const $bs_pushlike = 4096
  2735. Global Const $bs_right = 512
  2736. Global Const $bs_rightbutton = 32
  2737. Global Const $bs_top = 1024
  2738. Global Const $bs_vcenter = 3072
  2739. Global Const $bs_flat = 32768
  2740. Global Const $bs_icon = 64
  2741. Global Const $bs_bitmap = 128
  2742. Global Const $bs_notify = 16384
  2743. Global Const $bs_splitbutton = 12
  2744. Global Const $bs_defsplitbutton = 13
  2745. Global Const $bs_commandlink = 14
  2746. Global Const $bs_defcommandlink = 15
  2747. Global Const $bcsif_glyph = 1
  2748. Global Const $bcsif_image = 2
  2749. Global Const $bcsif_style = 4
  2750. Global Const $bcsif_size = 8
  2751. Global Const $bcss_nosplit = 1
  2752. Global Const $bcss_stretch = 2
  2753. Global Const $bcss_alignleft = 4
  2754. Global Const $bcss_image = 8
  2755. Global Const $button_imagelist_align_left = 0
  2756. Global Const $button_imagelist_align_right = 1
  2757. Global Const $button_imagelist_align_top = 2
  2758. Global Const $button_imagelist_align_bottom = 3
  2759. Global Const $button_imagelist_align_center = 4
  2760. Global Const $bs_3state = 5
  2761. Global Const $bs_auto3state = 6
  2762. Global Const $bs_autocheckbox = 3
  2763. Global Const $bs_checkbox = 2
  2764. Global Const $bs_radiobutton = 4
  2765. Global Const $bs_autoradiobutton = 9
  2766. Global Const $bs_ownerdraw = 11
  2767. Global Const $gui_ss_default_button = 0
  2768. Global Const $gui_ss_default_checkbox = 0
  2769. Global Const $gui_ss_default_group = 0
  2770. Global Const $gui_ss_default_radio = 0
  2771. Global Const $bcm_first = 5632
  2772. Global Const $bcm_getidealsize = ($bcm_first + 1)
  2773. Global Const $bcm_getimagelist = ($bcm_first + 3)
  2774. Global Const $bcm_getnote = ($bcm_first + 10)
  2775. Global Const $bcm_getnotelength = ($bcm_first + 11)
  2776. Global Const $bcm_getsplitinfo = ($bcm_first + 8)
  2777. Global Const $bcm_gettextmargin = ($bcm_first + 5)
  2778. Global Const $bcm_setdropdownstate = ($bcm_first + 6)
  2779. Global Const $bcm_setimagelist = ($bcm_first + 2)
  2780. Global Const $bcm_setnote = ($bcm_first + 9)
  2781. Global Const $bcm_setshield = ($bcm_first + 12)
  2782. Global Const $bcm_setsplitinfo = ($bcm_first + 7)
  2783. Global Const $bcm_settextmargin = ($bcm_first + 4)
  2784. Global Const $bm_click = 245
  2785. Global Const $bm_getcheck = 240
  2786. Global Const $bm_getimage = 246
  2787. Global Const $bm_getstate = 242
  2788. Global Const $bm_setcheck = 241
  2789. Global Const $bm_setdontclick = 248
  2790. Global Const $bm_setimage = 247
  2791. Global Const $bm_setstate = 243
  2792. Global Const $bm_setstyle = 244
  2793. Global Const $bcn_first = -1250
  2794. Global Const $bcn_dropdown = ($bcn_first + 2)
  2795. Global Const $bcn_hotitemchange = ($bcn_first + 1)
  2796. Global Const $bn_clicked = 0
  2797. Global Const $bn_paint = 1
  2798. Global Const $bn_hilite = 2
  2799. Global Const $bn_unhilite = 3
  2800. Global Const $bn_disable = 4
  2801. Global Const $bn_doubleclicked = 5
  2802. Global Const $bn_setfocus = 6
  2803. Global Const $bn_killfocus = 7
  2804. Global Const $bn_pushed = $bn_hilite
  2805. Global Const $bn_unpushed = $bn_unhilite
  2806. Global Const $bn_dblclk = $bn_doubleclicked
  2807. Global Const $bst_checked = 1
  2808. Global Const $bst_indeterminate = 2
  2809. Global Const $bst_unchecked = 0
  2810. Global Const $bst_focus = 8
  2811. Global Const $bst_pushed = 4
  2812. Global Const $bst_dontclick = 128
  2813. Global Const $cb_err = -1
  2814. Global Const $cb_errattribute = -3
  2815. Global Const $cb_errrequired = -4
  2816. Global Const $cb_errspace = -2
  2817. Global Const $cb_okay = 0
  2818. Global Const $state_system_invisible = 32768
  2819. Global Const $state_system_pressed = 8
  2820. Global Const $cbs_autohscroll = 64
  2821. Global Const $cbs_disablenoscroll = 2048
  2822. Global Const $cbs_dropdown = 2
  2823. Global Const $cbs_dropdownlist = 3
  2824. Global Const $cbs_hasstrings = 512
  2825. Global Const $cbs_lowercase = 16384
  2826. Global Const $cbs_nointegralheight = 1024
  2827. Global Const $cbs_oemconvert = 128
  2828. Global Const $cbs_ownerdrawfixed = 16
  2829. Global Const $cbs_ownerdrawvariable = 32
  2830. Global Const $cbs_simple = 1
  2831. Global Const $cbs_sort = 256
  2832. Global Const $cbs_uppercase = 8192
  2833. Global Const $cbm_first = 5888
  2834. Global Const $cb_addstring = 323
  2835. Global Const $cb_deletestring = 324
  2836. Global Const $cb_dir = 325
  2837. Global Const $cb_findstring = 332
  2838. Global Const $cb_findstringexact = 344
  2839. Global Const $cb_getcomboboxinfo = 356
  2840. Global Const $cb_getcount = 326
  2841. Global Const $cb_getcuebanner = ($cbm_first + 4)
  2842. Global Const $cb_getcursel = 327
  2843. Global Const $cb_getdroppedcontrolrect = 338
  2844. Global Const $cb_getdroppedstate = 343
  2845. Global Const $cb_getdroppedwidth = 351
  2846. Global Const $cb_geteditsel = 320
  2847. Global Const $cb_getextendedui = 342
  2848. Global Const $cb_gethorizontalextent = 349
  2849. Global Const $cb_getitemdata = 336
  2850. Global Const $cb_getitemheight = 340
  2851. Global Const $cb_getlbtext = 328
  2852. Global Const $cb_getlbtextlen = 329
  2853. Global Const $cb_getlocale = 346
  2854. Global Const $cb_getminvisible = 5890
  2855. Global Const $cb_gettopindex = 347
  2856. Global Const $cb_initstorage = 353
  2857. Global Const $cb_limittext = 321
  2858. Global Const $cb_resetcontent = 331
  2859. Global Const $cb_insertstring = 330
  2860. Global Const $cb_selectstring = 333
  2861. Global Const $cb_setcuebanner = ($cbm_first + 3)
  2862. Global Const $cb_setcursel = 334
  2863. Global Const $cb_setdroppedwidth = 352
  2864. Global Const $cb_seteditsel = 322
  2865. Global Const $cb_setextendedui = 341
  2866. Global Const $cb_sethorizontalextent = 350
  2867. Global Const $cb_setitemdata = 337
  2868. Global Const $cb_setitemheight = 339
  2869. Global Const $cb_setlocale = 345
  2870. Global Const $cb_setminvisible = 5889
  2871. Global Const $cb_settopindex = 348
  2872. Global Const $cb_showdropdown = 335
  2873. Global Const $cbn_closeup = 8
  2874. Global Const $cbn_dblclk = 2
  2875. Global Const $cbn_dropdown = 7
  2876. Global Const $cbn_editchange = 5
  2877. Global Const $cbn_editupdate = 6
  2878. Global Const $cbn_errspace = (-1)
  2879. Global Const $cbn_killfocus = 4
  2880. Global Const $cbn_selchange = 1
  2881. Global Const $cbn_selendcancel = 10
  2882. Global Const $cbn_selendok = 9
  2883. Global Const $cbn_setfocus = 3
  2884. Global Const $cbes_ex_casesensitive = 16
  2885. Global Const $cbes_ex_noeditimage = 1
  2886. Global Const $cbes_ex_noeditimageindent = 2
  2887. Global Const $cbes_ex_nosizelimit = 8
  2888. Global Const $__comboboxconstant_wm_user = 1024
  2889. Global Const $cbem_deleteitem = $cb_deletestring
  2890. Global Const $cbem_getcombocontrol = ($__comboboxconstant_wm_user + 6)
  2891. Global Const $cbem_geteditcontrol = ($__comboboxconstant_wm_user + 7)
  2892. Global Const $cbem_getexstyle = ($__comboboxconstant_wm_user + 9)
  2893. Global Const $cbem_getextendedstyle = ($__comboboxconstant_wm_user + 9)
  2894. Global Const $cbem_getimagelist = ($__comboboxconstant_wm_user + 3)
  2895. Global Const $cbem_getitema = ($__comboboxconstant_wm_user + 4)
  2896. Global Const $cbem_getitemw = ($__comboboxconstant_wm_user + 13)
  2897. Global Const $cbem_getunicodeformat = 8192 + 6
  2898. Global Const $cbem_haseditchanged = ($__comboboxconstant_wm_user + 10)
  2899. Global Const $cbem_insertitema = ($__comboboxconstant_wm_user + 1)
  2900. Global Const $cbem_insertitemw = ($__comboboxconstant_wm_user + 11)
  2901. Global Const $cbem_setexstyle = ($__comboboxconstant_wm_user + 8)
  2902. Global Const $cbem_setextendedstyle = ($__comboboxconstant_wm_user + 14)
  2903. Global Const $cbem_setimagelist = ($__comboboxconstant_wm_user + 2)
  2904. Global Const $cbem_setitema = ($__comboboxconstant_wm_user + 5)
  2905. Global Const $cbem_setitemw = ($__comboboxconstant_wm_user + 12)
  2906. Global Const $cbem_setunicodeformat = 8192 + 5
  2907. Global Const $cbem_setwindowtheme = 8192 + 11
  2908. Global Const $cben_first = (-800)
  2909. Global Const $cben_last = (-830)
  2910. Global Const $cben_beginedit = ($cben_first - 4)
  2911. Global Const $cben_deleteitem = ($cben_first - 2)
  2912. Global Const $cben_dragbegina = ($cben_first - 8)
  2913. Global Const $cben_dragbeginw = ($cben_first - 9)
  2914. Global Const $cben_endedita = ($cben_first - 5)
  2915. Global Const $cben_endeditw = ($cben_first - 6)
  2916. Global Const $cben_getdispinfo = ($cben_first + 0)
  2917. Global Const $cben_getdispinfoa = ($cben_first + 0)
  2918. Global Const $cben_getdispinfow = ($cben_first - 7)
  2919. Global Const $cben_insertitem = ($cben_first - 1)
  2920. Global Const $cbeif_di_setitem = 268435456
  2921. Global Const $cbeif_image = 2
  2922. Global Const $cbeif_indent = 16
  2923. Global Const $cbeif_lparam = 32
  2924. Global Const $cbeif_overlay = 8
  2925. Global Const $cbeif_selectedimage = 4
  2926. Global Const $cbeif_text = 1
  2927. Global Const $gui_ss_default_combo = 2097218
  2928. Global Const $es_left = 0
  2929. Global Const $es_center = 1
  2930. Global Const $es_right = 2
  2931. Global Const $es_multiline = 4
  2932. Global Const $es_uppercase = 8
  2933. Global Const $es_lowercase = 16
  2934. Global Const $es_password = 32
  2935. Global Const $es_autovscroll = 64
  2936. Global Const $es_autohscroll = 128
  2937. Global Const $es_nohidesel = 256
  2938. Global Const $es_oemconvert = 1024
  2939. Global Const $es_readonly = 2048
  2940. Global Const $es_wantreturn = 4096
  2941. Global Const $es_number = 8192
  2942. Global Const $ec_err = -1
  2943. Global Const $ecm_first = 5376
  2944. Global Const $em_canundo = 198
  2945. Global Const $em_charfrompos = 215
  2946. Global Const $em_emptyundobuffer = 205
  2947. Global Const $em_fmtlines = 200
  2948. Global Const $em_getcuebanner = ($ecm_first + 2)
  2949. Global Const $em_getfirstvisibleline = 206
  2950. Global Const $em_gethandle = 189
  2951. Global Const $em_getimestatus = 217
  2952. Global Const $em_getlimittext = 213
  2953. Global Const $em_getline = 196
  2954. Global Const $em_getlinecount = 186
  2955. Global Const $em_getmargins = 212
  2956. Global Const $em_getmodify = 184
  2957. Global Const $em_getpasswordchar = 210
  2958. Global Const $em_getrect = 178
  2959. Global Const $em_getsel = 176
  2960. Global Const $em_getthumb = 190
  2961. Global Const $em_getwordbreakproc = 209
  2962. Global Const $em_hideballoontip = ($ecm_first + 4)
  2963. Global Const $em_limittext = 197
  2964. Global Const $em_linefromchar = 201
  2965. Global Const $em_lineindex = 187
  2966. Global Const $em_linelength = 193
  2967. Global Const $em_linescroll = 182
  2968. Global Const $em_posfromchar = 214
  2969. Global Const $em_replacesel = 194
  2970. Global Const $em_scroll = 181
  2971. Global Const $em_scrollcaret = 183
  2972. Global Const $em_setcuebanner = ($ecm_first + 1)
  2973. Global Const $em_sethandle = 188
  2974. Global Const $em_setimestatus = 216
  2975. Global Const $em_setlimittext = $em_limittext
  2976. Global Const $em_setmargins = 211
  2977. Global Const $em_setmodify = 185
  2978. Global Const $em_setpasswordchar = 204
  2979. Global Const $em_setreadonly = 207
  2980. Global Const $em_setrect = 179
  2981. Global Const $em_setrectnp = 180
  2982. Global Const $em_setsel = 177
  2983. Global Const $em_settabstops = 203
  2984. Global Const $em_setwordbreakproc = 208
  2985. Global Const $em_showballoontip = ($ecm_first + 3)
  2986. Global Const $em_undo = 199
  2987. Global Const $ec_leftmargin = 1
  2988. Global Const $ec_rightmargin = 2
  2989. Global Const $ec_usefontinfo = 65535
  2990. Global Const $emsis_compositionstring = 1
  2991. Global Const $eimes_getcompstratonce = 1
  2992. Global Const $eimes_cancelcompstrinfocus = 2
  2993. Global Const $eimes_completecompstrkillfocus = 4
  2994. Global Const $en_align_ltr_ec = 1792
  2995. Global Const $en_align_rtl_ec = 1793
  2996. Global Const $en_change = 768
  2997. Global Const $en_errspace = 1280
  2998. Global Const $en_hscroll = 1537
  2999. Global Const $en_killfocus = 512
  3000. Global Const $en_maxtext = 1281
  3001. Global Const $en_setfocus = 256
  3002. Global Const $en_update = 1024
  3003. Global Const $en_vscroll = 1538
  3004. Global Const $gui_ss_default_edit = 3150016
  3005. Global Const $gui_ss_default_input = 128
  3006. Global Const $gui_event_close = -3
  3007. Global Const $gui_event_minimize = -4
  3008. Global Const $gui_event_restore = -5
  3009. Global Const $gui_event_maximize = -6
  3010. Global Const $gui_event_primarydown = -7
  3011. Global Const $gui_event_primaryup = -8
  3012. Global Const $gui_event_secondarydown = -9
  3013. Global Const $gui_event_secondaryup = -10
  3014. Global Const $gui_event_mousemove = -11
  3015. Global Const $gui_event_resized = -12
  3016. Global Const $gui_event_dropped = -13
  3017. Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  3018. Global Const $gui_avistop = 0
  3019. Global Const $gui_avistart = 1
  3020. Global Const $gui_aviclose = 2
  3021. Global Const $gui_checked = 1
  3022. Global Const $gui_indeterminate = 2
  3023. Global Const $gui_unchecked = 4
  3024. Global Const $gui_dropaccepted = 8
  3025. Global Const $gui_nodropaccepted = 4096
  3026. Global Const $gui_acceptfiles = $gui_dropaccepted
  3027. Global Const $gui_show = 16
  3028. Global Const $gui_hide = 32
  3029. Global Const $gui_enable = 64
  3030. Global Const $gui_disable = 128
  3031. Global Const $gui_focus = 256
  3032. Global Const $gui_nofocus = 8192
  3033. Global Const $gui_defbutton = 512
  3034. Global Const $gui_expand = 1024
  3035. Global Const $gui_ontop = 2048
  3036. Global Const $gui_fontitalic = 2
  3037. Global Const $gui_fontunder = 4
  3038. Global Const $gui_fontstrike = 8
  3039. Global Const $gui_dockauto = 1
  3040. Global Const $gui_dockleft = 2
  3041. Global Const $gui_dockright = 4
  3042. Global Const $gui_dockhcenter = 8
  3043. Global Const $gui_docktop = 32
  3044. Global Const $gui_dockbottom = 64
  3045. Global Const $gui_dockvcenter = 128
  3046. Global Const $gui_dockwidth = 256
  3047. Global Const $gui_dockheight = 512
  3048. Global Const $gui_docksize = 768
  3049. Global Const $gui_dockmenubar = 544
  3050. Global Const $gui_dockstatebar = 576
  3051. Global Const $gui_dockall = 802
  3052. Global Const $gui_dockborders = 102
  3053. Global Const $gui_gr_close = 1
  3054. Global Const $gui_gr_line = 2
  3055. Global Const $gui_gr_bezier = 4
  3056. Global Const $gui_gr_move = 6
  3057. Global Const $gui_gr_color = 8
  3058. Global Const $gui_gr_rect = 10
  3059. Global Const $gui_gr_ellipse = 12
  3060. Global Const $gui_gr_pie = 14
  3061. Global Const $gui_gr_dot = 16
  3062. Global Const $gui_gr_pixel = 18
  3063. Global Const $gui_gr_hint = 20
  3064. Global Const $gui_gr_refresh = 22
  3065. Global Const $gui_gr_pensize = 24
  3066. Global Const $gui_gr_nobkcolor = -2
  3067. Global Const $gui_bkcolor_default = -1
  3068. Global Const $gui_bkcolor_transparent = -2
  3069. Global Const $gui_bkcolor_lv_alternate = -33554432
  3070. Global Const $gui_ws_ex_parentdrag = 1048576
  3071. Global Const $ss_left = 0
  3072. Global Const $ss_center = 1
  3073. Global Const $ss_right = 2
  3074. Global Const $ss_icon = 3
  3075. Global Const $ss_blackrect = 4
  3076. Global Const $ss_grayrect = 5
  3077. Global Const $ss_whiterect = 6
  3078. Global Const $ss_blackframe = 7
  3079. Global Const $ss_grayframe = 8
  3080. Global Const $ss_whiteframe = 9
  3081. Global Const $ss_simple = 11
  3082. Global Const $ss_leftnowordwrap = 12
  3083. Global Const $ss_bitmap = 14
  3084. Global Const $ss_etchedhorz = 16
  3085. Global Const $ss_etchedvert = 17
  3086. Global Const $ss_etchedframe = 18
  3087. Global Const $ss_noprefix = 128
  3088. Global Const $ss_notify = 256
  3089. Global Const $ss_centerimage = 512
  3090. Global Const $ss_rightjust = 1024
  3091. Global Const $ss_sunken = 4096
  3092. Global Const $gui_ss_default_label = 0
  3093. Global Const $gui_ss_default_graphic = 0
  3094. Global Const $gui_ss_default_icon = $ss_notify
  3095. Global Const $gui_ss_default_pic = $ss_notify
  3096. Global Const $wc_animate = "SysAnimate32"
  3097. Global Const $wc_button = "Button"
  3098. Global Const $wc_combobox = "ComboBox"
  3099. Global Const $wc_comboboxex = "ComboBoxEx32"
  3100. Global Const $wc_datetimepick = "SysDateTimePick32"
  3101. Global Const $wc_edit = "Edit"
  3102. Global Const $wc_header = "SysHeader32"
  3103. Global Const $wc_hotkey = "msctls_hotkey32"
  3104. Global Const $wc_ipaddress = "SysIPAddress32"
  3105. Global Const $wc_link = "SysLink"
  3106. Global Const $wc_listbox = "ListBox"
  3107. Global Const $wc_listview = "SysListView32"
  3108. Global Const $wc_monthcal = "SysMonthCal32"
  3109. Global Const $wc_nativefontctl = "NativeFontCtl"
  3110. Global Const $wc_pagescroller = "SysPager"
  3111. Global Const $wc_progress = "msctls_progress32"
  3112. Global Const $wc_rebar = "ReBarWindow32"
  3113. Global Const $wc_scrollbar = "ScrollBar"
  3114. Global Const $wc_static = "Static"
  3115. Global Const $wc_statusbar = "msctls_statusbar32"
  3116. Global Const $wc_tabcontrol = "SysTabControl32"
  3117. Global Const $wc_toolbar = "ToolbarWindow32"
  3118. Global Const $wc_tooltips = "tooltips_class32"
  3119. Global Const $wc_trackbar = "msctls_trackbar32"
  3120. Global Const $wc_treeview = "SysTreeView32"
  3121. Global Const $wc_updown = "msctls_updown32"
  3122. Global Const $ws_overlapped = 0
  3123. Global Const $ws_tiled = $ws_overlapped
  3124. Global Const $ws_maximizebox = 65536
  3125. Global Const $ws_minimizebox = 131072
  3126. Global Const $ws_tabstop = 65536
  3127. Global Const $ws_group = 131072
  3128. Global Const $ws_sizebox = 262144
  3129. Global Const $ws_thickframe = $ws_sizebox
  3130. Global Const $ws_sysmenu = 524288
  3131. Global Const $ws_hscroll = 1048576
  3132. Global Const $ws_vscroll = 2097152
  3133. Global Const $ws_dlgframe = 4194304
  3134. Global Const $ws_border = 8388608
  3135. Global Const $ws_caption = 12582912
  3136. Global Const $ws_overlappedwindow = BitOR($ws_caption, $ws_maximizebox, $ws_minimizebox, $ws_overlapped, $ws_sysmenu, $ws_thickframe)
  3137. Global Const $ws_tiledwindow = $ws_overlappedwindow
  3138. Global Const $ws_maximize = 16777216
  3139. Global Const $ws_clipchildren = 33554432
  3140. Global Const $ws_clipsiblings = 67108864
  3141. Global Const $ws_disabled = 134217728
  3142. Global Const $ws_visible = 268435456
  3143. Global Const $ws_minimize = 536870912
  3144. Global Const $ws_iconic = $ws_minimize
  3145. Global Const $ws_child = 1073741824
  3146. Global Const $ws_childwindow = $ws_child
  3147. Global Const $ws_popup = -2147483648
  3148. Global Const $ws_popupwindow = -2138570752
  3149. Global Const $ds_3dlook = 4
  3150. Global Const $ds_absalign = 1
  3151. Global Const $ds_center = 2048
  3152. Global Const $ds_centermouse = 4096
  3153. Global Const $ds_contexthelp = 8192
  3154. Global Const $ds_control = 1024
  3155. Global Const $ds_fixedsys = 8
  3156. Global Const $ds_localedit = 32
  3157. Global Const $ds_modalframe = 128
  3158. Global Const $ds_nofailcreate = 16
  3159. Global Const $ds_noidlemsg = 256
  3160. Global Const $ds_setfont = 64
  3161. Global Const $ds_setforeground = 512
  3162. Global Const $ds_shellfont = BitOR($ds_fixedsys, $ds_setfont)
  3163. Global Const $ds_sysmodal = 2
  3164. Global Const $ws_ex_acceptfiles = 16
  3165. Global Const $ws_ex_appwindow = 262144
  3166. Global Const $ws_ex_composited = 33554432
  3167. Global Const $ws_ex_controlparent = 65536
  3168. Global Const $ws_ex_clientedge = 512
  3169. Global Const $ws_ex_contexthelp = 1024
  3170. Global Const $ws_ex_dlgmodalframe = 1
  3171. Global Const $ws_ex_layered = 524288
  3172. Global Const $ws_ex_layoutrtl = 4194304
  3173. Global Const $ws_ex_left = 0
  3174. Global Const $ws_ex_leftscrollbar = 16384
  3175. Global Const $ws_ex_ltrreading = 0
  3176. Global Const $ws_ex_mdichild = 64
  3177. Global Const $ws_ex_noactivate = 134217728
  3178. Global Const $ws_ex_noinheritlayout = 1048576
  3179. Global Const $ws_ex_noparentnotify = 4
  3180. Global Const $ws_ex_right = 4096
  3181. Global Const $ws_ex_rightscrollbar = 0
  3182. Global Const $ws_ex_rtlreading = 8192
  3183. Global Const $ws_ex_staticedge = 131072
  3184. Global Const $ws_ex_toolwindow = 128
  3185. Global Const $ws_ex_topmost = 8
  3186. Global Const $ws_ex_transparent = 32
  3187. Global Const $ws_ex_windowedge = 256
  3188. Global Const $ws_ex_overlappedwindow = BitOR($ws_ex_clientedge, $ws_ex_windowedge)
  3189. Global Const $ws_ex_palettewindow = BitOR($ws_ex_toolwindow, $ws_ex_topmost, $ws_ex_windowedge)
  3190. Global Const $wm_null = 0
  3191. Global Const $wm_create = 1
  3192. Global Const $wm_destroy = 2
  3193. Global Const $wm_move = 3
  3194. Global Const $wm_sizewait = 4
  3195. Global Const $wm_size = 5
  3196. Global Const $wm_activate = 6
  3197. Global Const $wm_setfocus = 7
  3198. Global Const $wm_killfocus = 8
  3199. Global Const $wm_setvisible = 9
  3200. Global Const $wm_enable = 10
  3201. Global Const $wm_setredraw = 11
  3202. Global Const $wm_settext = 12
  3203. Global Const $wm_gettext = 13
  3204. Global Const $wm_gettextlength = 14
  3205. Global Const $wm_paint = 15
  3206. Global Const $wm_close = 16
  3207. Global Const $wm_queryendsession = 17
  3208. Global Const $wm_quit = 18
  3209. Global Const $wm_erasebkgnd = 20
  3210. Global Const $wm_queryopen = 19
  3211. Global Const $wm_syscolorchange = 21
  3212. Global Const $wm_endsession = 22
  3213. Global Const $wm_systemerror = 23
  3214. Global Const $wm_showwindow = 24
  3215. Global Const $wm_ctlcolor = 25
  3216. Global Const $wm_settingchange = 26
  3217. Global Const $wm_wininichange = 26
  3218. Global Const $wm_devmodechange = 27
  3219. Global Const $wm_activateapp = 28
  3220. Global Const $wm_fontchange = 29
  3221. Global Const $wm_timechange = 30
  3222. Global Const $wm_cancelmode = 31
  3223. Global Const $wm_setcursor = 32
  3224. Global Const $wm_mouseactivate = 33
  3225. Global Const $wm_childactivate = 34
  3226. Global Const $wm_queuesync = 35
  3227. Global Const $wm_getminmaxinfo = 36
  3228. Global Const $wm_logoff = 37
  3229. Global Const $wm_painticon = 38
  3230. Global Const $wm_iconerasebkgnd = 39
  3231. Global Const $wm_nextdlgctl = 40
  3232. Global Const $wm_alttabactive = 41
  3233. Global Const $wm_spoolerstatus = 42
  3234. Global Const $wm_drawitem = 43
  3235. Global Const $wm_measureitem = 44
  3236. Global Const $wm_deleteitem = 45
  3237. Global Const $wm_vkeytoitem = 46
  3238. Global Const $wm_chartoitem = 47
  3239. Global Const $wm_setfont = 48
  3240. Global Const $wm_getfont = 49
  3241. Global Const $wm_sethotkey = 50
  3242. Global Const $wm_gethotkey = 51
  3243. Global Const $wm_filesyschange = 52
  3244. Global Const $wm_isactiveicon = 53
  3245. Global Const $wm_queryparkicon = 54
  3246. Global Const $wm_querydragicon = 55
  3247. Global Const $wm_winhelp = 56
  3248. Global Const $wm_compareitem = 57
  3249. Global Const $wm_fullscreen = 58
  3250. Global Const $wm_clientshutdown = 59
  3251. Global Const $wm_ddemlevent = 60
  3252. Global Const $wm_getobject = 61
  3253. Global Const $wm_calcscroll = 63
  3254. Global Const $wm_testing = 64
  3255. Global Const $wm_compacting = 65
  3256. Global Const $wm_otherwindowcreated = 66
  3257. Global Const $wm_otherwindowdestroyed = 67
  3258. Global Const $wm_commnotify = 68
  3259. Global Const $wm_mediastatuschange = 69
  3260. Global Const $wm_windowposchanging = 70
  3261. Global Const $wm_windowposchanged = 71
  3262. Global Const $wm_power = 72
  3263. Global Const $wm_copyglobaldata = 73
  3264. Global Const $wm_copydata = 74
  3265. Global Const $wm_canceljournal = 75
  3266. Global Const $wm_logonnotify = 76
  3267. Global Const $wm_keyf1 = 77
  3268. Global Const $wm_notify = 78
  3269. Global Const $wm_access_window = 79
  3270. Global Const $wm_inputlangchangerequest = 80
  3271. Global Const $wm_inputlangchange = 81
  3272. Global Const $wm_tcard = 82
  3273. Global Const $wm_help = 83
  3274. Global Const $wm_userchanged = 84
  3275. Global Const $wm_notifyformat = 85
  3276. Global Const $wm_qm_activate = 96
  3277. Global Const $wm_hook_do_callback = 97
  3278. Global Const $wm_syscopydata = 98
  3279. Global Const $wm_finaldestroy = 112
  3280. Global Const $wm_measureitem_clientdata = 113
  3281. Global Const $wm_contextmenu = 123
  3282. Global Const $wm_stylechanging = 124
  3283. Global Const $wm_stylechanged = 125
  3284. Global Const $wm_displaychange = 126
  3285. Global Const $wm_geticon = 127
  3286. Global Const $wm_seticon = 128
  3287. Global Const $wm_nccreate = 129
  3288. Global Const $wm_ncdestroy = 130
  3289. Global Const $wm_nccalcsize = 131
  3290. Global Const $wm_nchittest = 132
  3291. Global Const $wm_ncpaint = 133
  3292. Global Const $wm_ncactivate = 134
  3293. Global Const $wm_getdlgcode = 135
  3294. Global Const $wm_syncpaint = 136
  3295. Global Const $wm_synctask = 137
  3296. Global Const $wm_kludgeminrect = 139
  3297. Global Const $wm_lpkdrawswitchwnd = 140
  3298. Global Const $wm_uahdestroywindow = 144
  3299. Global Const $wm_uahdrawmenu = 145
  3300. Global Const $wm_uahdrawmenuitem = 146
  3301. Global Const $wm_uahinitmenu = 147
  3302. Global Const $wm_uahmeasuremenuitem = 148
  3303. Global Const $wm_uahncpaintmenupopup = 149
  3304. Global Const $wm_ncmousemove = 160
  3305. Global Const $wm_nclbuttondown = 161
  3306. Global Const $wm_nclbuttonup = 162
  3307. Global Const $wm_nclbuttondblclk = 163
  3308. Global Const $wm_ncrbuttondown = 164
  3309. Global Const $wm_ncrbuttonup = 165
  3310. Global Const $wm_ncrbuttondblclk = 166
  3311. Global Const $wm_ncmbuttondown = 167
  3312. Global Const $wm_ncmbuttonup = 168
  3313. Global Const $wm_ncmbuttondblclk = 169
  3314. Global Const $wm_ncxbuttondown = 171
  3315. Global Const $wm_ncxbuttonup = 172
  3316. Global Const $wm_ncxbuttondblclk = 173
  3317. Global Const $wm_ncuahdrawcaption = 174
  3318. Global Const $wm_ncuahdrawframe = 175
  3319. Global Const $wm_input_device_change = 254
  3320. Global Const $wm_input = 255
  3321. Global Const $wm_keydown = 256
  3322. Global Const $wm_keyfirst = 256
  3323. Global Const $wm_keyup = 257
  3324. Global Const $wm_char = 258
  3325. Global Const $wm_deadchar = 259
  3326. Global Const $wm_syskeydown = 260
  3327. Global Const $wm_syskeyup = 261
  3328. Global Const $wm_syschar = 262
  3329. Global Const $wm_sysdeadchar = 263
  3330. Global Const $wm_yomichar = 264
  3331. Global Const $wm_keylast = 265
  3332. Global Const $wm_unichar = 265
  3333. Global Const $wm_convertrequest = 266
  3334. Global Const $wm_convertresult = 267
  3335. Global Const $wm_im_info = 268
  3336. Global Const $wm_ime_startcomposition = 269
  3337. Global Const $wm_ime_endcomposition = 270
  3338. Global Const $wm_ime_composition = 271
  3339. Global Const $wm_ime_keylast = 271
  3340. Global Const $wm_initdialog = 272
  3341. Global Const $wm_command = 273
  3342. Global Const $wm_syscommand = 274
  3343. Global Const $wm_timer = 275
  3344. Global Const $wm_hscroll = 276
  3345. Global Const $wm_vscroll = 277
  3346. Global Const $wm_initmenu = 278
  3347. Global Const $wm_initmenupopup = 279
  3348. Global Const $wm_systimer = 280
  3349. Global Const $wm_gesture = 281
  3350. Global Const $wm_gesturenotify = 282
  3351. Global Const $wm_gestureinput = 283
  3352. Global Const $wm_gesturenotified = 284
  3353. Global Const $wm_menuselect = 287
  3354. Global Const $wm_menuchar = 288
  3355. Global Const $wm_enteridle = 289
  3356. Global Const $wm_menurbuttonup = 290
  3357. Global Const $wm_menudrag = 291
  3358. Global Const $wm_menugetobject = 292
  3359. Global Const $wm_uninitmenupopup = 293
  3360. Global Const $wm_menucommand = 294
  3361. Global Const $wm_changeuistate = 295
  3362. Global Const $wm_updateuistate = 296
  3363. Global Const $wm_queryuistate = 297
  3364. Global Const $wm_lbtrackpoint = 305
  3365. Global Const $wm_ctlcolormsgbox = 306
  3366. Global Const $wm_ctlcoloredit = 307
  3367. Global Const $wm_ctlcolorlistbox = 308
  3368. Global Const $wm_ctlcolorbtn = 309
  3369. Global Const $wm_ctlcolordlg = 310
  3370. Global Const $wm_ctlcolorscrollbar = 311
  3371. Global Const $wm_ctlcolorstatic = 312
  3372. Global Const $mn_gethmenu = 481
  3373. Global Const $wm_parentnotify = 528
  3374. Global Const $wm_entermenuloop = 529
  3375. Global Const $wm_exitmenuloop = 530
  3376. Global Const $wm_nextmenu = 531
  3377. Global Const $wm_sizing = 532
  3378. Global Const $wm_capturechanged = 533
  3379. Global Const $wm_moving = 534
  3380. Global Const $wm_powerbroadcast = 536
  3381. Global Const $wm_devicechange = 537
  3382. Global Const $wm_mdicreate = 544
  3383. Global Const $wm_mdidestroy = 545
  3384. Global Const $wm_mdiactivate = 546
  3385. Global Const $wm_mdirestore = 547
  3386. Global Const $wm_mdinext = 548
  3387. Global Const $wm_mdimaximize = 549
  3388. Global Const $wm_mditile = 550
  3389. Global Const $wm_mdicascade = 551
  3390. Global Const $wm_mdiiconarrange = 552
  3391. Global Const $wm_mdigetactive = 553
  3392. Global Const $wm_dropobject = 554
  3393. Global Const $wm_querydropobject = 555
  3394. Global Const $wm_begindrag = 556
  3395. Global Const $wm_dragloop = 557
  3396. Global Const $wm_dragselect = 558
  3397. Global Const $wm_dragmove = 559
  3398. Global Const $wm_mdisetmenu = 560
  3399. Global Const $wm_entersizemove = 561
  3400. Global Const $wm_exitsizemove = 562
  3401. Global Const $wm_dropfiles = 563
  3402. Global Const $wm_mdirefreshmenu = 564
  3403. Global Const $wm_touch = 576
  3404. Global Const $wm_ime_setcontext = 641
  3405. Global Const $wm_ime_notify = 642
  3406. Global Const $wm_ime_control = 643
  3407. Global Const $wm_ime_compositionfull = 644
  3408. Global Const $wm_ime_select = 645
  3409. Global Const $wm_ime_char = 646
  3410. Global Const $wm_ime_system = 647
  3411. Global Const $wm_ime_request = 648
  3412. Global Const $wm_ime_keydown = 656
  3413. Global Const $wm_ime_keyup = 657
  3414. Global Const $wm_ncmousehover = 672
  3415. Global Const $wm_mousehover = 673
  3416. Global Const $wm_ncmouseleave = 674
  3417. Global Const $wm_mouseleave = 675
  3418. Global Const $wm_wtssession_change = 689
  3419. Global Const $wm_tablet_first = 704
  3420. Global Const $wm_tablet_last = 735
  3421. Global Const $wm_cut = 768
  3422. Global Const $wm_copy = 769
  3423. Global Const $wm_paste = 770
  3424. Global Const $wm_clear = 771
  3425. Global Const $wm_undo = 772
  3426. Global Const $wm_paletteischanging = 784
  3427. Global Const $wm_hotkey = 786
  3428. Global Const $wm_palettechanged = 785
  3429. Global Const $wm_sysmenu = 787
  3430. Global Const $wm_hookmsg = 788
  3431. Global Const $wm_exitprocess = 789
  3432. Global Const $wm_wakethread = 790
  3433. Global Const $wm_print = 791
  3434. Global Const $wm_printclient = 792
  3435. Global Const $wm_appcommand = 793
  3436. Global Const $wm_querynewpalette = 783
  3437. Global Const $wm_themechanged = 794
  3438. Global Const $wm_uahinit = 795
  3439. Global Const $wm_desktopnotify = 796
  3440. Global Const $wm_clipboardupdate = 797
  3441. Global Const $wm_dwmcompositionchanged = 798
  3442. Global Const $wm_dwmncrenderingchanged = 799
  3443. Global Const $wm_dwmcolorizationcolorchanged = 800
  3444. Global Const $wm_dwmwindowmaximizedchange = 801
  3445. Global Const $wm_dwmexileframe = 802
  3446. Global Const $wm_dwmsendiconicthumbnail = 803
  3447. Global Const $wm_magnification_started = 804
  3448. Global Const $wm_magnification_ended = 805
  3449. Global Const $wm_dwmsendiconiclivepreviewbitmap = 806
  3450. Global Const $wm_dwmthumbnailsizechanged = 807
  3451. Global Const $wm_magnification_output = 808
  3452. Global Const $wm_measurecontrol = 816
  3453. Global Const $wm_getactiontext = 817
  3454. Global Const $wm_forwardkeydown = 819
  3455. Global Const $wm_forwardkeyup = 820
  3456. Global Const $wm_gettitlebarinfoex = 831
  3457. Global Const $wm_notifywow = 832
  3458. Global Const $wm_handheldfirst = 856
  3459. Global Const $wm_handheldlast = 863
  3460. Global Const $wm_afxfirst = 864
  3461. Global Const $wm_afxlast = 895
  3462. Global Const $wm_penwinfirst = 896
  3463. Global Const $wm_penwinlast = 911
  3464. Global Const $wm_dde_initiate = 992
  3465. Global Const $wm_dde_terminate = 993
  3466. Global Const $wm_dde_advise = 994
  3467. Global Const $wm_dde_unadvise = 995
  3468. Global Const $wm_dde_ack = 996
  3469. Global Const $wm_dde_data = 997
  3470. Global Const $wm_dde_request = 998
  3471. Global Const $wm_dde_poke = 999
  3472. Global Const $wm_dde_execute = 1000
  3473. Global Const $wm_dbnotification = 1021
  3474. Global Const $wm_netconnect = 1022
  3475. Global Const $wm_hibernate = 1023
  3476. Global Const $wm_user = 1024
  3477. Global Const $wm_app = 32768
  3478. Global Const $nm_first = 0
  3479. Global Const $nm_outofmemory = $nm_first - 1
  3480. Global Const $nm_click = $nm_first - 2
  3481. Global Const $nm_dblclk = $nm_first - 3
  3482. Global Const $nm_return = $nm_first - 4
  3483. Global Const $nm_rclick = $nm_first - 5
  3484. Global Const $nm_rdblclk = $nm_first - 6
  3485. Global Const $nm_setfocus = $nm_first - 7
  3486. Global Const $nm_killfocus = $nm_first - 8
  3487. Global Const $nm_customdraw = $nm_first - 12
  3488. Global Const $nm_hover = $nm_first - 13
  3489. Global Const $nm_nchittest = $nm_first - 14
  3490. Global Const $nm_keydown = $nm_first - 15
  3491. Global Const $nm_releasedcapture = $nm_first - 16
  3492. Global Const $nm_setcursor = $nm_first - 17
  3493. Global Const $nm_char = $nm_first - 18
  3494. Global Const $nm_tooltipscreated = $nm_first - 19
  3495. Global Const $nm_ldown = $nm_first - 20
  3496. Global Const $nm_rdown = $nm_first - 21
  3497. Global Const $nm_themechanged = $nm_first - 22
  3498. Global Const $wm_mousefirst = 512
  3499. Global Const $wm_mousemove = 512
  3500. Global Const $wm_lbuttondown = 513
  3501. Global Const $wm_lbuttonup = 514
  3502. Global Const $wm_lbuttondblclk = 515
  3503. Global Const $wm_rbuttondown = 516
  3504. Global Const $wm_rbuttonup = 517
  3505. Global Const $wm_rbuttondblclk = 518
  3506. Global Const $wm_mbuttondown = 519
  3507. Global Const $wm_mbuttonup = 520
  3508. Global Const $wm_mbuttondblclk = 521
  3509. Global Const $wm_mousewheel = 522
  3510. Global Const $wm_xbuttondown = 523
  3511. Global Const $wm_xbuttonup = 524
  3512. Global Const $wm_xbuttondblclk = 525
  3513. Global Const $wm_mousehwheel = 526
  3514. Global Const $ps_solid = 0
  3515. Global Const $ps_dash = 1
  3516. Global Const $ps_dot = 2
  3517. Global Const $ps_dashdot = 3
  3518. Global Const $ps_dashdotdot = 4
  3519. Global Const $ps_null = 5
  3520. Global Const $ps_insideframe = 6
  3521. Global Const $ps_userstyle = 7
  3522. Global Const $ps_alternate = 8
  3523. Global Const $ps_endcap_round = 0
  3524. Global Const $ps_endcap_square = 256
  3525. Global Const $ps_endcap_flat = 512
  3526. Global Const $ps_join_bevel = 4096
  3527. Global Const $ps_join_miter = 8192
  3528. Global Const $ps_join_round = 0
  3529. Global Const $ps_geometric = 65536
  3530. Global Const $ps_cosmetic = 0
  3531. Global Const $lwa_alpha = 2
  3532. Global Const $lwa_colorkey = 1
  3533. Global Const $rgn_and = 1
  3534. Global Const $rgn_or = 2
  3535. Global Const $rgn_xor = 3
  3536. Global Const $rgn_diff = 4
  3537. Global Const $rgn_copy = 5
  3538. Global Const $errorregion = 0
  3539. Global Const $nullregion = 1
  3540. Global Const $simpleregion = 2
  3541. Global Const $complexregion = 3
  3542. Global Const $transparent = 1
  3543. Global Const $opaque = 2
  3544. Global Const $ccm_first = 8192
  3545. Global Const $ccm_getunicodeformat = ($ccm_first + 6)
  3546. Global Const $ccm_setunicodeformat = ($ccm_first + 5)
  3547. Global Const $ccm_setbkcolor = $ccm_first + 1
  3548. Global Const $ccm_setcolorscheme = $ccm_first + 2
  3549. Global Const $ccm_getcolorscheme = $ccm_first + 3
  3550. Global Const $ccm_getdroptarget = $ccm_first + 4
  3551. Global Const $ccm_setwindowtheme = $ccm_first + 11
  3552. Global Const $ga_parent = 1
  3553. Global Const $ga_root = 2
  3554. Global Const $ga_rootowner = 3
  3555. Global Const $sm_cxscreen = 0
  3556. Global Const $sm_cyscreen = 1
  3557. Global Const $sm_cxvscroll = 2
  3558. Global Const $sm_cyhscroll = 3
  3559. Global Const $sm_cycaption = 4
  3560. Global Const $sm_cxborder = 5
  3561. Global Const $sm_cyborder = 6
  3562. Global Const $sm_cxdlgframe = 7
  3563. Global Const $sm_cydlgframe = 8
  3564. Global Const $sm_cyvthumb = 9
  3565. Global Const $sm_cxhthumb = 10
  3566. Global Const $sm_cxicon = 11
  3567. Global Const $sm_cyicon = 12
  3568. Global Const $sm_cxcursor = 13
  3569. Global Const $sm_cycursor = 14
  3570. Global Const $sm_cymenu = 15
  3571. Global Const $sm_cxfullscreen = 16
  3572. Global Const $sm_cyfullscreen = 17
  3573. Global Const $sm_cykanjiwindow = 18
  3574. Global Const $sm_mousepresent = 19
  3575. Global Const $sm_cyvscroll = 20
  3576. Global Const $sm_cxhscroll = 21
  3577. Global Const $sm_debug = 22
  3578. Global Const $sm_swapbutton = 23
  3579. Global Const $sm_reserved1 = 24
  3580. Global Const $sm_reserved2 = 25
  3581. Global Const $sm_reserved3 = 26
  3582. Global Const $sm_reserved4 = 27
  3583. Global Const $sm_cxmin = 28
  3584. Global Const $sm_cymin = 29
  3585. Global Const $sm_cxsize = 30
  3586. Global Const $sm_cysize = 31
  3587. Global Const $sm_cxframe = 32
  3588. Global Const $sm_cyframe = 33
  3589. Global Const $sm_cxmintrack = 34
  3590. Global Const $sm_cymintrack = 35
  3591. Global Const $sm_cxdoubleclk = 36
  3592. Global Const $sm_cydoubleclk = 37
  3593. Global Const $sm_cxiconspacing = 38
  3594. Global Const $sm_cyiconspacing = 39
  3595. Global Const $sm_menudropalignment = 40
  3596. Global Const $sm_penwindows = 41
  3597. Global Const $sm_dbcsenabled = 42
  3598. Global Const $sm_cmousebuttons = 43
  3599. Global Const $sm_secure = 44
  3600. Global Const $sm_cxedge = 45
  3601. Global Const $sm_cyedge = 46
  3602. Global Const $sm_cxminspacing = 47
  3603. Global Const $sm_cyminspacing = 48
  3604. Global Const $sm_cxsmicon = 49
  3605. Global Const $sm_cysmicon = 50
  3606. Global Const $sm_cysmcaption = 51
  3607. Global Const $sm_cxsmsize = 52
  3608. Global Const $sm_cysmsize = 53
  3609. Global Const $sm_cxmenusize = 54
  3610. Global Const $sm_cymenusize = 55
  3611. Global Const $sm_arrange = 56
  3612. Global Const $sm_cxminimized = 57
  3613. Global Const $sm_cyminimized = 58
  3614. Global Const $sm_cxmaxtrack = 59
  3615. Global Const $sm_cymaxtrack = 60
  3616. Global Const $sm_cxmaximized = 61
  3617. Global Const $sm_cymaximized = 62
  3618. Global Const $sm_network = 63
  3619. Global Const $sm_cleanboot = 67
  3620. Global Const $sm_cxdrag = 68
  3621. Global Const $sm_cydrag = 69
  3622. Global Const $sm_showsounds = 70
  3623. Global Const $sm_cxmenucheck = 71
  3624. Global Const $sm_cymenucheck = 72
  3625. Global Const $sm_slowmachine = 73
  3626. Global Const $sm_mideastenabled = 74
  3627. Global Const $sm_mousewheelpresent = 75
  3628. Global Const $sm_xvirtualscreen = 76
  3629. Global Const $sm_yvirtualscreen = 77
  3630. Global Const $sm_cxvirtualscreen = 78
  3631. Global Const $sm_cyvirtualscreen = 79
  3632. Global Const $sm_cmonitors = 80
  3633. Global Const $sm_samedisplayformat = 81
  3634. Global Const $sm_immenabled = 82
  3635. Global Const $sm_cxfocusborder = 83
  3636. Global Const $sm_cyfocusborder = 84
  3637. Global Const $sm_tabletpc = 86
  3638. Global Const $sm_mediacenter = 87
  3639. Global Const $sm_starter = 88
  3640. Global Const $sm_serverr2 = 89
  3641. Global Const $sm_cmetrics = 90
  3642. Global Const $sm_remotesession = 4096
  3643. Global Const $sm_shuttingdown = 8192
  3644. Global Const $sm_remotecontrol = 8193
  3645. Global Const $sm_caretblinkingenabled = 8194
  3646. Global Const $blackness = 66
  3647. Global Const $captureblt = 1073741824
  3648. Global Const $dstinvert = 5570569
  3649. Global Const $mergecopy = 12583114
  3650. Global Const $mergepaint = 12255782
  3651. Global Const $nomirrorbitmap = -2147483648
  3652. Global Const $notsrccopy = 3342344
  3653. Global Const $notsrcerase = 1114278
  3654. Global Const $patcopy = 15728673
  3655. Global Const $patinvert = 5898313
  3656. Global Const $patpaint = 16452105
  3657. Global Const $srcand = 8913094
  3658. Global Const $srccopy = 13369376
  3659. Global Const $srcerase = 4457256
  3660. Global Const $srcinvert = 6684742
  3661. Global Const $srcpaint = 15597702
  3662. Global Const $whiteness = 16711778
  3663. Global Const $dt_bottom = 8
  3664. Global Const $dt_calcrect = 1024
  3665. Global Const $dt_center = 1
  3666. Global Const $dt_editcontrol = 8192
  3667. Global Const $dt_end_ellipsis = 32768
  3668. Global Const $dt_expandtabs = 64
  3669. Global Const $dt_externalleading = 512
  3670. Global Const $dt_hideprefix = 1048576
  3671. Global Const $dt_internal = 4096
  3672. Global Const $dt_left = 0
  3673. Global Const $dt_modifystring = 65536
  3674. Global Const $dt_noclip = 256
  3675. Global Const $dt_nofullwidthcharbreak = 524288
  3676. Global Const $dt_noprefix = 2048
  3677. Global Const $dt_path_ellipsis = 16384
  3678. Global Const $dt_prefixonly = 2097152
  3679. Global Const $dt_right = 2
  3680. Global Const $dt_rtlreading = 131072
  3681. Global Const $dt_singleline = 32
  3682. Global Const $dt_tabstop = 128
  3683. Global Const $dt_top = 0
  3684. Global Const $dt_vcenter = 4
  3685. Global Const $dt_wordbreak = 16
  3686. Global Const $dt_word_ellipsis = 262144
  3687. Global Const $rdw_erase = 4
  3688. Global Const $rdw_frame = 1024
  3689. Global Const $rdw_internalpaint = 2
  3690. Global Const $rdw_invalidate = 1
  3691. Global Const $rdw_noerase = 32
  3692. Global Const $rdw_noframe = 2048
  3693. Global Const $rdw_nointernalpaint = 16
  3694. Global Const $rdw_validate = 8
  3695. Global Const $rdw_erasenow = 512
  3696. Global Const $rdw_updatenow = 256
  3697. Global Const $rdw_allchildren = 128
  3698. Global Const $rdw_nochildren = 64
  3699. Global Const $wm_renderformat = 773
  3700. Global Const $wm_renderallformats = 774
  3701. Global Const $wm_destroyclipboard = 775
  3702. Global Const $wm_drawclipboard = 776
  3703. Global Const $wm_paintclipboard = 777
  3704. Global Const $wm_vscrollclipboard = 778
  3705. Global Const $wm_sizeclipboard = 779
  3706. Global Const $wm_askcbformatname = 780
  3707. Global Const $wm_changecbchain = 781
  3708. Global Const $wm_hscrollclipboard = 782
  3709. Global Const $hterror = -2
  3710. Global Const $httransparent = -1
  3711. Global Const $htnowhere = 0
  3712. Global Const $htclient = 1
  3713. Global Const $htcaption = 2
  3714. Global Const $htsysmenu = 3
  3715. Global Const $htgrowbox = 4
  3716. Global Const $htsize = $htgrowbox
  3717. Global Const $htmenu = 5
  3718. Global Const $hthscroll = 6
  3719. Global Const $htvscroll = 7
  3720. Global Const $htminbutton = 8
  3721. Global Const $htmaxbutton = 9
  3722. Global Const $htleft = 10
  3723. Global Const $htright = 11
  3724. Global Const $httop = 12
  3725. Global Const $httopleft = 13
  3726. Global Const $httopright = 14
  3727. Global Const $htbottom = 15
  3728. Global Const $htbottomleft = 16
  3729. Global Const $htbottomright = 17
  3730. Global Const $htborder = 18
  3731. Global Const $htreduce = $htminbutton
  3732. Global Const $htzoom = $htmaxbutton
  3733. Global Const $htsizefirst = $htleft
  3734. Global Const $htsizelast = $htbottomright
  3735. Global Const $htobject = 19
  3736. Global Const $htclose = 20
  3737. Global Const $hthelp = 21
  3738. Global Const $color_scrollbar = 0
  3739. Global Const $color_background = 1
  3740. Global Const $color_activecaption = 2
  3741. Global Const $color_inactivecaption = 3
  3742. Global Const $color_menu = 4
  3743. Global Const $color_window = 5
  3744. Global Const $color_windowframe = 6
  3745. Global Const $color_menutext = 7
  3746. Global Const $color_windowtext = 8
  3747. Global Const $color_captiontext = 9
  3748. Global Const $color_activeborder = 10
  3749. Global Const $color_inactiveborder = 11
  3750. Global Const $color_appworkspace = 12
  3751. Global Const $color_highlight = 13
  3752. Global Const $color_highlighttext = 14
  3753. Global Const $color_btnface = 15
  3754. Global Const $color_btnshadow = 16
  3755. Global Const $color_graytext = 17
  3756. Global Const $color_btntext = 18
  3757. Global Const $color_inactivecaptiontext = 19
  3758. Global Const $color_btnhighlight = 20
  3759. Global Const $color_3ddkshadow = 21
  3760. Global Const $color_3dlight = 22
  3761. Global Const $color_infotext = 23
  3762. Global Const $color_infobk = 24
  3763. Global Const $color_hotlight = 26
  3764. Global Const $color_gradientactivecaption = 27
  3765. Global Const $color_gradientinactivecaption = 28
  3766. Global Const $color_menuhilight = 29
  3767. Global Const $color_menubar = 30
  3768. Global Const $color_desktop = 1
  3769. Global Const $color_3dface = 15
  3770. Global Const $color_3dshadow = 16
  3771. Global Const $color_3dhighlight = 20
  3772. Global Const $color_3dhilight = 20
  3773. Global Const $color_btnhilight = 20
  3774. Global Const $hinst_commctrl = -1
  3775. Global Const $idb_std_small_color = 0
  3776. Global Const $idb_std_large_color = 1
  3777. Global Const $idb_view_small_color = 4
  3778. Global Const $idb_view_large_color = 5
  3779. Global Const $idb_hist_small_color = 8
  3780. Global Const $idb_hist_large_color = 9
  3781. Global Const $startf_forceofffeedback = 128
  3782. Global Const $startf_forceonfeedback = 64
  3783. Global Const $startf_preventpinning = 8192
  3784. Global Const $startf_runfullscreen = 32
  3785. Global Const $startf_titleisappid = 4096
  3786. Global Const $startf_titleislinkname = 2048
  3787. Global Const $startf_usecountchars = 8
  3788. Global Const $startf_usefillattribute = 16
  3789. Global Const $startf_usehotkey = 512
  3790. Global Const $startf_useposition = 4
  3791. Global Const $startf_useshowwindow = 1
  3792. Global Const $startf_usesize = 2
  3793. Global Const $startf_usestdhandles = 256
  3794. Global Const $cdds_prepaint = 1
  3795. Global Const $cdds_postpaint = 2
  3796. Global Const $cdds_preerase = 3
  3797. Global Const $cdds_posterase = 4
  3798. Global Const $cdds_item = 65536
  3799. Global Const $cdds_itemprepaint = 65537
  3800. Global Const $cdds_itempostpaint = 65538
  3801. Global Const $cdds_itempreerase = 65539
  3802. Global Const $cdds_itemposterase = 65540
  3803. Global Const $cdds_subitem = 131072
  3804. Global Const $cdis_selected = 1
  3805. Global Const $cdis_grayed = 2
  3806. Global Const $cdis_disabled = 4
  3807. Global Const $cdis_checked = 8
  3808. Global Const $cdis_focus = 16
  3809. Global Const $cdis_default = 32
  3810. Global Const $cdis_hot = 64
  3811. Global Const $cdis_marked = 128
  3812. Global Const $cdis_indeterminate = 256
  3813. Global Const $cdis_showkeyboardcues = 512
  3814. Global Const $cdis_nearhot = 1024
  3815. Global Const $cdis_othersidehot = 2048
  3816. Global Const $cdis_drophilited = 4096
  3817. Global Const $cdrf_dodefault = 0
  3818. Global Const $cdrf_newfont = 2
  3819. Global Const $cdrf_skipdefault = 4
  3820. Global Const $cdrf_notifypostpaint = 16
  3821. Global Const $cdrf_notifyitemdraw = 32
  3822. Global Const $cdrf_notifysubitemdraw = 32
  3823. Global Const $cdrf_notifyposterase = 64
  3824. Global Const $cdrf_doerase = 8
  3825. Global Const $cdrf_skippostpaint = 256
  3826. Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  3827.  
  3828. Func _gs_settingsgui()
  3829.         Local $label1, $hsection, $label10, $hfriendly, $hprocess, $label11, $label12, $hstyle, $hidentifier, $label2, $hidentifierdel, $label7, $hwidth, $label8, $hheight, $label13, $label14, $hposx, $label15, $hposy, $hsave, $happly, $hmanagemouse, $hmousewindow, $hmousehide, $hdelete, $a, $s, $i, $nmsg
  3830.         If _singleton("GS_WindowedBorderlessGaming", 1) = 0 Then
  3831.                 WinActivate("[TITLE:Game Settings - " & $sappname & "; CLASS:AutoIt v3 GUI;]")
  3832.                 Exit (0)
  3833.         EndIf
  3834.         Opt("GUICloseOnESC", 0)
  3835.         Local $hwnd = GUICreate("Game Settings - Windowed Borderless Gaming", 420, 517)
  3836.         GUISetFont(10, 400, 0, "MS Sans Serif")
  3837.         GUICtrlCreateGroup("General", 5, 5, 410, 217)
  3838.         $label1 = GUICtrlCreateLabel("Game:", 10, 25, 82, 25, $ss_centerimage)
  3839.         $hsection = GUICtrlCreateCombo("", 120, 26, 265, 25, BitOR($gui_ss_default_combo, $cbs_simple, $ws_hscroll, 256))
  3840.         $label10 = GUICtrlCreateLabel("Friendly Name:", 10, 60, 106, 25, $ss_centerimage)
  3841.         $hfriendly = GUICtrlCreateInput("", 120, 60, 265, 24)
  3842.         $hprocess = GUICtrlCreateInput("", 120, 90, 265, 24, BitOR($gui_ss_default_input, $es_center))
  3843.         GUICtrlSetState($hprocess, $gui_disable)
  3844.         GUICtrlSetTip($hprocess, "The process this window belongs too.")
  3845.         $label11 = GUICtrlCreateLabel("Process:", 10, 90, 58, 25, $ss_centerimage)
  3846.         GUICtrlSetTip($label11, "The process this window belongs too.")
  3847.         $label12 = GUICtrlCreateLabel("Style:", 10, 120, 58, 25, $ss_centerimage)
  3848.         GUICtrlSetTip($label12, "The style the window should have before changing it.")
  3849.         $hstyle = GUICtrlCreateInput("", 120, 120, 265, 24, BitOR($gui_ss_default_input, $es_center))
  3850.         GUICtrlSetState($hstyle, $gui_disable)
  3851.         GUICtrlSetTip($hstyle, "The style the window should have before changing it.")
  3852.         $hidentifier = GUICtrlCreateInput("", 120, 150, 265, 24, BitOR($gui_ss_default_input, $es_center))
  3853.         GUICtrlSetState($hidentifier, $gui_disable)
  3854.         GUICtrlSetTip($hidentifier, "The style the window should have before changing it.")
  3855.         $label2 = GUICtrlCreateLabel("Identifier:", 10, 150, 74, 25, $ss_centerimage)
  3856.         GUICtrlSetTip($label2, "The style the window should have before changing it.")
  3857.         $hidentifierdel = GUICtrlCreateButton("Remove title from identifier", 120, 180, 265, 25)
  3858.         GUICtrlSetTip($hidentifierdel, "Can not be undone!")
  3859.         GUICtrlCreateGroup("", -99, -99, 1, 1)
  3860.         GUICtrlCreateGroup("Size && Offset", 5, 232, 410, 89)
  3861.         $label7 = GUICtrlCreateLabel("Resolution:", 10, 252, 90, 25, $ss_centerimage)
  3862.         $hwidth = GUICtrlCreateInput("", 120, 252, 57, 24, BitOR($gui_ss_default_input, $es_center, $es_number))
  3863.         GUICtrlSetTip($hwidth, "Width")
  3864.         $label8 = GUICtrlCreateLabel("X", 178, 252, 25, 25, BitOR($ss_center, $ss_centerimage))
  3865.         $hheight = GUICtrlCreateInput("", 208, 252, 57, 24, BitOR($gui_ss_default_input, $es_center, $es_number))
  3866.         GUICtrlSetTip($hheight, "Height")
  3867.         $label13 = GUICtrlCreateLabel("Offset:", 10, 282, 58, 25, $ss_centerimage)
  3868.         $label14 = GUICtrlCreateLabel("X:", 90, 282, 25, 25, BitOR($ss_center, $ss_centerimage))
  3869.         GUICtrlSetFont($label14, 10, 800, 0, "MS Sans Serif")
  3870.         GUICtrlSetTip($label14, "Horizontal")
  3871.         $hposx = GUICtrlCreateInput("", 120, 282, 57, 24, BitOR($gui_ss_default_input, $es_center))
  3872.         GUICtrlSetTip($hposx, "Horizontal")
  3873.         $label15 = GUICtrlCreateLabel("Y:", 178, 282, 25, 25, BitOR($ss_center, $ss_centerimage))
  3874.         GUICtrlSetFont($label15, 10, 800, 0, "MS Sans Serif")
  3875.         GUICtrlSetTip($label15, "Vertical")
  3876.         $hposy = GUICtrlCreateInput("", 208, 282, 57, 24, BitOR($gui_ss_default_input, $es_center))
  3877.         GUICtrlSetTip($hposy, "Vertical")
  3878.         GUICtrlCreateGroup("", -99, -99, 1, 1)
  3879.         GUICtrlCreateGroup("Mouse options", 5, 329, 410, 105)
  3880.         $hmanagemouse = GUICtrlCreateCheckbox("Manage mouse", 10, 349, 129, 25)
  3881.         GUIStartGroup()
  3882.         $hmousewindow = GUICtrlCreateRadio("Lock to game window", 10, 374, 201, 25)
  3883.         GUICtrlSetState($hmousewindow, $gui_checked)
  3884.         GUICtrlSetFont($hmousewindow, 10, 400, 0, "MS Sans Serif")
  3885.         GUICtrlSetState($hmousewindow, $gui_disable)
  3886.         $hmousehide = GUICtrlCreateRadio("Lock to hide", 10, 399, 145, 25)
  3887.         GUICtrlSetFont($hmousehide, 10, 400, 0, "MS Sans Serif")
  3888.         GUICtrlSetState($hmousehide, $gui_disable)
  3889.         GUIStartGroup()
  3890.         GUICtrlCreateGroup("", -99, -99, 1, 1)
  3891.         $hsave = GUICtrlCreateButton("&Ok", 5, 456, 125, 25)
  3892.         GUICtrlSetTip($hsave, "Close window.")
  3893.         $hdelete = GUICtrlCreateButton("&Delete", 145, 456, 125, 25)
  3894.         GUICtrlSetTip($hdelete, "Stop managing this game.")
  3895.         $happly = GUICtrlCreateButton("&Apply", 290, 456, 125, 25)
  3896.         GUICtrlSetTip($happly, "If the window exists then these settings will be aplied now.")
  3897.         Local $agamelist = _gs_getgames($hsection)
  3898.         Local $sactivegame = _gs_getcurrentsection($hsection, $agamelist)
  3899.         GUICtrlSetData($hfriendly, GUICtrlRead($hsection))
  3900.         GUICtrlSetData($hprocess, IniRead($sini, $sactivegame, "Process", "ERROR"))
  3901.         GUICtrlSetData($hstyle, IniRead($sini, $sactivegame, "Style", "ERROR"))
  3902.         GUICtrlSetData($hidentifier, $sactivegame)
  3903.         GUICtrlSetData($hwidth, IniRead($sini, $sactivegame, "Width", ""))
  3904.         GUICtrlSetData($hheight, IniRead($sini, $sactivegame, "Height", ""))
  3905.         GUICtrlSetData($hposx, IniRead($sini, $sactivegame, "PosX", 0))
  3906.         GUICtrlSetData($hposy, IniRead($sini, $sactivegame, "PosY", 0))
  3907.         If IniRead($sini, $sactivegame, "MouseLock", "never") = "never" Then
  3908.                 GUICtrlSetState($hmanagemouse, 4)
  3909.                 GUICtrlSetState($hmousewindow, 128 + 1)
  3910.                 GUICtrlSetState($hmousehide, 128 + 4)
  3911.         ElseIf IniRead($sini, $sactivegame, "MouseLock", "never") = "window" Then
  3912.                 GUICtrlSetState($hmanagemouse, 1)
  3913.                 GUICtrlSetState($hmousewindow, 64 + 1)
  3914.                 GUICtrlSetState($hmousehide, 64 + 4)
  3915.         ElseIf IniRead($sini, $sactivegame, "MouseLock", "never") = "hidden" Then
  3916.                 GUICtrlSetState($hmanagemouse, 1)
  3917.                 GUICtrlSetState($hmousewindow, 64 + 4)
  3918.                 GUICtrlSetState($hmousehide, 64 + 1)
  3919.         EndIf
  3920.         GUISetState(@SW_SHOW)
  3921.         WinSetOnTop($hwnd, "", 1)
  3922.         While 1
  3923.                 $nmsg = GUIGetMsg()
  3924.                 Switch $nmsg
  3925.                         Case $gui_event_close
  3926.                                 ControlClick($hwnd, "", $hsave, "primary")
  3927.                         Case $hsection
  3928.                                 $sactivegame = _gs_getcurrentsection($hsection, $agamelist)
  3929.                                 GUICtrlSetData($hfriendly, GUICtrlRead($hsection))
  3930.                                 GUICtrlSetData($hprocess, IniRead($sini, $sactivegame, "Process", "ERROR"))
  3931.                                 GUICtrlSetData($hstyle, IniRead($sini, $sactivegame, "Style", "ERROR"))
  3932.                                 GUICtrlSetData($hidentifier, $sactivegame)
  3933.                                 GUICtrlSetData($hwidth, IniRead($sini, $sactivegame, "Width", ""))
  3934.                                 GUICtrlSetData($hheight, IniRead($sini, $sactivegame, "Height", ""))
  3935.                                 GUICtrlSetData($hposx, IniRead($sini, $sactivegame, "PosX", 0))
  3936.                                 GUICtrlSetData($hposy, IniRead($sini, $sactivegame, "PosY", 0))
  3937.                                 If IniRead($sini, $sactivegame, "MouseLock", "never") = "never" Then
  3938.                                         GUICtrlSetState($hmanagemouse, 4)
  3939.                                         GUICtrlSetState($hmousewindow, 128 + 1)
  3940.                                         GUICtrlSetState($hmousehide, 128 + 4)
  3941.                                 ElseIf IniRead($sini, $sactivegame, "MouseLock", "never") = "window" Then
  3942.                                         GUICtrlSetState($hmanagemouse, 1)
  3943.                                         GUICtrlSetState($hmousewindow, 64 + 1)
  3944.                                         GUICtrlSetState($hmousehide, 64 + 4)
  3945.                                 ElseIf IniRead($sini, $sactivegame, "MouseLock", "never") = "hidden" Then
  3946.                                         GUICtrlSetState($hmanagemouse, 1)
  3947.                                         GUICtrlSetState($hmousewindow, 64 + 4)
  3948.                                         GUICtrlSetState($hmousehide, 64 + 1)
  3949.                                 EndIf
  3950.                         Case $hfriendly
  3951.                                 IniWrite($sini, $sactivegame, "friendlyname", "")
  3952.                                 $s = _gs_getuniquefriendlyname(GUICtrlRead($hfriendly))
  3953.                                 IniWrite($sini, $sactivegame, "friendlyname", $s)
  3954.                                 IniWrite($sini, "Global_Config", "LastUsed", $s)
  3955.                                 GUICtrlSetData($hsection, "")
  3956.                                 $agamelist = _gs_getgames($hsection)
  3957.                         Case $hidentifierdel
  3958.                                 If MsgBox(4 + 32, $sappname, "This action can not be undone, continue?", 0, $hwnd) = 6 Then
  3959.                                         GUICtrlSetData($hidentifier, StringRegExpReplace(GUICtrlRead($hidentifier), "(?i)(Title\:.*;Class)", "Class"))
  3960.                                         $a = IniReadSection($sini, $sactivegame)
  3961.                                         IniDelete($sini, $sactivegame)
  3962.                                         IniWriteSection($sini, GUICtrlRead($hidentifier), $a)
  3963.                                         IniWrite($sini, "Global_Config", "LastUsed", GUICtrlRead($hsection))
  3964.                                         GUICtrlSetData($hsection, "")
  3965.                                         $agamelist = _gs_getgames($hsection)
  3966.                                         $sactivegame = _gs_getcurrentsection($hsection, $agamelist)
  3967.                                 EndIf
  3968.                         Case $hwidth
  3969.                                 If GUICtrlRead($hwidth) <> "" AND GUICtrlRead($hheight) <> "" Then
  3970.                                         IniWrite($sini, $sactivegame, "Width", GUICtrlRead($hwidth))
  3971.                                         IniWrite($sini, $sactivegame, "Height", GUICtrlRead($hheight))
  3972.                                 ElseIf GUICtrlRead($hwidth) = "" Then
  3973.                                         IniDelete($sini, $sactivegame, "Width")
  3974.                                         IniDelete($sini, $sactivegame, "Height")
  3975.                                         GUICtrlSetData($hheight, "")
  3976.                                 EndIf
  3977.                         Case $hheight
  3978.                                 If GUICtrlRead($hwidth) <> "" AND GUICtrlRead($hheight) <> "" Then
  3979.                                         IniWrite($sini, $sactivegame, "Width", GUICtrlRead($hwidth))
  3980.                                         IniWrite($sini, $sactivegame, "Height", GUICtrlRead($hheight))
  3981.                                 ElseIf GUICtrlRead($hheight) = "" Then
  3982.                                         IniDelete($sini, $sactivegame, "Width")
  3983.                                         IniDelete($sini, $sactivegame, "Height")
  3984.                                         GUICtrlSetData($hwidth, "")
  3985.                                 EndIf
  3986.                         Case $hposx
  3987.                                 GUICtrlSetData($hposx, Number(StringRegExpReplace(GUICtrlRead($hposx), "[^0-9\-]", "")))
  3988.                                 $i = GUICtrlRead($hposx)
  3989.                                 If $i = 0 OR $i = "" Then IniDelete($sini, $sactivegame, "PosX")
  3990.                                 If $i <> 0 AND $i <> "" Then IniWrite($sini, $sactivegame, "PosX", $i)
  3991.                         Case $hposy
  3992.                                 GUICtrlSetData($hposy, Number(StringRegExpReplace(GUICtrlRead($hposy), "[^0-9\-]", "")))
  3993.                                 $i = GUICtrlRead($hposy)
  3994.                                 If $i = 0 OR $i = "" Then IniDelete($sini, $sactivegame, "PosY")
  3995.                                 If $i <> 0 AND $i <> "" Then IniWrite($sini, $sactivegame, "PosY", $i)
  3996.                         Case $hsave
  3997.                                 IniWrite($sini, "Global_Config", "LastUsed", GUICtrlRead($hsection))
  3998.                                 Exit
  3999.                         Case $hmanagemouse
  4000.                                 If GUICtrlRead($hmanagemouse) = 4 Then
  4001.                                         GUICtrlSetState($hmousewindow, 128)
  4002.                                         GUICtrlSetState($hmousehide, 128)
  4003.                                         IniDelete($sini, $sactivegame, "MouseLock")
  4004.                                 Else
  4005.                                         GUICtrlSetState($hmousewindow, 64)
  4006.                                         GUICtrlSetState($hmousehide, 64)
  4007.                                         If GUICtrlRead($hmousewindow) = 1 Then IniWrite($sini, $sactivegame, "MouseLock", "window")
  4008.                                         If GUICtrlRead($hmousehide) = 1 Then IniWrite($sini, $sactivegame, "MouseLock", "hidden")
  4009.                                 EndIf
  4010.                         Case $hmousewindow
  4011.                                 If GUICtrlRead($hmousewindow) = 1 Then IniWrite($sini, $sactivegame, "MouseLock", "window")
  4012.                                 If GUICtrlRead($hmousehide) = 1 Then IniWrite($sini, $sactivegame, "MouseLock", "hidden")
  4013.                         Case $hmousehide
  4014.                                 If GUICtrlRead($hmousewindow) = 1 Then IniWrite($sini, $sactivegame, "MouseLock", "window")
  4015.                                 If GUICtrlRead($hmousehide) = 1 Then IniWrite($sini, $sactivegame, "MouseLock", "hidden")
  4016.                         Case $hdelete
  4017.                                 If MsgBox(4 + 32, $sappname, "Stop managing this game's borderless settings?", 0, $hwnd) = 6 Then
  4018.                                         IniDelete($sini, $sactivegame)
  4019.                                         IniDelete($sini, "Global_Config", "LastUsed")
  4020.                                         $agamelist = _gs_getgames($hsection)
  4021.                                         $sactivegame = _gs_getcurrentsection($hsection, $agamelist)
  4022.                                         GUICtrlSetData($hfriendly, GUICtrlRead($hsection))
  4023.                                         GUICtrlSetData($hprocess, IniRead($sini, $sactivegame, "Process", "ERROR"))
  4024.                                         GUICtrlSetData($hstyle, IniRead($sini, $sactivegame, "Style", "ERROR"))
  4025.                                         GUICtrlSetData($hidentifier, $sactivegame)
  4026.                                         GUICtrlSetData($hwidth, IniRead($sini, $sactivegame, "Width", ""))
  4027.                                         GUICtrlSetData($hheight, IniRead($sini, $sactivegame, "Height", ""))
  4028.                                         GUICtrlSetData($hposx, IniRead($sini, $sactivegame, "PosX", 0))
  4029.                                         GUICtrlSetData($hposy, IniRead($sini, $sactivegame, "PosY", 0))
  4030.                                         If IniRead($sini, $sactivegame, "MouseLock", "never") = "never" Then
  4031.                                                 GUICtrlSetState($hmanagemouse, 4)
  4032.                                                 GUICtrlSetState($hmousewindow, 128 + 1)
  4033.                                                 GUICtrlSetState($hmousehide, 128 + 4)
  4034.                                         ElseIf IniRead($sini, $sactivegame, "MouseLock", "never") = "window" Then
  4035.                                                 GUICtrlSetState($hmanagemouse, 1)
  4036.                                                 GUICtrlSetState($hmousewindow, 64 + 1)
  4037.                                                 GUICtrlSetState($hmousehide, 64 + 4)
  4038.                                         ElseIf IniRead($sini, $sactivegame, "MouseLock", "never") = "hidden" Then
  4039.                                                 GUICtrlSetState($hmanagemouse, 1)
  4040.                                                 GUICtrlSetState($hmousewindow, 64 + 4)
  4041.                                                 GUICtrlSetState($hmousehide, 64 + 1)
  4042.                                         EndIf
  4043.                                 EndIf
  4044.                         Case $happly
  4045.                                 _gs_apply($sactivegame)
  4046.                                 WinActivate($hwnd)
  4047.                 EndSwitch
  4048.         WEnd
  4049.  
  4050. Func _gs_apply($ssection)
  4051.         Local $hwnd = WinGetHandle("[" & $ssection & "]")
  4052.         If NOT WinExists($hwnd) Then Return 1
  4053.         WinActivate($hwnd)
  4054.         _winapi_setwindowlong($hwnd, -16, -2147483648 + 268435456 + 131072)
  4055.         WinSetState($hwnd, "", @SW_MINIMIZE)
  4056.         WinActivate($hwnd)
  4057.         Local $asize[4] = [IniRead($sini, $ssection, "Width", ""), IniRead($sini, $ssection, "Height", ""), IniRead($sini, $ssection, "PosX", 0), IniRead($sini, $ssection, "PosY", 0)]
  4058.         If $asize[0] = "" OR $asize[1] = "" Then
  4059.                 WinMove($hwnd, "", $asize[2], $asize[3])
  4060.         Else
  4061.                 WinMove($hwnd, "", $asize[2], $asize[3], $asize[0], $asize[1])
  4062.         EndIf
  4063.  
  4064. Func _gs_getcurrentsection($hcontrol, $asections)
  4065.         Local $i, $s
  4066.         $s = GUICtrlRead($hcontrol)
  4067.         For $i = 1 To UBound($asections) - 1
  4068.                 If $s = $asections[$i][1] Then Return $asections[$i][0]
  4069.         Next
  4070.  
  4071. Func _gs_getgames($hcontrol)
  4072.         Local $areturn, $i, $inumber, $s
  4073.         Local $asections = IniReadSectionNames($sini)
  4074.         If @error Then Return SetError(1, 0, 0)
  4075.         Dim $areturn[UBound($asections)][2]
  4076.         For $i = 1 To UBound($asections) - 1
  4077.                 If $asections[$i] = "Global_Config" Then ContinueLoop
  4078.                 $areturn[$i][0] = $asections[$i]
  4079.                 $areturn[$i][1] = IniRead($sini, $asections[$i], "friendlyname", "ERRORR")
  4080.                 If $areturn[$i][1] = "ERRORR" Then
  4081.                         $areturn[$i][1] = _gs_getuniquefriendlyname(StringRegExpReplace($asections[$i], "(Title\:)|(\;*Class\:.{1,})", ""))
  4082.                         IniWrite($sini, $areturn[$i][0], "friendlyname", $areturn[$i][1])
  4083.                 EndIf
  4084.                 $s &= $areturn[$i][1] & "|"
  4085.         Next
  4086.         GUICtrlSetData($hcontrol, "")
  4087.         GUICtrlSetData($hcontrol, $s, IniRead($sini, "Global_Config", "LastUsed", $areturn[UBound($areturn) - 1][1]))
  4088.         Return $areturn
  4089.  
  4090. Func _gs_getuniquefriendlyname($s)
  4091.         $s = StringRegExpReplace($s, "(\[)|(\])", "")
  4092.         Local $asections = IniReadSectionNames($sini)
  4093.         If @error Then Return SetError(1, 0, 0)
  4094.         $asections[0] = ""
  4095.         For $i = 0 To UBound($asections) - 1
  4096.                 $asections[$i] = IniRead($sini, $asections[$i], "friendlyname", "")
  4097.         Next
  4098.         For $i = 0 To UBound($asections) - 1
  4099.                 If $s = $asections[$i] Then ExitLoop
  4100.                 If $i = UBound($asections) - 1 Then Return $s
  4101.         Next
  4102.         If $s <> "" Then $s &= " "
  4103.         For $inumber = 1 To 99999
  4104.                 For $i = 0 To UBound($asections) - 1
  4105.                         If $s & StringFormat("%03i", $inumber) = $asections[$i] Then ExitLoop
  4106.                         If $i = UBound($asections) - 1 Then Return $s & StringFormat("%03i", $inumber)
  4107.                 Next
  4108.         Next
  4109.  
  4110. Func _inidelete($sini, $ssection, $skey = "")
  4111.         If $skey = "" Then $skey = Default
  4112.         $ssection = StringReplace($ssection, "[", "&#91;")
  4113.         $ssection = StringReplace($ssection, "]", "&#93;")
  4114.         Return IniDelete($sini, $ssection, $skey)
  4115.  
  4116. Func _iniread($sini, $ssection, $skey, $sdefault)
  4117.         $ssection = StringReplace($ssection, "[", "&#91;")
  4118.         $ssection = StringReplace($ssection, "]", "&#93;")
  4119.         Return IniRead($sini, $ssection, $skey, $sdefault)
  4120.  
  4121. Func _inireadsectionnames($sini)
  4122.         Local $areturn[2], $a, $i
  4123.         $areturn[0] = @error
  4124.         $areturn[1] = @extended
  4125.         $a = IniReadSectionNames($sini)
  4126.         For $i = 1 To UBound($a) - 1
  4127.                 If $a[$i] = "Global_Config" Then $a[$i] = ""
  4128.                 $a[$i] = StringReplace($a[$i], "&#91;", "[")
  4129.                 $a[$i] = StringReplace($a[$i], "&#93;", "]")
  4130.         Next
  4131.         Return SetError($areturn[0], $areturn[1], $a)
  4132.  
  4133. Func _inireadsection($sini, $ssection)
  4134.         Local $a[3]
  4135.         $ssection = StringReplace($ssection, "[", "&#91;")
  4136.         $ssection = StringReplace($ssection, "]", "&#93;")
  4137.         $a[2] = IniReadSection($sini, $ssection)
  4138.         $a[0] = @error
  4139.         $a[1] = @extended
  4140.         Return SetError($a[0], $a[1], $a[2])
  4141.  
  4142. Func _iniwrite($sini, $ssection, $skey, $s)
  4143.         $ssection = StringReplace($ssection, "[", "&#91;")
  4144.         $ssection = StringReplace($ssection, "]", "&#93;")
  4145.         Return IniWrite($sini, $ssection, $skey, $s)
  4146.  
  4147. Func _ispressedfriendlyname($shexkey = -1, $sfriendlyname = -1)
  4148.         Local $i
  4149.         Local $ahexkeys = __ispressedfriendlynamearrays("hex")
  4150.         Local $afriendly = __ispressedfriendlynamearrays("friendly")
  4151.         Select
  4152.                 Case $shexkey <> -1
  4153.                         For $i = 0 To UBound($ahexkeys) - 1
  4154.                                 If $ahexkeys[$i] == $shexkey Then Return $afriendly[$i]
  4155.                         Next
  4156.                         Return SetError(1, 0, 0)
  4157.                 Case $sfriendlyname <> -1
  4158.                         For $i = 0 To UBound($afriendly) - 1
  4159.                                 If $afriendly[$i] == $sfriendlyname Then Return $ahexkeys[$i]
  4160.                         Next
  4161.                         Return SetError(1, 0, 0)
  4162.         EndSelect
  4163.         Return SetError(2, 0, 0)
  4164.  
  4165. Func _ispressedfriendlyuserinput()
  4166.         Local $a[2], $i
  4167.         Local $dll = DllOpen("user32.dll")
  4168.         Local $ahexkeys = __ispressedfriendlynamearrays("hex")
  4169.         While 1
  4170.                 For $i = 0 To UBound($ahexkeys) - 1
  4171.                         If _ispressed($ahexkeys[$i]) Then
  4172.                                 $a[0] = $ahexkeys[$i]
  4173.                                 ExitLoop
  4174.                         EndIf
  4175.                 Next
  4176.                 If $a[0] <> "" Then ExitLoop
  4177.                 Sleep(5)
  4178.         WEnd
  4179.         Local $itimerinit = TimerInit()
  4180.         While TimerDiff($itimerinit) < 800
  4181.                 For $i = 0 To UBound($ahexkeys) - 1
  4182.                         If _ispressed($ahexkeys[$i]) AND $ahexkeys[$i] <> $a[0] Then
  4183.                                 $a[1] = $ahexkeys[$i]
  4184.                                 ExitLoop
  4185.                         EndIf
  4186.                 Next
  4187.                 If $a[1] <> "" Then ExitLoop
  4188.                 Sleep(5)
  4189.         WEnd
  4190.         If $a[1] = "" Then ReDim $a[1]
  4191.         DllClose($dll)
  4192.         Return $a
  4193.  
  4194. Func __ispressedfriendlynamearrays($stype, $saction = "press")
  4195.         Local $areturn
  4196.         Select
  4197.                 Case $stype = "hex"
  4198.                         Dim $areturn[103] = ["08", "09", "0D", "11", "12", "13", "14", "1B", "20", "21", "22", "23", "24", "25", "26", "27", "28", "2C", "2D", "2E", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "90", "91", "A0", "A1", "A2", "A3", "BA", "BB", "BC", "BD", "BE", "BF", "C0", "DB", "DC", "DD"]
  4199.                 Case $stype = "friendly"
  4200.                         Dim $areturn[103] = ["Backspace", "TAB", "ENTER", "CTRL", "ALT", "PAUSE", "CAPS LOCK", "ESC", "SPACEBAR", "PAGE UP", "PAGE DOWN", "END", "HOME", "LEFT ARROW", "UP ARROW", "RIGHT ARROW", "DOWN ARROW", "PRINT SCREEN", "INS", "DEL", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Left Windows key", "Right Windows key", "NUMPAD 0", "NUMPAD 1", "NUMPAD 2", "NUMPAD 3", "NUMPAD 4", "NUMPAD 5", "NUMPAD 6", "NUMPAD 7", "NUMPAD 8", "NUMPAD 9", "NUMPAD *", "NUMPAD +", "Separator", "NUMPAD -", "NUMPAD .", "NUMPAD /", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "NUM LOCK", "SCROLL LOCK", "Left SHIFT", "Right SHIFT", "Left CONTROL", "Right CONTROL", ";", "=", ",", "-", ".", "/", "`", "[", "\", "]"]
  4201.                 Case $stype = "send" AND $saction = "press"
  4202.                         Dim $areturn[103] = ["{BACKSPACE}", "{TAB}", "{ENTER}", "{LCTRL}", "{ALT}", "{PAUSE}", "{CAPSLOCK off}", "{ESC}", "{SPACE}", "{PGUP}", "{PGDN}", "{END}", "{HOME}", "{LEFT}", "{UP}", "{RIGHT}", "{DOWN}", "{PRINTSCREEN}", "{INS}", "{DEL}", "{0}", "{1}", "{2}", "{3}", "{4}", "{5}", "{6}", "{7}", "{8}", "{9}", "{a}", "{b}", "{c}", "{d}", "{e}", "{f}", "{g}", "{h}", "{i}", "{j}", "{k}", "{l}", "{m}", "{n}", "{o}", "{p}", "{q}", "{r}", "{s}", "{t}", "{u}", "{v}", "{w}", "{x}", "{y}", "{z}", "{LWIN}", "{RWIN}", "{NUMPAD0}", "{NUMPAD1}", "{NUMPAD2}", "{NUMPAD3}", "{NUMPAD4}", "{NUMPAD5}", "{NUMPAD6}", "{NUMPAD7}", "{NUMPAD8}", "{NUMPAD9}", "{NUMPADMULT}", "{NUMPADADD}", "{|}", "{NUMPADSUB}", "{NUMPADDOT}", "{NUMPADDIV}", "{F1}", "{F2}", "{F3}", "{F4}", "{F5}", "{F6}", "{F7}", "{F8}", "{F9}", "{F10}", "{F11}", "{F12}", "{NUMLOCK on}", "{SCROLLLOCK toggle}", "{LSHIFT}", "{LSHIFT}", "{LCTRL}", "{RCTRL}", "{;}", "{=}", "{,}", "{-}", "{.}", "{/}", "{`}", "{[}", "{\}", "{]}"]
  4203.                 Case $stype = "send" AND $saction = "down"
  4204.                         Dim $areturn[103] = ["{BACKSPACE down}", "{TAB down}", "{ENTER down}", "{LCTRL down}", "{ALTDOWN}", "{PAUSE down}", "{CAPSLOCK down}", "{ESC down}", "{SPACE down}", "{PGUP down}", "{PGDN down}", "{END down}", "{HOME down}", "{LEFT down}", "{UP down}", "{RIGHT down}", "{DOWN down}", "{PRINTSCREEN down}", "{INS down}", "{DEL down}", "{0 down}", "{1 down}", "{2 down}", "{3 down}", "{4 down}", "{5 down}", "{6 down}", "{7 down}", "{8 down}", "{9 down}", "{a down}", "{b down}", "{c down}", "{d down}", "{e down}", "{f down}", "{g down}", "{h down}", "{i down}", "{j down}", "{k down}", "{l down}", "{m down}", "{n down}", "{o down}", "{p down}", "{q down}", "{r down}", "{s down}", "{t down}", "{u down}", "{v down}", "{w down}", "{x down}", "{y down}", "{z down}", "{LWINDOWN}", "{RWINDOWN}", "{NUMPAD0 down}", "{NUMPAD1 down}", "{NUMPAD2 down}", "{NUMPAD3 down}", "{NUMPAD4 down}", "{NUMPAD5 down}", "{NUMPAD6 down}", "{NUMPAD7 down}", "{NUMPAD8 down}", "{NUMPAD9 down}", "{NUMPADMULT down}", "{NUMPADADD down}", "{| down}", "{NUMPADSUB down}", "{NUMPADDOT down}", "{NUMPADDIV down}", "{F1 down}", "{F2 down}", "{F3 down}", "{F4 down}", "{F5 down}", "{F6 down}", "{F7 down}", "{F8 down}", "{F9 down}", "{F10 down}", "{F11 down}", "{F12 down}", "{NUMLOCK  down}", "{SCROLLLOCK  down}", "{LSHIFT down}", "{LSHIFT down}", "{LCTRL down}", "{RCTRL down}", "{; down}", "{= down}", "{, down}", "{- down}", "{. down}", "{/ down}", "{` down}", "{[ down}", "{\ down}", "{] down}"]
  4205.                 Case $stype = "send" AND $saction = "up"
  4206.                         Dim $areturn[103] = ["{BACKSPACE up}", "{TAB up}", "{ENTER up}", "{LCTRL up}", "{ALTUP}", "{PAUSE up}", "{CAPSLOCK up}", "{ESC up}", "{SPACE up}", "{PGUP up}", "{PGDN up}", "{END up}", "{HOME up}", "{LEFT up}", "{UP up}", "{RIGHT up}", "{DOWN up}", "{PRINTSCREEN up}", "{INS up}", "{DEL up}", "{0 up}", "{1 up}", "{2 up}", "{3 up}", "{4 up}", "{5 up}", "{6 up}", "{7 up}", "{8 up}", "{9 up}", "{a up}", "{b up}", "{c up}", "{d up}", "{e up}", "{f up}", "{g up}", "{h up}", "{i up}", "{j up}", "{k up}", "{l up}", "{m up}", "{n up}", "{o up}", "{p up}", "{q up}", "{r up}", "{s up}", "{t up}", "{u up}", "{v up}", "{w up}", "{x up}", "{y up}", "{z up}", "{LWINUP}", "{RWINUP}", "{NUMPAD0 up}", "{NUMPAD1 up}", "{NUMPAD2 up}", "{NUMPAD3 up}", "{NUMPAD4 up}", "{NUMPAD5 up}", "{NUMPAD6 up}", "{NUMPAD7 up}", "{NUMPAD8 up}", "{NUMPAD9 up}", "{NUMPADMULT up}", "{NUMPADADD up}", "{| up}", "{NUMPADSUB up}", "{NUMPADDOT up}", "{NUMPADDIV up}", "{F1 up}", "{F2 up}", "{F3 up}", "{F4 up}", "{F5 up}", "{F6 up}", "{F7 up}", "{F8 up}", "{F9 up}", "{F10 up}", "{F11 up}", "{F12 up}", "{NUMLOCK  up}", "{SCROLLLOCK  up}", "{LSHIFT up}", "{LSHIFT up}", "{LCTRL up}", "{RCTRL up}", "{; up}", "{= up}", "{, up}", "{- up}", "{. up}", "{/ up}", "{` up}", "{[ up}", "{\ up}", "{] up}"]
  4207.                 Case Else
  4208.                         Return SetError(1, 0, 0)
  4209.         EndSelect
  4210.         Return $areturn
  4211.  
  4212. Func _globalsettingsgui()
  4213.         TraySetState(2)
  4214.         _singleton($sfriendlyname & "GlobalSettings")
  4215.         Local $i, $s, $a
  4216.         Opt("GUICloseOnESC", 0)
  4217.         Local $hwnd = GUICreate("Settings - Windowed Borderless Gaming", 420, 520)
  4218.         GUISetFont(10, 400, 0, "MS Sans Serif")
  4219.         GUICtrlCreateGroup("Add Window", 5, 5, 410, 185)
  4220.         GUICtrlCreateLabel("Keybind:", 10, 25, 82, 25, $ss_centerimage)
  4221.         Local $ikeybind1_addwindow = IniRead($sini, "Global_Config", "KeyBind1_AddWindow", 72)
  4222.         $s = _ispressedfriendlyname($ikeybind1_addwindow)
  4223.         Local $hkeybind1_addwindow = GUICtrlCreateButton("", 121, 25, 131, 25)
  4224.         GUICtrlSetData(-1, $s)
  4225.         Local $hautosetresolution = GUICtrlCreateCheckbox("Automatically set resolution in the game's settings", 10, 50, 321, 25)
  4226.         If IniRead($sini, "Global_Config", "AutoSetResolution", "never") = "always" Then GUICtrlSetState(-1, $gui_checked)
  4227.         GUICtrlCreateLabel("Resolution:", 10, 75, 90, 25, $ss_centerimage)
  4228.         Local $hdefaultdesktopwidth = GUICtrlCreateInput(IniRead($sini, "Global_Config", "DefaultDeskTopWidth", @DesktopWidth), 120, 75, 57, 24, BitOR($gui_ss_default_input, $es_center, $es_number))
  4229.         GUICtrlSetTip(-1, "Width")
  4230.         GUICtrlCreateLabel("X", 178, 75, 25, 25, BitOR($ss_center, $ss_centerimage))
  4231.         Local $hdefaultdesktopheight = GUICtrlCreateInput(IniRead($sini, "Global_Config", "DefaultDeskTopHeight", @DesktopHeight), 208, 75, 57, 24, BitOR($gui_ss_default_input, $es_center, $es_number))
  4232.         GUICtrlSetTip(-1, "Height")
  4233.         Local $hautosetoffset = GUICtrlCreateCheckbox("Automatically set offset in the game's settings", 10, 106, 321, 25)
  4234.         If IniRead($sini, "Global_Config", "AutoSetOffset", "never") = "always" Then GUICtrlSetState(-1, $gui_checked)
  4235.         GUICtrlCreateLabel("Offset:", 10, 131, 58, 25, $ss_centerimage)
  4236.         Local $hdefaultposx = GUICtrlCreateInput(IniRead($sini, "Global_Config", "DefaultPosX", 0), 120, 131, 57, 24, BitOR($gui_ss_default_input, $es_center))
  4237.         GUICtrlSetTip(-1, "Horizontal")
  4238.         GUICtrlCreateLabel("Y:", 178, 131, 25, 25, BitOR($ss_center, $ss_centerimage))
  4239.         GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
  4240.         GUICtrlSetTip(-1, "Vertical")
  4241.         Local $hdefaultposy = GUICtrlCreateInput(IniRead($sini, "Global_Config", "DefaultPosY", 0), 208, 131, 57, 24, BitOR($gui_ss_default_input, $es_center))
  4242.         GUICtrlSetTip(-1, "Vertical")
  4243.         GUICtrlCreateLabel("X:", 90, 131, 25, 25, BitOR($ss_center, $ss_centerimage))
  4244.         GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
  4245.         GUICtrlSetTip(-1, "Horizontal")
  4246.         Local $haddwindow_confirmationcheckbox1 = GUICtrlCreateCheckbox("Ask for confirmation before adding a window", 10, 155, 321, 25)
  4247.         If IniRead($sini, "Global_Config", "AddWindow_Confirmation", "never") = "always" Then GUICtrlSetState(-1, $gui_checked)
  4248.         GUICtrlCreateGroup("", -99, -99, 1, 1)
  4249.         GUICtrlCreateGroup("Force key", 5, 208, 410, 137)
  4250.         Local $hforceborderlesskeyenabled = GUICtrlCreateCheckbox("Enable a keybind to re-trigger borderless mode", 10, 228, 321, 25)
  4251.         If IniRead($sini, "Global_Config", "ForceBorderlessKeyEnabled", "always") = "always" Then GUICtrlSetState(-1, $gui_checked)
  4252.         GUICtrlCreateLabel("Keybind:", 10, 253, 66, 25, $ss_centerimage)
  4253.         Local $ikeybind1_forceborderless = IniRead($sini, "Global_Config", "KeyBind1_ForceBorderless", 73)
  4254.         $s = _ispressedfriendlyname($ikeybind1_forceborderless)
  4255.         Local $hkeybind1_forceborderless = GUICtrlCreateButton("", 89, 253, 131, 25)
  4256.         GUICtrlSetData(-1, $s)
  4257.         GUICtrlCreateLabel("+", 226, 253, 30, 25, BitOR($ss_center, $ss_centerimage))
  4258.         GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
  4259.         Local $ikeybind2_forceborderless = IniRead($sini, "Global_Config", "KeyBind2_ForceBorderless", $ikeybind1_forceborderless)
  4260.         $s = _ispressedfriendlyname($ikeybind2_forceborderless)
  4261.         Local $hkeybind2_forceborderless = GUICtrlCreateButton("", 265, 253, 131, 25)
  4262.         GUICtrlSetData(-1, $s)
  4263.         GUIStartGroup()
  4264.         Local $hforcekeychecktitlealways = GUICtrlCreateRadio("Check for window name, class and process", 10, 288, 305, 25)
  4265.         If IniRead($sini, "Global_Config", "ForceKeyCheckTitle", "always") = "always" Then GUICtrlSetState(-1, $gui_checked)
  4266.         Local $hforcekeychecktitlenever = GUICtrlCreateRadio("Check for window class and process", 10, 313, 313, 25)
  4267.         If IniRead($sini, "Global_Config", "ForceKeyCheckTitle", "always") = "never" Then GUICtrlSetState(-1, $gui_checked)
  4268.         GUIStartGroup()
  4269.         GUICtrlCreateGroup("", -99, -99, 1, 1)
  4270.         GUICtrlCreateGroup("Auto monitoring", 5, 360, 410, 105)
  4271.         GUICtrlCreateLabel("How to recognise a window to make borderless", 10, 380, 386, 25, $ss_centerimage)
  4272.         GUIStartGroup()
  4273.         Local $hforcetriggerchecktitlealways = GUICtrlCreateRadio("By window title, class and process name", 10, 405, 290, 25)
  4274.         If IniRead($sini, "Global_Config", "ForceTriggerCheckTitle", "always") = "always" Then GUICtrlSetState(-1, $gui_checked)
  4275.         Local $hforcetriggerchecktitlenever = GUICtrlCreateRadio("By window class and process name", 10, 430, 290, 25)
  4276.         If IniRead($sini, "Global_Config", "ForceTriggerCheckTitle", "always") = "never" Then GUICtrlSetState(-1, $gui_checked)
  4277.         GUIStartGroup()
  4278.         GUICtrlCreateGroup("", -99, -99, 1, 1)
  4279.         Local $hsave = GUICtrlCreateButton("&Save and close", 5, 480, 125, 25)
  4280.         Local $hcancel = GUICtrlCreateButton("&Cancel", 290, 480, 125, 25)
  4281.         GUISetState(@SW_SHOW)
  4282.         WinSetOnTop($hwnd, "", 1)
  4283.         While 1
  4284.                 Local $nmsg = GUIGetMsg()
  4285.                 Switch $nmsg
  4286.                         Case $gui_event_close
  4287.                                 Exit
  4288.                         Case $hkeybind1_addwindow
  4289.                                 _keyinputbtn($ikeybind1_addwindow, $hkeybind1_addwindow)
  4290.                         Case $hautosetresolution
  4291.                         Case $hdefaultdesktopwidth
  4292.                         Case $hdefaultdesktopheight
  4293.                         Case $hautosetoffset
  4294.                         Case $hdefaultposx
  4295.                                 GUICtrlSetData($hdefaultposx, StringRegExpReplace(GUICtrlRead($hdefaultposx), "[^\-0-9]", ""))
  4296.                                 If GUICtrlRead($hdefaultposx) = "" Then GUICtrlSetData($hdefaultposx, 0)
  4297.                         Case $hdefaultposy
  4298.                                 GUICtrlSetData($hdefaultposy, StringRegExpReplace(GUICtrlRead($hdefaultposy), "[^\-0-9]", ""))
  4299.                                 If GUICtrlRead($hdefaultposy) = "" Then GUICtrlSetData($hdefaultposy, 0)
  4300.                         Case $haddwindow_confirmationcheckbox1
  4301.                         Case $hforceborderlesskeyenabled
  4302.                         Case $hkeybind1_forceborderless
  4303.                                 _keyinputbtn($ikeybind1_forceborderless, $hkeybind1_forceborderless)
  4304.                                 $ikeybind2_forceborderless = $ikeybind1_forceborderless
  4305.                                 GUICtrlSetData($hkeybind2_forceborderless, GUICtrlRead($hkeybind1_forceborderless))
  4306.                         Case $hkeybind2_forceborderless
  4307.                                 _keyinputbtn($ikeybind2_forceborderless, $hkeybind2_forceborderless)
  4308.                         Case $hforcekeychecktitlealways
  4309.                         Case $hforcekeychecktitlenever
  4310.                         Case $hforcetriggerchecktitlealways
  4311.                         Case $hforcetriggerchecktitlenever
  4312.                         Case $hsave
  4313.                                 Local $acontrols[15] = [$ikeybind1_addwindow, $hautosetresolution, $hdefaultdesktopwidth, $hdefaultdesktopheight, $hautosetoffset, $hdefaultposx, $hdefaultposy, $haddwindow_confirmationcheckbox1, $hforceborderlesskeyenabled, $ikeybind1_forceborderless, $ikeybind2_forceborderless, $hforcekeychecktitlealways, $hforcekeychecktitlenever, $hforcetriggerchecktitlealways, $hforcetriggerchecktitlenever]
  4314.                                 _saveglobalsettings($acontrols)
  4315.                         Case $hcancel
  4316.                                 Exit
  4317.                 EndSwitch
  4318.         WEnd
  4319.  
  4320. Func _keyinputbtn(ByRef $ibtn, ByRef $hbtn)
  4321.         Local $a, $i, $s
  4322.         Local $hwnd = GUICreate("", 415, 128, -1, -1, -2147483648, 128)
  4323.         GUISetBkColor(0)
  4324.         GUICtrlCreateLabel("Click a button on your keyboard", 0, 0, 415, 128, BitOR($ss_center, $ss_centerimage))
  4325.         GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
  4326.         GUICtrlSetColor(-1, 16777215)
  4327.         GUISetState(@SW_SHOW)
  4328.         WinSetOnTop($hwnd, "", 1)
  4329.         $a = _ispressedfriendlyuserinput()
  4330.         $ibtn = $a[UBound($a) - 1]
  4331.         For $i = 0 To UBound($a) - 1
  4332.                 GUICtrlSetData($hbtn, _ispressedfriendlyname($a[$i]))
  4333.         Next
  4334.         GUIDelete($hwnd)
  4335.  
  4336. Func _saveglobalsettings($acontrols)
  4337.         IniWrite($sini, "Global_Config", "KeyBind1_AddWindow", $acontrols[0])
  4338.         If GUICtrlRead($acontrols[2]) > 0 AND GUICtrlRead($acontrols[3]) > 0 Then
  4339.                 If GUICtrlRead($acontrols[1]) = $gui_checked Then IniWrite($sini, "Global_Config", "AutoSetResolution", "always")
  4340.                 If GUICtrlRead($acontrols[1]) = $gui_unchecked Then IniWrite($sini, "Global_Config", "AutoSetResolution", "never")
  4341.         Else
  4342.                 IniWrite($sini, "Global_Config", "AutoSetResolution", "never")
  4343.         EndIf
  4344.         IniWrite($sini, "Global_Config", "DefaultDeskTopWidth", GUICtrlRead($acontrols[2]))
  4345.         IniWrite($sini, "Global_Config", "DefaultDeskTopHeight", GUICtrlRead($acontrols[3]))
  4346.         If GUICtrlRead($acontrols[5]) <> 0 OR GUICtrlRead($acontrols[6]) <> 0 Then
  4347.                 If GUICtrlRead($acontrols[4]) = $gui_checked Then IniWrite($sini, "Global_Config", "AutoSetOffset", "always")
  4348.                 If GUICtrlRead($acontrols[4]) = $gui_unchecked Then IniWrite($sini, "Global_Config", "AutoSetOffset", "never")
  4349.         Else
  4350.                 IniWrite($sini, "Global_Config", "AutoSetOffset", "never")
  4351.         EndIf
  4352.         IniWrite($sini, "Global_Config", "DefaultPosX", GUICtrlRead($acontrols[5]))
  4353.         IniWrite($sini, "Global_Config", "DefaultPosY", GUICtrlRead($acontrols[6]))
  4354.         If GUICtrlRead($acontrols[7]) = $gui_checked Then IniWrite($sini, "Global_Config", "AddWindow_Confirmation", "always")
  4355.         If GUICtrlRead($acontrols[7]) = $gui_unchecked Then IniWrite($sini, "Global_Config", "AddWindow_Confirmation", "never")
  4356.         If GUICtrlRead($acontrols[8]) = $gui_checked Then IniWrite($sini, "Global_Config", "ForceBorderlessKeyEnabled", "always")
  4357.         If GUICtrlRead($acontrols[8]) = $gui_unchecked Then IniWrite($sini, "Global_Config", "ForceBorderlessKeyEnabled", "never")
  4358.         IniWrite($sini, "Global_Config", "KeyBind1_ForceBorderless", $acontrols[9])
  4359.         IniWrite($sini, "Global_Config", "KeyBind2_ForceBorderless", $acontrols[10])
  4360.         If GUICtrlRead($acontrols[11]) = $gui_checked Then IniWrite($sini, "Global_Config", "ForceKeyCheckTitle", "always")
  4361.         If GUICtrlRead($acontrols[12]) = $gui_checked Then IniWrite($sini, "Global_Config", "ForceKeyCheckTitle", "never")
  4362.         If GUICtrlRead($acontrols[13]) = $gui_checked Then IniWrite($sini, "Global_Config", "ForceTriggerCheckTitle", "always")
  4363.         If GUICtrlRead($acontrols[14]) = $gui_checked Then IniWrite($sini, "Global_Config", "ForceTriggerCheckTitle", "never")
  4364.         Exit
  4365.  
  4366. Func _mouselock($ssection, $hwnd, $istate)
  4367.         Local $a
  4368.         If NOT WinExists($hwnd) Then Return SetError(1, 0, 0)
  4369.         Local $s = IniRead($sini, $ssection, "MouseLock", "never")
  4370.         If $s = "never" AND $istate = 2 Then
  4371.                 $istate = -1
  4372.                 _mousetrap()
  4373.                 MouseMove(@DesktopWidth, @DesktopHeight, 0)
  4374.         ElseIf $s = "window" Then
  4375.                 $a = WinGetPos($hwnd)
  4376.                 If @error Then Return $istate
  4377.                 $istate = 2
  4378.                 _mousetrap($a[0], $a[1], $a[0] + $a[2], $a[1] + $a[3])
  4379.         ElseIf $s = "hidden" Then
  4380.                 $a = WinGetPos($hwnd)
  4381.                 If @error Then Return $istate
  4382.                 $istate = 2
  4383.                 _mousetrap(($a[0] + $a[2]) / 2, ($a[1] + $a[3]) - 1, ($a[0] + $a[2]) / 2, $a[1] + $a[3] - 1)
  4384.         EndIf
  4385.         Return $istate
  4386.  
  4387. Func _processgetname($ipid)
  4388.         Local $aprocesslist = ProcessList(), $ierror = 1, $sprocessname = ""
  4389.         For $i = 1 To $aprocesslist[0][0]
  4390.                 If $aprocesslist[$i][1] = $ipid Then
  4391.                         $ierror = 0
  4392.                         $sprocessname = $aprocesslist[$i][0]
  4393.                         ExitLoop
  4394.                 EndIf
  4395.         Next
  4396.         Return SetError($ierror, 0, $sprocessname)
  4397.  
  4398. Func _processgetpriority($vprocess)
  4399.         Local $ierror = 0, $iextended = 0, $ireturn = -1
  4400.         Local $ipid = ProcessExists($vprocess)
  4401.         If NOT $ipid Then Return SetError(1, 0, -1)
  4402.         Local $hdll = DllOpen("kernel32.dll")
  4403.         Do
  4404.                 Local $aprocesshandle = DllCall($hdll, "handle", "OpenProcess", "dword", $process_query_information, "bool", False, "dword", $ipid)
  4405.                 If @error Then
  4406.                         $ierror = @error + 10
  4407.                         $iextended = @extended
  4408.                         ExitLoop
  4409.                 EndIf
  4410.                 If NOT $aprocesshandle[0] Then ExitLoop
  4411.                 Local $apriority = DllCall($hdll, "dword", "GetPriorityClass", "handle", $aprocesshandle[0])
  4412.                 If @error Then
  4413.                         $ierror = @error
  4414.                         $iextended = @extended
  4415.                 EndIf
  4416.                 DllCall($hdll, "bool", "CloseHandle", "handle", $aprocesshandle[0])
  4417.                 If $ierror Then ExitLoop
  4418.                 Switch $apriority[0]
  4419.                         Case 64
  4420.                                 $ireturn = 0
  4421.                         Case 16384
  4422.                                 $ireturn = 1
  4423.                         Case 32
  4424.                                 $ireturn = 2
  4425.                         Case 32768
  4426.                                 $ireturn = 3
  4427.                         Case 128
  4428.                                 $ireturn = 4
  4429.                         Case 256
  4430.                                 $ireturn = 5
  4431.                         Case Else
  4432.                                 $ierror = 1
  4433.                                 $iextended = $apriority[0]
  4434.                                 $ireturn = -1
  4435.                 EndSwitch
  4436.         Until True
  4437.         DllClose($hdll)
  4438.         Return SetError($ierror, $iextended, $ireturn)
  4439.  
  4440. Func _rundos($scommand)
  4441.         Local $nresult = RunWait(@ComSpec & " /C " & $scommand, "", @SW_HIDE)
  4442.         Return SetError(@error, @extended, $nresult)
  4443.  
  4444.         IniWrite($sini, "Global_Config", "AutoSetResolution", "never")
  4445.         IniWrite($sini, "Global_Config", "DefaultDeskTopWidth", @DesktopWidth)
  4446.         IniWrite($sini, "Global_Config", "DefaultDeskTopHeight", @DesktopHeight)
  4447.         IniWrite($sini, "Global_Config", "AutoSetOffset", "never")
  4448.         IniWrite($sini, "Global_Config", "DefaultPosX", 0)
  4449.         IniWrite($sini, "Global_Config", "DefaultPosY", 0)
  4450.         IniWrite($sini, "Global_Config", "KeyBind1_AddWindow", 72)
  4451.         IniWrite($sini, "Global_Config", "KeyBind1_ForceBorderless", 73)
  4452.         IniWrite($sini, "Global_Config", "KeyBind2_ForceBorderless", 73)
  4453.         IniWrite($sini, "Global_Config", "ForceKeyCheckTitle", "always")
  4454.         IniWrite($sini, "Global_Config", "ForceTriggerCheckTitle", "always")
  4455.         IniWrite($sini, "Global_Config", "AddWindow_Confirmation", "never")
  4456. If $cmdline[0] > 0 Then
  4457.         If $cmdline[1] = "-GameSettings" Then
  4458.                 _gs_settingsgui()
  4459.                 Exit
  4460.         ElseIf $cmdline[1] = "-GlobalSettings" Then
  4461.                 _globalsettingsgui()
  4462.         EndIf
  4463.         _masterloop()
  4464. Opt("MustDeclareVars", 1)
  4465.  
  4466. Func _masterloop()
  4467.         Local $dll = DllOpen("user32.dll")
  4468.         TraySetState(2)
  4469.         Local $i, $msg, $hwnd, $ssection, $holdhwnd, $hdxwnd, $idxwnddeclared, $imouselock = 1
  4470.         _singleton($sfriendlyname)
  4471.         Opt("TrayMenuMode", 1 + 2)
  4472.         Opt("TrayAutoPause", 0)
  4473.         TraySetToolTip($sappname)
  4474.         Local $hlog = TrayCreateItem("Add window ( " & _ispressedfriendlyname(IniRead($sini, "Global_Config", "KeyBind1_AddWindow", 72)) & " )")
  4475.         Local $hgs = TrayCreateItem("Open game settings")
  4476.         TrayCreateItem("")
  4477.         Local $hglobalsettings = TrayCreateItem("Open global settings")
  4478.         Local $hconf = TrayCreateItem("Open config file")
  4479.         TrayCreateItem("")
  4480.         If FileExists(@ScriptDir & "\DXWnd\dxwnd.exe") Then
  4481.                 $idxwnddeclared = 1
  4482.                 $hdxwnd = TrayCreateItem("Run DXWnd")
  4483.                 TrayCreateItem("")
  4484.         EndIf
  4485.         Local $hcheckupdates = TrayCreateItem("Check for updates")
  4486.         Local $hreadmanual = TrayCreateItem("Read manual")
  4487.         Local $hstartup = TrayCreateItem("Run at startup")
  4488.         If _startupget() Then TrayItemSetState($hstartup, $tray_checked)
  4489.         Local $hhelp = TrayCreateItem("Get help on the forum")
  4490.         Local $hauthor = TrayCreateItem("App by GameplayCrush")
  4491.         TrayCreateItem("")
  4492.         Local $hexit = TrayCreateItem("Exit")
  4493.         $i = TimerInit()
  4494.         TraySetState(1)
  4495.         TraySetToolTip($sappname)
  4496.         TrayTip($sappname, "click tray icon for options", 10)
  4497.         While 1
  4498.                 $msg = TrayGetMsg()
  4499.                 If $msg = $hexit Then Exit
  4500.                 If $msg = $hlog Then
  4501.                         _logwindow()
  4502.                         $holdhwnd = ""
  4503.                 EndIf
  4504.                 If $msg = $hstartup Then _startupset($hstartup)
  4505.                 If $msg = $hcheckupdates Then ShellExecute("http://westechsolutions.net/sites/WindowedBorderlessGaming/updates?v=" & $sversionnumber)
  4506.                 If $msg = $hreadmanual Then ShellExecute("http://westechsolutions.net/sites/WindowedBorderlessGaming/manual")
  4507.                 If $msg = $hhelp Then
  4508.                         If ProcessExists("Steam.exe") Then
  4509.                                 ShellExecute("steam://url/GroupSteamIDPage/5177732")
  4510.                         Else
  4511.                                 ShellExecute("http://steamcommunity.com/groups/WindowedBorderlessGaming/discussions")
  4512.                         EndIf
  4513.                 EndIf
  4514.                 If $msg = $hauthor Then
  4515.                         If ProcessExists("Steam.exe") Then
  4516.                                 ShellExecute("steam://url/SteamIDPage/76561198027421333")
  4517.                         Else
  4518.                                 ShellExecute("http://steamcommunity.com/id/GameplayCRUSH/")
  4519.                         EndIf
  4520.                 EndIf
  4521.                 If $msg = $hgs AND @Compiled Then Run('"' & @ScriptFullPath & '" "-GameSettings"', @ScriptDir)
  4522.                 If $msg = $hglobalsettings AND @Compiled Then
  4523.                         RunWait('"' & @ScriptFullPath & '" "-GlobalSettings"', @ScriptDir)
  4524.                         TrayItemSetText($hlog, "Add window ( " & _ispressedfriendlyname(IniRead($sini, "Global_Config", "KeyBind1_AddWindow", 72)) & " )")
  4525.                 EndIf
  4526.                 If $msg = $hconf Then
  4527.                         If FileExists($sini) Then ShellExecute($sini)
  4528.                 EndIf
  4529.                 If IniRead($sini, "Global_Config", "ForceBorderlessKeyEnabled", "always") = "always" Then
  4530.                         If _ispressed(IniRead($sini, "Global_Config", "KeyBind1_ForceBorderless", 73), $dll) AND _ispressed(IniRead($sini, "Global_Config", "KeyBind2_ForceBorderless", IniRead($sini, "Global_Config", "KeyBind1_ForceBorderless", 73))) Then _winforceborderless()
  4531.                 EndIf
  4532.                 If $idxwnddeclared = 1 Then
  4533.                         If $msg = $hdxwnd Then
  4534.                                 If FileExists(@ScriptDir & "\DXWnd\dxwnd.exe") Then Run('"' & @ScriptDir & "\DXWnd\dxwnd.exe" & '"', @ScriptDir & "\DXWnd")
  4535.                         EndIf
  4536.                 EndIf
  4537.                 If TimerDiff($i) > 1000 Then
  4538.                         $i = TimerInit()
  4539.                         $hwnd = WinGetHandle("[ACTIVE]")
  4540.                         If $hwnd <> $holdhwnd Then
  4541.                                 $holdhwnd = $hwnd
  4542.                                 $ssection = StringReplace("Title:" & WinGetTitle($hwnd) & ";Class:" & _winapi_getclassname($hwnd), "[", "&#91;")
  4543.                                 $ssection = StringReplace($ssection, "]", "&#93;")
  4544.                                 If IniRead($sini, $ssection, "Process", "Error") = "Error" AND IniRead($sini, "Global_Config", "ForceTriggerCheckTitle", "always") = "never" Then
  4545.                                         $ssection = StringReplace("Class:" & _winapi_getclassname($hwnd), "[", "&#91;")
  4546.                                         $ssection = StringReplace($ssection, "]", "&#93;")
  4547.                                 EndIf
  4548.                                 $imouselock = _mouselock($ssection, $hwnd, $imouselock)
  4549.                                 If _processgetname(WinGetProcess($hwnd)) <> IniRead($sini, $ssection, "Process", "0") Then ContinueLoop
  4550.                                 If _winapi_getwindowlong($hwnd, -16) <> IniRead($sini, $ssection, "Style", "ERROR") Then ContinueLoop
  4551.                                 _winsetborderless($hwnd, IniRead($sini, $ssection, "PosX", 0), IniRead($sini, $ssection, "PosY", 0), IniRead($sini, $ssection, "Width", ""), IniRead($sini, $ssection, "Height", ""), $ssection)
  4552.                         EndIf
  4553.                 EndIf
  4554.         WEnd
  4555.  
  4556. Func _winforceborderless()
  4557.         Local $i = IniRead($sini, "Global_Config", "KeyBind1_ForceBorderless", 73)
  4558.         While _ispressed($i)
  4559.                 Sleep(500)
  4560.         WEnd
  4561.         Dim $i
  4562.         Local $hwnd = WinGetHandle("[ACTIVE]")
  4563.         Local $ssection = StringReplace("Title:" & WinGetTitle($hwnd) & ";Class:" & _winapi_getclassname($hwnd), "[", "&#91;")
  4564.         $ssection = StringReplace($ssection, "]", "&#93;")
  4565.         If IniRead($sini, $ssection, "Process", "Error") = "Error" AND IniRead($sini, "Global_Config", "ForceKeyCheckTitle", "always") = "never" Then
  4566.                 $ssection = StringReplace("Class:" & _winapi_getclassname($hwnd), "[", "&#91;")
  4567.                 $ssection = StringReplace($ssection, "]", "&#93;")
  4568.         EndIf
  4569.         If _processgetname(WinGetProcess($hwnd)) <> IniRead($sini, $ssection, "Process", "0") Then Return 0
  4570.         _winsetborderless($hwnd, IniRead($sini, $ssection, "PosX", 0), IniRead($sini, $ssection, "PosY", 0), IniRead($sini, $ssection, "Width", ""), IniRead($sini, $ssection, "Height", ""), $ssection)
  4571.  
  4572. Func _startupget()
  4573.         Local $foo = Run(@ComSpec & " /c Schtasks /Query /fo list", @SystemDir, @SW_HIDE, $stderr_child + $stdout_child)
  4574.         Local $s
  4575.         While 1
  4576.                 $s &= StdoutRead($foo)
  4577.                 If @error Then ExitLoop
  4578.         WEnd
  4579.         If StringInStr($s, "WindowedBorderlessGaming-" & @UserName) Then Return 1
  4580.         Return 0
  4581.  
  4582. Func _startupset($h)
  4583.         If _startupget() Then
  4584.                 RunWait(@ComSpec & ' "/c" "schtasks" "/delete" "/tn" "WindowedBorderlessGaming-' & @UserName & '" "/f"', @SystemDir, @SW_HIDE)
  4585.         Else
  4586.                 RunWait(@ComSpec & ' "/c" "schtasks" "/create" "/tn" "WindowedBorderlessGaming-' & @UserName & '" "/tr" "' & FileGetShortName(@ScriptFullPath) & '" "/sc" "ONLOGON" "/ru" "' & @UserName & '" "/it" "/rl" "HIGHEST"', @SystemDir, @SW_HIDE)
  4587.         EndIf
  4588.         If _startupget() Then
  4589.                 TrayItemSetState($h, $tray_checked)
  4590.         Else
  4591.                 TrayItemSetState($h, $tray_unchecked)
  4592.         EndIf
  4593.  
  4594. Func _logwindow()
  4595.         Local $dll = DllOpen("user32.dll"), $ikey = IniRead($sini, "Global_Config", "KeyBind1_AddWindow", 72)
  4596.         TrayTip("Press " & _ispressedfriendlyname($ikey) & " to add the active window", "", 10)
  4597.         Local $i = TimerInit()
  4598.         While 1
  4599.                 If TimerDiff($i) > 15000 Then
  4600.                         TrayTip($sappname, "No window added", 10)
  4601.                         Return
  4602.                 EndIf
  4603.                 If _ispressed($ikey, $dll) Then ExitLoop
  4604.                 Sleep(50)
  4605.         WEnd
  4606.         DllClose($dll)
  4607.         If IniRead($sini, "Global_Config", "AddWindow_Confirmation", "never") = "always" Then
  4608.                 $i = WinGetHandle("[ACTIVE]")
  4609.                 If MsgBox(4 + 32 + 262144, "Windowed Borderless Gaming", "The window that will be added is: " & WinGetTitle($i) & @CRLF & "Is this the correct window?") <> 6 Then Return
  4610.                 WinActivate($i)
  4611.         EndIf
  4612.         _wingetinfo()
  4613.  
  4614. Func _wingetinfo()
  4615.         Local $hwnd = WinGetHandle("[ACTIVE]")
  4616.         Local $sprocess = _processgetname(WinGetProcess($hwnd))
  4617.         Local $istyle = _winapi_getwindowlong($hwnd, -16)
  4618.         Local $stitle = WinGetTitle($hwnd)
  4619.         Local $sclass = _winapi_getclassname($hwnd)
  4620.         If StringRegExp($sclass, "(?i)(AutoIt)") Then Return
  4621.         Local $ssection = "Title:" & $stitle & ";Class:" & $sclass
  4622.         $ssection = StringReplace($ssection, "[", "&#91;")
  4623.         $ssection = StringReplace($ssection, "]", "&#93;")
  4624.         IniWrite($sini, $ssection, "Process", $sprocess)
  4625.         IniWrite($sini, $ssection, "Style", $istyle)
  4626.         IniWrite($sini, "Global_Config", "LastUsed", _gs_getuniquefriendlyname($stitle))
  4627.         IniWrite($sini, $ssection, "friendlyname", _gs_getuniquefriendlyname($stitle))
  4628.         If IniRead($sini, "Global_Config", "AutoSetResolution", "never") = "always" Then
  4629.                 IniWrite($sini, $ssection, "Width", IniRead($sini, "Global_Config", "DefaultDeskTopWidth", @DesktopWidth))
  4630.                 IniWrite($sini, $ssection, "Height", IniRead($sini, "Global_Config", "DefaultDeskTopHeight", @DesktopHeight))
  4631.         EndIf
  4632.         If IniRead($sini, "Global_Config", "AutoSetOffset", "never") = "always" Then
  4633.                 If IniRead($sini, "Global_Config", "DefaultPosX", 0) <> 0 Then IniWrite($sini, $ssection, "PosX", IniRead($sini, "Global_Config", "DefaultPosX", 0))
  4634.                 If IniRead($sini, "Global_Config", "DefaultPosY", 0) <> 0 Then IniWrite($sini, $ssection, "PosY", IniRead($sini, "Global_Config", "DefaultPosY", 0))
  4635.         EndIf
  4636.         Local $a[4] = [0, 0, "", ""]
  4637.         If IniRead($sini, "Global_Config", "AutoSetResolution", "never") = "always" Then
  4638.                 $a[2] = IniRead($sini, "Global_Config", "DefaultDeskTopWidth", @DesktopWidth)
  4639.                 $a[3] = IniRead($sini, "Global_Config", "DefaultDeskTopHeight", @DesktopHeight)
  4640.         EndIf
  4641.         If IniRead($sini, "Global_Config", "AutoSetOffset", "never") = "always" Then
  4642.                 $a[0] = IniRead($sini, "Global_Config", "DefaultPosX", 0)
  4643.                 $a[1] = IniRead($sini, "Global_Config", "DefaultPosY", 0)
  4644.         EndIf
  4645.         _winsetborderless($hwnd, $a[0], $a[1], $a[2], $a[3], $ssection)
  4646.         If _winapi_getwindowlong($hwnd, -16) <> IniRead($sini, $ssection, "Style", "ERROR") Then
  4647.                 TrayTip($sappname, 'Window "' & $stitle & '" added', 10)
  4648.                 Return 1
  4649.         Else
  4650.                 _inidelete($sini, $ssection)
  4651.                 TrayTip($sappname, 'Window "' & $stitle & '" could not be added ', 10)
  4652.                 Return 0
  4653.         EndIf
  4654.  
  4655. Func _winsetborderless($hwnd, $x, $y, $iwidth, $iheight, $ssection)
  4656.         If NOT WinExists($hwnd) Then Return SetError(1, 0, 0)
  4657.         BlockInput(1)
  4658.         WinMove($hwnd, "", Number($x), Number($y))
  4659.         _winapi_setwindowlong($hwnd, -16, -2147483648 + 268435456 + 131072)
  4660.         If IniRead($sini, $ssection, "Redraw", "always") = "always" Then WinSetState($hwnd, "", @SW_MINIMIZE)
  4661.         Sleep(100)
  4662.         WinActivate($hwnd)
  4663.         If $iheight = "" OR $iwidth = "" Then
  4664.                 WinMove($hwnd, "", Number($x), Number($y))
  4665.         Else
  4666.                 WinMove($hwnd, "", Number($x), Number($y), $iwidth, $iheight)
  4667.         EndIf
  4668.         BlockInput(0)
  4669.