/delphi/lib/CommCtrl.pas

http://delphi-miranda-plugins.googlecode.com/ · Pascal · 9360 lines · 7150 code · 1456 blank · 754 comment · 45 complexity · 72b11e47e03b964aa9b4f81884faebf3 MD5 · raw file

  1. {*******************************************************}
  2. { }
  3. { CodeGear Delphi Runtime Library }
  4. { }
  5. { Copyright (c) 1985-1999, Microsoft Corporation }
  6. { }
  7. { Translator: Borland Software Corporation }
  8. { }
  9. {*******************************************************}
  10. {*******************************************************}
  11. { Win32 Common Controls Interface Unit }
  12. {*******************************************************}
  13. unit CommCtrl;
  14. {$WEAKPACKAGEUNIT}
  15. interface
  16. uses Messages, Windows, ActiveX;
  17. { From prsht.h -- Interface for the Windows Property Sheet Pages }
  18. const
  19. MAXPROPPAGES = 100;
  20. PSP_DEFAULT = $00000000;
  21. PSP_DLGINDIRECT = $00000001;
  22. PSP_USEHICON = $00000002;
  23. PSP_USEICONID = $00000004;
  24. PSP_USETITLE = $00000008;
  25. PSP_RTLREADING = $00000010;
  26. PSP_HASHELP = $00000020;
  27. PSP_USEREFPARENT = $00000040;
  28. PSP_USECALLBACK = $00000080;
  29. PSP_PREMATURE = $00000400;
  30. PSP_HIDEHEADER = $00000800;
  31. PSP_USEHEADERTITLE = $00001000;
  32. PSP_USEHEADERSUBTITLE = $00002000;
  33. PSPCB_RELEASE = 1;
  34. PSPCB_CREATE = 2;
  35. PSH_DEFAULT = $00000000;
  36. PSH_PROPTITLE = $00000001;
  37. PSH_USEHICON = $00000002;
  38. PSH_USEICONID = $00000004;
  39. PSH_PROPSHEETPAGE = $00000008;
  40. PSH_WIZARDHASFINISH = $00000010;
  41. PSH_MULTILINETABS = $00000010;
  42. PSH_WIZARD = $00000020;
  43. PSH_USEPSTARTPAGE = $00000040;
  44. PSH_NOAPPLYNOW = $00000080;
  45. PSH_USECALLBACK = $00000100;
  46. PSH_HASHELP = $00000200;
  47. PSH_MODELESS = $00000400;
  48. PSH_RTLREADING = $00000800;
  49. PSH_WIZARDCONTEXTHELP = $00001000;
  50. PSH_WIZARD97 = $00002000;
  51. PSH_WATERMARK = $00008000;
  52. PSH_USEHBMWATERMARK = $00010000; // user pass in a hbmWatermark instead of pszbmWatermark
  53. PSH_USEHPLWATERMARK = $00020000; //
  54. PSH_STRETCHWATERMARK = $00040000; // stretchwatermark also applies for the header
  55. PSH_HEADER = $00080000;
  56. PSH_USEHBMHEADER = $00100000;
  57. PSH_USEPAGELANG = $00200000; // use frame dialog template matched to page
  58. PSCB_INITIALIZED = 1;
  59. PSCB_PRECREATE = 2;
  60. PSN_FIRST = -200;
  61. PSN_LAST = -299;
  62. PSN_SETACTIVE = PSN_FIRST - 0;
  63. PSN_KILLACTIVE = PSN_FIRST - 1;
  64. PSN_APPLY = PSN_FIRST - 2;
  65. PSN_RESET = PSN_FIRST - 3;
  66. PSN_HELP = PSN_FIRST - 5;
  67. PSN_WIZBACK = PSN_FIRST - 6;
  68. PSN_WIZNEXT = PSN_FIRST - 7;
  69. PSN_WIZFINISH = PSN_FIRST - 8;
  70. PSN_QUERYCANCEL = PSN_FIRST - 9;
  71. PSN_GETOBJECT = PSN_FIRST - 10;
  72. PSNRET_NOERROR = 0;
  73. PSNRET_INVALID = 1;
  74. PSNRET_INVALID_NOCHANGEPAGE = 2;
  75. PSM_SETCURSEL = WM_USER + 101;
  76. PSM_REMOVEPAGE = WM_USER + 102;
  77. PSM_ADDPAGE = WM_USER + 103;
  78. PSM_CHANGED = WM_USER + 104;
  79. PSM_RESTARTWINDOWS = WM_USER + 105;
  80. PSM_REBOOTSYSTEM = WM_USER + 106;
  81. PSM_CANCELTOCLOSE = WM_USER + 107;
  82. PSM_QUERYSIBLINGS = WM_USER + 108;
  83. PSM_UNCHANGED = WM_USER + 109;
  84. PSM_APPLY = WM_USER + 110;
  85. PSM_SETTITLE = WM_USER + 111;
  86. PSM_SETTITLEW = WM_USER + 120;
  87. PSM_SETWIZBUTTONS = WM_USER + 112;
  88. PSM_PRESSBUTTON = WM_USER + 113;
  89. PSM_SETCURSELID = WM_USER + 114;
  90. PSM_SETFINISHTEXT = WM_USER + 115;
  91. PSM_SETFINISHTEXTW = WM_USER + 121;
  92. PSM_GETTABCONTROL = WM_USER + 116;
  93. PSM_ISDIALOGMESSAGE = WM_USER + 117;
  94. PSWIZB_BACK = $00000001;
  95. PSWIZB_NEXT = $00000002;
  96. PSWIZB_FINISH = $00000004;
  97. PSWIZB_DISABLEDFINISH = $00000008;
  98. PSBTN_BACK = 0;
  99. PSBTN_NEXT = 1;
  100. PSBTN_FINISH = 2;
  101. PSBTN_OK = 3;
  102. PSBTN_APPLYNOW = 4;
  103. PSBTN_CANCEL = 5;
  104. PSBTN_HELP = 6;
  105. PSBTN_MAX = 6;
  106. ID_PSRESTARTWINDOWS = 2;
  107. ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS or 1;
  108. WIZ_CXDLG = 276;
  109. WIZ_CYDLG = 140;
  110. WIZ_CXBMP = 80;
  111. WIZ_BODYX = 92;
  112. WIZ_BODYCX = 184;
  113. PROP_SM_CXDLG = 212;
  114. PROP_SM_CYDLG = 188;
  115. PROP_MED_CXDLG = 227;
  116. PROP_MED_CYDLG = 215;
  117. PROP_LG_CXDLG = 252;
  118. PROP_LG_CYDLG = 218;
  119. type
  120. HPropSheetPage = Pointer;
  121. PPropSheetPageA = ^TPropSheetPageA;
  122. PPropSheetPageW = ^TPropSheetPageW;
  123. PPropSheetPage = PPropSheetPageW;
  124. LPFNPSPCALLBACKA = function(Wnd: HWnd; Msg: Integer;
  125. PPSP: PPropSheetPageA): Integer stdcall;
  126. LPFNPSPCALLBACKW = function(Wnd: HWnd; Msg: Integer;
  127. PPSP: PPropSheetPageW): Integer stdcall;
  128. LPFNPSPCALLBACK = LPFNPSPCALLBACKW;
  129. TFNPSPCallbackA = LPFNPSPCALLBACKA;
  130. TFNPSPCallbackW = LPFNPSPCALLBACKW;
  131. TFNPSPCallback = TFNPSPCallbackW;
  132. _PROPSHEETPAGEA = record
  133. dwSize: DWORD;
  134. dwFlags: DWORD;
  135. hInstance: THandle;
  136. case Integer of
  137. 0: (
  138. pszTemplate: PAnsiChar);
  139. 1: (
  140. pResource: Pointer;
  141. case Integer of
  142. 0: (
  143. hIcon: THandle);
  144. 1: (
  145. pszIcon: PAnsiChar;
  146. pszTitle: PAnsiChar;
  147. pfnDlgProc: Pointer;
  148. lParam: Longint;
  149. pfnCallback: TFNPSPCallbackA;
  150. pcRefParent: PInteger;
  151. pszHeaderTitle: PAnsiChar; // this is displayed in the header
  152. pszHeaderSubTitle: PAnsiChar)); //
  153. end;
  154. _PROPSHEETPAGEW = record
  155. dwSize: DWORD;
  156. dwFlags: DWORD;
  157. hInstance: THandle;
  158. case Integer of
  159. 0: (
  160. pszTemplate: PWideChar);
  161. 1: (
  162. pResource: Pointer;
  163. case Integer of
  164. 0: (
  165. hIcon: THandle);
  166. 1: (
  167. pszIcon: PWideChar;
  168. pszTitle: PWideChar;
  169. pfnDlgProc: Pointer;
  170. lParam: Longint;
  171. pfnCallback: TFNPSPCallbackW;
  172. pcRefParent: PInteger;
  173. pszHeaderTitle: PWideChar; // this is displayed in the header
  174. pszHeaderSubTitle: PWideChar)); //
  175. end;
  176. _PROPSHEETPAGE = _PROPSHEETPAGEW;
  177. TPropSheetPageA = _PROPSHEETPAGEA;
  178. TPropSheetPageW = _PROPSHEETPAGEW;
  179. TPropSheetPage = TPropSheetPageW;
  180. PROPSHEETPAGEA = _PROPSHEETPAGEA;
  181. PROPSHEETPAGEW = _PROPSHEETPAGEW;
  182. PROPSHEETPAGE = PROPSHEETPAGEW;
  183. PFNPROPSHEETCALLBACK = function(Wnd: HWnd; Msg: Integer;
  184. LParam: Integer): Integer stdcall;
  185. TFNPropSheetCallback = PFNPROPSHEETCALLBACK;
  186. PPropSheetHeaderA = ^TPropSheetHeaderA;
  187. PPropSheetHeaderW = ^TPropSheetHeaderW;
  188. PPropSheetHeader = PPropSheetHeaderW;
  189. _PROPSHEETHEADERA = record
  190. dwSize: DWORD;
  191. dwFlags: DWORD;
  192. hwndParent: HWnd;
  193. hInstance: THandle;
  194. case Integer of
  195. 0: (
  196. hIcon: THandle);
  197. 1: (
  198. pszIcon: PAnsiChar;
  199. pszCaption: PAnsiChar;
  200. nPages: Integer;
  201. case Integer of
  202. 0: (
  203. nStartPage: Integer);
  204. 1: (
  205. pStartPage: PAnsiChar;
  206. case Integer of
  207. 0: (
  208. ppsp: PPropSheetPageA);
  209. 1: (
  210. phpage: Pointer;
  211. pfnCallback: TFNPropSheetCallback;
  212. case Integer of
  213. 0: (
  214. hbmWatermark: HBITMAP);
  215. 1: (
  216. pszbmWatermark: PAnsiChar;
  217. hplWatermark: HPALETTE;
  218. // Header bitmap shares the palette with watermark
  219. case Integer of
  220. 0: (
  221. hbmHeader: HBITMAP);
  222. 1: (
  223. pszbmHeader: PAnsiChar)))));
  224. end;
  225. _PROPSHEETHEADERW = record
  226. dwSize: DWORD;
  227. dwFlags: DWORD;
  228. hwndParent: HWnd;
  229. hInstance: THandle;
  230. case Integer of
  231. 0: (
  232. hIcon: THandle);
  233. 1: (
  234. pszIcon: PWideChar;
  235. pszCaption: PWideChar;
  236. nPages: Integer;
  237. case Integer of
  238. 0: (
  239. nStartPage: Integer);
  240. 1: (
  241. pStartPage: PWideChar;
  242. case Integer of
  243. 0: (
  244. ppsp: PPropSheetPageW);
  245. 1: (
  246. phpage: Pointer;
  247. pfnCallback: TFNPropSheetCallback;
  248. case Integer of
  249. 0: (
  250. hbmWatermark: HBITMAP);
  251. 1: (
  252. pszbmWatermark: PWideChar;
  253. hplWatermark: HPALETTE;
  254. // Header bitmap shares the palette with watermark
  255. case Integer of
  256. 0: (
  257. hbmHeader: HBITMAP);
  258. 1: (
  259. pszbmHeader: PWideChar)))));
  260. end;
  261. _PROPSHEETHEADER = _PROPSHEETHEADERW;
  262. TPropSheetHeaderA = _PROPSHEETHEADERA;
  263. TPropSheetHeaderW = _PROPSHEETHEADERW;
  264. TPropSheetHeader = TPropSheetHeaderW;
  265. LPFNADDPROPSHEETPAGE = function(hPSP: HPropSheetPage;
  266. lParam: Longint): BOOL stdcall;
  267. TFNAddPropSheetPage = LPFNADDPROPSHEETPAGE;
  268. LPFNADDPROPSHEETPAGES = function(lpvoid: Pointer; pfn: TFNAddPropSheetPage;
  269. lParam: Longint): BOOL stdcall;
  270. TFNAddPropSheetPages = LPFNADDPROPSHEETPAGES;
  271. function CreatePropertySheetPage(var PSP: TPropSheetPage): HPropSheetPage; stdcall;
  272. function CreatePropertySheetPageA(var PSP: TPropSheetPageA): HPropSheetPage; stdcall;
  273. function CreatePropertySheetPageW(var PSP: TPropSheetPageW): HPropSheetPage; stdcall;
  274. function DestroyPropertySheetPage(hPSP: HPropSheetPage): BOOL; stdcall;
  275. function PropertySheet(var PSH: TPropSheetHeader): Integer; stdcall;
  276. function PropertySheetA(var PSH: TPropSheetHeaderA): Integer; stdcall;
  277. function PropertySheetW(var PSH: TPropSheetHeaderW): Integer; stdcall;
  278. { From commctrl.h }
  279. type
  280. tagINITCOMMONCONTROLSEX = packed record
  281. dwSize: DWORD; // size of this structure
  282. dwICC: DWORD; // flags indicating which classes to be initialized
  283. end;
  284. PInitCommonControlsEx = ^TInitCommonControlsEx;
  285. TInitCommonControlsEx = tagINITCOMMONCONTROLSEX;
  286. const
  287. ICC_LISTVIEW_CLASSES = $00000001; // listview, header
  288. ICC_TREEVIEW_CLASSES = $00000002; // treeview, tooltips
  289. ICC_BAR_CLASSES = $00000004; // toolbar, statusbar, trackbar, tooltips
  290. ICC_TAB_CLASSES = $00000008; // tab, tooltips
  291. ICC_UPDOWN_CLASS = $00000010; // updown
  292. ICC_PROGRESS_CLASS = $00000020; // progress
  293. ICC_HOTKEY_CLASS = $00000040; // hotkey
  294. ICC_ANIMATE_CLASS = $00000080; // animate
  295. ICC_WIN95_CLASSES = $000000FF;
  296. ICC_DATE_CLASSES = $00000100; // month picker, date picker, time picker, updown
  297. ICC_USEREX_CLASSES = $00000200; // comboex
  298. ICC_COOL_CLASSES = $00000400; // rebar (coolbar) control
  299. ICC_INTERNET_CLASSES = $00000800;
  300. ICC_PAGESCROLLER_CLASS = $00001000; // page scroller
  301. ICC_NATIVEFNTCTL_CLASS = $00002000; // native font control
  302. { For Windows >= XP }
  303. ICC_STANDARD_CLASSES = $00004000;
  304. ICC_LINK_CLASS = $00008000;
  305. procedure InitCommonControls; stdcall;
  306. function InitCommonControlsEx(var ICC: TInitCommonControlsEx): Bool; { Re-defined below }
  307. const
  308. IMAGE_BITMAP = 0;
  309. const
  310. ODT_HEADER = 100;
  311. ODT_TAB = 101;
  312. ODT_LISTVIEW = 102;
  313. { ====== Ranges for control message IDs ======================= }
  314. const
  315. LVM_FIRST = $1000; { ListView messages }
  316. TV_FIRST = $1100; { TreeView messages }
  317. HDM_FIRST = $1200; { Header messages }
  318. TCM_FIRST = $1300; { Tab control messages }
  319. PGM_FIRST = $1400; { Pager control messages }
  320. { For Windows >= XP }
  321. ECM_FIRST = $1500; { Edit control messages }
  322. BCM_FIRST = $1600; { Button control messages }
  323. CBM_FIRST = $1700; { Combobox control messages }
  324. CCM_FIRST = $2000; { Common control shared messages }
  325. CCM_LAST = CCM_FIRST + $200;
  326. CCM_SETBKCOLOR = CCM_FIRST + 1; // lParam is bkColor
  327. type
  328. tagCOLORSCHEME = packed record
  329. dwSize: DWORD;
  330. clrBtnHighlight: COLORREF; // highlight color
  331. clrBtnShadow: COLORREF; // shadow color
  332. end;
  333. PColorScheme = ^TColorScheme;
  334. TColorScheme = tagCOLORSCHEME;
  335. const
  336. CCM_SETCOLORSCHEME = CCM_FIRST + 2; // lParam is color scheme
  337. CCM_GETCOLORSCHEME = CCM_FIRST + 3; // fills in COLORSCHEME pointed to by lParam
  338. CCM_GETDROPTARGET = CCM_FIRST + 4;
  339. CCM_SETUNICODEFORMAT = CCM_FIRST + 5;
  340. CCM_GETUNICODEFORMAT = CCM_FIRST + 6;
  341. CCM_SETVERSION = CCM_FIRST + $7;
  342. CCM_GETVERSION = CCM_FIRST + $8;
  343. CCM_SETNOTIFYWINDOW = CCM_FIRST + $9; { wParam == hwndParent. }
  344. { For Windows >= XP }
  345. CCM_SETWINDOWTHEME = CCM_FIRST + $B;
  346. CCM_DPISCALE = CCM_FIRST + $C; { wParam == Awareness }
  347. INFOTIPSIZE = 1024; // for tooltips
  348. { ====== WM_NOTIFY codes (NMHDR.code values) ================== }
  349. const
  350. NM_FIRST = 0- 0; { generic to all controls }
  351. NM_LAST = 0- 99;
  352. LVN_FIRST = 0-100; { listview }
  353. LVN_LAST = 0-199;
  354. HDN_FIRST = 0-300; { header }
  355. HDN_LAST = 0-399;
  356. TVN_FIRST = 0-400; { treeview }
  357. TVN_LAST = 0-499;
  358. TTN_FIRST = 0-520; { tooltips }
  359. TTN_LAST = 0-549;
  360. TCN_FIRST = 0-550; { tab control }
  361. TCN_LAST = 0-580;
  362. { Shell reserved (0-580) - (0-589) }
  363. CDN_FIRST = 0-601; { common dialog (new) }
  364. CDN_LAST = 0-699;
  365. TBN_FIRST = 0-700; { toolbar }
  366. TBN_LAST = 0-720;
  367. UDN_FIRST = 0-721; { updown }
  368. UDN_LAST = 0-740;
  369. MCN_FIRST = 0-750; { monthcal }
  370. MCN_LAST = 0-759;
  371. DTN_FIRST = 0-760; { datetimepick }
  372. DTN_LAST = 0-799;
  373. CBEN_FIRST = 0-800; { combo box ex }
  374. CBEN_LAST = 0-830;
  375. RBN_FIRST = 0-831; { coolbar }
  376. RBN_LAST = 0-859;
  377. IPN_FIRST = 0-860; { internet address }
  378. IPN_LAST = 0-879; { internet address }
  379. SBN_FIRST = 0-880; { status bar }
  380. SBN_LAST = 0-899;
  381. PGN_FIRST = 0-900; { Pager Control }
  382. PGN_LAST = 0-950;
  383. WMN_FIRST = 0-1000;
  384. WMN_LAST = 0-1200;
  385. { For Windows >= XP }
  386. BCN_FIRST = 0-1250;
  387. BCN_LAST = 0-1350;
  388. { For Windows >= Vista }
  389. TRBN_FIRST = 0-1501; { trackbar }
  390. TRBN_LAST = 0-1519;
  391. MSGF_COMMCTRL_BEGINDRAG = $4200;
  392. MSGF_COMMCTRL_SIZEHEADER = $4201;
  393. MSGF_COMMCTRL_DRAGSELECT = $4202;
  394. MSGF_COMMCTRL_TOOLBARCUST = $4203;
  395. { ====== Generic WM_NOTIFY notification codes ================= }
  396. const
  397. NM_OUTOFMEMORY = NM_FIRST-1;
  398. NM_CLICK = NM_FIRST-2;
  399. NM_DBLCLK = NM_FIRST-3;
  400. NM_RETURN = NM_FIRST-4;
  401. NM_RCLICK = NM_FIRST-5;
  402. NM_RDBLCLK = NM_FIRST-6;
  403. NM_SETFOCUS = NM_FIRST-7;
  404. NM_KILLFOCUS = NM_FIRST-8;
  405. NM_CUSTOMDRAW = NM_FIRST-12;
  406. NM_HOVER = NM_FIRST-13;
  407. NM_NCHITTEST = NM_FIRST-14; // uses NMMOUSE struct
  408. NM_KEYDOWN = NM_FIRST-15; // uses NMKEY struct
  409. NM_RELEASEDCAPTURE = NM_FIRST-16;
  410. NM_SETCURSOR = NM_FIRST-17; // uses NMMOUSE struct
  411. NM_CHAR = NM_FIRST-18; // uses NMCHAR struct
  412. NM_TOOLTIPSCREATED = NM_FIRST-19; { notify of when the tooltips window is create }
  413. NM_LDOWN = NM_FIRST-20;
  414. NM_RDOWN = NM_FIRST-21;
  415. NM_THEMECHANGED = NM_FIRST-22;
  416. { For Windows >= Vista }
  417. NM_FONTCHANGED = NM_FIRST-23;
  418. NM_CUSTOMTEXT = NM_FIRST-24; { uses NMCUSTOMTEXT struct }
  419. NM_TVSTATEIMAGECHANGING = NM_FIRST-24; { uses NMTVSTATEIMAGECHANGING struct, defined after HTREEITEM }
  420. type
  421. tagNMMOUSE = packed record
  422. hdr: TNMHdr;
  423. dwItemSpec: DWORD;
  424. dwItemData: DWORD;
  425. pt: TPoint;
  426. dwHitInfo: DWORD; // any specifics about where on the item or control the mouse is
  427. end;
  428. PNMMouse = ^TNMMouse;
  429. TNMMouse = tagNMMOUSE;
  430. PNMClick = ^TNMClick;
  431. TNMClick = tagNMMOUSE;
  432. // Generic structure to request an object of a specific type.
  433. tagNMOBJECTNOTIFY = packed record
  434. hdr: TNMHdr;
  435. iItem: Integer;
  436. piid: PGUID;
  437. pObject: Pointer;
  438. hResult: HRESULT;
  439. dwFlags: DWORD; // control specific flags (hints as to where in iItem it hit)
  440. end;
  441. PNMObjectNotify = ^TNMObjectNotify;
  442. TNMObjectNotify = tagNMOBJECTNOTIFY;
  443. // Generic structure for a key
  444. tagNMKEY = packed record
  445. hdr: TNMHdr;
  446. nVKey: UINT;
  447. uFlags: UINT;
  448. end;
  449. PNMKey = ^TNMKey;
  450. TNMKey = tagNMKEY;
  451. // Generic structure for a character
  452. tagNMCHAR = packed record
  453. hdr: TNMHdr;
  454. ch: UINT;
  455. dwItemPrev: DWORD; // Item previously selected
  456. dwItemNext: DWORD; // Item to be selected
  457. end;
  458. PNMChar = ^TNMChar;
  459. TNMChar = tagNMCHAR;
  460. { For IE >= 0x0600 }
  461. { $EXTERNALSYM tagNMCUSTOMTEXT}
  462. tagNMCUSTOMTEXT = record
  463. hdr: NMHDR;
  464. hDC: HDC;
  465. lpString: LPCWSTR;
  466. nCount: Integer;
  467. lpRect: PRect;
  468. uFormat: UINT;
  469. fLink: BOOL;
  470. end;
  471. PNMCustomText = ^TNMCustomText;
  472. TNMCustomText = tagNMCUSTOMTEXT;
  473. { ==================== CUSTOM DRAW ========================================== }
  474. const
  475. // custom draw return flags
  476. // values under 0x00010000 are reserved for global custom draw values.
  477. // above that are for specific controls
  478. CDRF_DODEFAULT = $00000000;
  479. CDRF_NEWFONT = $00000002;
  480. CDRF_SKIPDEFAULT = $00000004;
  481. CDRF_NOTIFYPOSTPAINT = $00000010;
  482. CDRF_NOTIFYITEMDRAW = $00000020;
  483. CDRF_NOTIFYSUBITEMDRAW = $00000020; // flags are the same, we can distinguish by context
  484. CDRF_NOTIFYPOSTERASE = $00000040;
  485. // drawstage flags
  486. // values under = $00010000 are reserved for global custom draw values.
  487. // above that are for specific controls
  488. CDDS_PREPAINT = $00000001;
  489. CDDS_POSTPAINT = $00000002;
  490. CDDS_PREERASE = $00000003;
  491. CDDS_POSTERASE = $00000004;
  492. // the = $000010000 bit means it's individual item specific
  493. CDDS_ITEM = $00010000;
  494. CDDS_ITEMPREPAINT = CDDS_ITEM or CDDS_PREPAINT;
  495. CDDS_ITEMPOSTPAINT = CDDS_ITEM or CDDS_POSTPAINT;
  496. CDDS_ITEMPREERASE = CDDS_ITEM or CDDS_PREERASE;
  497. CDDS_ITEMPOSTERASE = CDDS_ITEM or CDDS_POSTERASE;
  498. CDDS_SUBITEM = $00020000;
  499. // itemState flags
  500. CDIS_SELECTED = $0001;
  501. CDIS_GRAYED = $0002;
  502. CDIS_DISABLED = $0004;
  503. CDIS_CHECKED = $0008;
  504. CDIS_FOCUS = $0010;
  505. CDIS_DEFAULT = $0020;
  506. CDIS_HOT = $0040;
  507. CDIS_MARKED = $0080;
  508. CDIS_INDETERMINATE = $0100;
  509. { For Windows >= XP }
  510. CDIS_SHOWKEYBOARDCUES = $0200;
  511. { For Windows >= Vista }
  512. CDIS_NEARHOT = $0400;
  513. CDIS_OTHERSIDEHOT = $0800;
  514. CDIS_DROPHILITED = $1000;
  515. type
  516. tagNMCUSTOMDRAWINFO = packed record
  517. hdr: TNMHdr;
  518. dwDrawStage: DWORD;
  519. hdc: HDC;
  520. rc: TRect;
  521. dwItemSpec: DWORD; // this is control specific, but it's how to specify an item. valid only with CDDS_ITEM bit set
  522. uItemState: UINT;
  523. lItemlParam: LPARAM;
  524. end;
  525. PNMCustomDraw = ^TNMCustomDraw;
  526. TNMCustomDraw = tagNMCUSTOMDRAWINFO;
  527. tagNMTTCUSTOMDRAW = packed record
  528. nmcd: TNMCustomDraw;
  529. uDrawFlags: UINT;
  530. end;
  531. PNMTTCustomDraw = ^TNMTTCustomDraw;
  532. TNMTTCustomDraw = tagNMTTCUSTOMDRAW;
  533. { ====== IMAGE LIST =========================================== }
  534. const
  535. CLR_NONE = $FFFFFFFF;
  536. CLR_DEFAULT = $FF000000;
  537. type
  538. HIMAGELIST = THandle;
  539. _IMAGELISTDRAWPARAMS = packed record
  540. cbSize: DWORD;
  541. himl: HIMAGELIST;
  542. i: Integer;
  543. hdcDst: HDC;
  544. x: Integer;
  545. y: Integer;
  546. cx: Integer;
  547. cy: Integer;
  548. xBitmap: Integer; // x offest from the upperleft of bitmap
  549. yBitmap: Integer; // y offset from the upperleft of bitmap
  550. rgbBk: COLORREF;
  551. rgbFg: COLORREF;
  552. fStyle: UINT;
  553. dwRop: DWORD;
  554. { For IE >= 0x0501 }
  555. {fState: DWORD;
  556. Frame: DWORD;
  557. crEffect: COLORREF;}
  558. end;
  559. PImageListDrawParams = ^TImageListDrawParams;
  560. TImageListDrawParams = _IMAGELISTDRAWPARAMS;
  561. const
  562. ILC_MASK = $0001;
  563. ILC_COLOR = $0000;
  564. ILC_COLORDDB = $00FE;
  565. ILC_COLOR4 = $0004;
  566. ILC_COLOR8 = $0008;
  567. ILC_COLOR16 = $0010;
  568. ILC_COLOR24 = $0018;
  569. ILC_COLOR32 = $0020;
  570. ILC_PALETTE = $0800;
  571. { For Windows >= XP }
  572. ILC_MIRROR = $00002000; { Mirror the icons contained, if the process is mirrored }
  573. ILC_PERITEMMIRROR = $00008000; { Causes the mirroring code to mirror each item when inserting a set of images, verses the whole strip }
  574. { For Windows >= Vista }
  575. ILC_ORIGINALSIZE = $00010000; { Imagelist should accept smaller than set images and apply OriginalSize based on image added }
  576. ILC_HIGHQUALITYSCALE = $00020000; { Imagelist should enable use of the high quality scaler. }
  577. function ImageList_Create(CX, CY: Integer; Flags: UINT;
  578. Initial, Grow: Integer): HIMAGELIST; stdcall;
  579. function ImageList_Destroy(ImageList: HIMAGELIST): Bool; stdcall;
  580. function ImageList_GetImageCount(ImageList: HIMAGELIST): Integer; stdcall;
  581. function ImageList_SetImageCount(himl: HIMAGELIST; uNewCount: UINT): Integer; stdcall;
  582. function ImageList_Add(ImageList: HIMAGELIST; Image, Mask: HBitmap): Integer; stdcall;
  583. function ImageList_ReplaceIcon(ImageList: HIMAGELIST; Index: Integer;
  584. Icon: HIcon): Integer; stdcall;
  585. function ImageList_SetBkColor(ImageList: HIMAGELIST; ClrBk: TColorRef): TColorRef; stdcall;
  586. function ImageList_GetBkColor(ImageList: HIMAGELIST): TColorRef; stdcall;
  587. function ImageList_SetOverlayImage(ImageList: HIMAGELIST; Image: Integer;
  588. Overlay: Integer): Bool; stdcall;
  589. function ImageList_AddIcon(ImageList: HIMAGELIST; Icon: HIcon): Integer; {inline;}
  590. const
  591. ILD_NORMAL = $0000;
  592. ILD_TRANSPARENT = $0001;
  593. ILD_MASK = $0010;
  594. ILD_IMAGE = $0020;
  595. ILD_ROP = $0040;
  596. ILD_BLEND25 = $0002;
  597. ILD_BLEND50 = $0004;
  598. ILD_OVERLAYMASK = $0F00;
  599. ILD_PRESERVEALPHA = $00001000; // This preserves the alpha channel in dest
  600. ILD_SCALE = $00002000; // Causes the image to be scaled to cx, cy instead of clipped
  601. ILD_DPISCALE = $00004000;
  602. { For Windows >= Vista }
  603. ILD_ASYNC = $00008000;
  604. function IndexToOverlayMask(Index: Integer): Integer; {inline;}
  605. const
  606. ILD_SELECTED = ILD_BLEND50;
  607. ILD_FOCUS = ILD_BLEND25;
  608. ILD_BLEND = ILD_BLEND50;
  609. CLR_HILIGHT = CLR_DEFAULT;
  610. ILS_NORMAL = $00000000;
  611. ILS_GLOW = $00000001;
  612. ILS_SHADOW = $00000002;
  613. ILS_SATURATE = $00000004;
  614. ILS_ALPHA = $00000008;
  615. { For Windows >= Vista }
  616. ILGT_NORMAL = $00000000;
  617. ILGT_ASYNC = $00000001;
  618. function ImageList_Draw(ImageList: HIMAGELIST; Index: Integer;
  619. Dest: HDC; X, Y: Integer; Style: UINT): Bool; stdcall;
  620. const
  621. { For Windows >= Vista }
  622. HBITMAP_CALLBACK = HBITMAP(-1); // only for SparseImageList
  623. function ImageList_Replace(ImageList: HIMAGELIST; Index: Integer;
  624. Image, Mask: HBitmap): Bool; stdcall;
  625. function ImageList_AddMasked(ImageList: HIMAGELIST; Image: HBitmap;
  626. Mask: TColorRef): Integer; stdcall;
  627. function ImageList_DrawEx(ImageList: HIMAGELIST; Index: Integer;
  628. Dest: HDC; X, Y, DX, DY: Integer; Bk, Fg: TColorRef; Style: Cardinal): Bool; stdcall;
  629. function ImageList_DrawIndirect(pimldp: PImageListDrawParams): Integer; stdcall;
  630. function ImageList_Remove(ImageList: HIMAGELIST; Index: Integer): Bool; stdcall;
  631. function ImageList_GetIcon(ImageList: HIMAGELIST; Index: Integer;
  632. Flags: Cardinal): HIcon; stdcall;
  633. function ImageList_LoadImage(Instance: THandle; Bmp: PWideChar; CX, Grow: Integer;
  634. Mask: TColorRef; pType, Flags: Cardinal): HIMAGELIST; stdcall;
  635. function ImageList_LoadImageA(Instance: THandle; Bmp: PAnsiChar; CX, Grow: Integer;
  636. Mask: TColorRef; pType, Flags: Cardinal): HIMAGELIST; stdcall;
  637. function ImageList_LoadImageW(Instance: THandle; Bmp: PWideChar; CX, Grow: Integer;
  638. Mask: TColorRef; pType, Flags: Cardinal): HIMAGELIST; stdcall;
  639. const
  640. ILCF_MOVE = $00000000;
  641. ILCF_SWAP = $00000001;
  642. function ImageList_Copy(himlDst: HIMAGELIST; iDst: Integer; himlSrc: HIMAGELIST;
  643. Src: Integer; uFlags: UINT): Integer; stdcall;
  644. function ImageList_BeginDrag(ImageList: HIMAGELIST; Track: Integer;
  645. XHotSpot, YHotSpot: Integer): Bool; stdcall;
  646. function ImageList_EndDrag: Bool; stdcall;
  647. function ImageList_DragEnter(LockWnd: HWnd; X, Y: Integer): Bool; stdcall;
  648. function ImageList_DragLeave(LockWnd: HWnd): Bool; stdcall;
  649. function ImageList_DragMove(X, Y: Integer): Bool; stdcall;
  650. function ImageList_SetDragCursorImage(ImageList: HIMAGELIST; Drag: Integer;
  651. XHotSpot, YHotSpot: Integer): Bool; stdcall;
  652. function ImageList_DragShowNolock(Show: Bool): Bool; stdcall;
  653. function ImageList_GetDragImage(Point, HotSpot: PPoint): HIMAGELIST; overload; stdcall;
  654. function ImageList_GetDragImage(Point: PPoint; out HotSpot: TPoint): HIMAGELIST; overload; stdcall;
  655. { macros }
  656. procedure ImageList_RemoveAll(ImageList: HIMAGELIST); {inline;}
  657. function ImageList_ExtractIcon(Instance: THandle; ImageList: HIMAGELIST;
  658. Image: Integer): HIcon; {inline;}
  659. function ImageList_LoadBitmap(Instance: THandle; Bmp: PWideChar;
  660. CX, Grow: Integer; MasK: TColorRef): HIMAGELIST;
  661. function ImageList_LoadBitmapA(Instance: THandle; Bmp: PAnsiChar;
  662. CX, Grow: Integer; MasK: TColorRef): HIMAGELIST;
  663. function ImageList_LoadBitmapW(Instance: THandle; Bmp: PWideChar;
  664. CX, Grow: Integer; MasK: TColorRef): HIMAGELIST;
  665. function ImageList_Read(Stream: IStream): HIMAGELIST; stdcall;
  666. function ImageList_Write(ImageList: HIMAGELIST; Stream: IStream): BOOL; stdcall;
  667. const
  668. { For Windows >= XP }
  669. ILP_NORMAL = 0; { Writes or reads the stream using new sematics for this version of comctl32 }
  670. ILP_DOWNLEVEL = 1; { Write or reads the stream using downlevel sematics. }
  671. { For Windows >= XP }
  672. function ImageList_ReadEx(dwFlags: DWORD; pstm: IStream; const riid: TIID;
  673. var ppv: Pointer): HResult;
  674. function ImageList_WriteEx(himl: HIMAGELIST; dwFlags: DWORD;
  675. pstm: IStream): HResult;
  676. type
  677. PImageInfo = ^TImageInfo;
  678. _IMAGEINFO = packed record
  679. hbmImage: HBitmap;
  680. hbmMask: HBitmap;
  681. Unused1: Integer;
  682. Unused2: Integer;
  683. rcImage: TRect;
  684. end;
  685. TImageInfo = _IMAGEINFO;
  686. IMAGEINFO = _IMAGEINFO;
  687. function ImageList_GetIconSize(ImageList: HIMAGELIST; var CX, CY: Integer): Bool; stdcall;
  688. function ImageList_SetIconSize(ImageList: HIMAGELIST; CX, CY: Integer): Bool; stdcall;
  689. function ImageList_GetImageInfo(ImageList: HIMAGELIST; Index: Integer;
  690. var ImageInfo: TImageInfo): Bool; stdcall;
  691. function ImageList_Merge(ImageList1: HIMAGELIST; Index1: Integer;
  692. ImageList2: HIMAGELIST; Index2: Integer; DX, DY: Integer): HIMAGELIST; stdcall;
  693. function ImageList_Duplicate(himl: HIMAGELIST): HIMAGELIST; stdcall;
  694. function HIMAGELIST_QueryInterface(himl: HIMAGELIST; const riid: TIID;
  695. var ppv: Pointer): HResult;
  696. { ====== HEADER CONTROL ========================== }
  697. const
  698. WC_HEADER = 'SysHeader32';
  699. HDS_HORZ = $0000;
  700. HDS_BUTTONS = $0002;
  701. HDS_HOTTRACK = $0004;
  702. HDS_HIDDEN = $0008;
  703. HDS_DRAGDROP = $0040;
  704. HDS_FULLDRAG = $0080;
  705. HDS_FILTERBAR = $0100;
  706. { For Windows >= XP }
  707. HDS_FLAT = $0200;
  708. { For Windows >= Vista }
  709. HDS_CHECKBOXES = $0400;
  710. HDS_NOSIZING = $0800;
  711. HDS_OVERFLOW = $1000;
  712. type
  713. PHDItemA = ^THDItemA;
  714. PHDItemW = ^THDItemW;
  715. PHDItem = PHDItemW;
  716. _HD_ITEMA = record
  717. Mask: Cardinal;
  718. cxy: Integer;
  719. pszText: PAnsiChar;
  720. hbm: HBITMAP;
  721. cchTextMax: Integer;
  722. fmt: Integer;
  723. lParam: LPARAM;
  724. iImage: Integer; // index of bitmap in ImageList
  725. iOrder: Integer; // where to draw this item
  726. { For IE >= 0x0500 }
  727. // type: UINT; // [in] filter type (defined what pvFilter is a pointer to)
  728. // pvFilter: PVOID; // [in] filter data see above
  729. { For Windows >= Vista }
  730. // state: UINT;
  731. end;
  732. _HD_ITEMW = record
  733. Mask: Cardinal;
  734. cxy: Integer;
  735. pszText: PWideChar;
  736. hbm: HBITMAP;
  737. cchTextMax: Integer;
  738. fmt: Integer;
  739. lParam: LPARAM;
  740. iImage: Integer; // index of bitmap in ImageList
  741. iOrder: Integer; // where to draw this item
  742. { For IE >= 0x0500 }
  743. // type: UINT; // [in] filter type (defined what pvFilter is a pointer to)
  744. // pvFilter: PVOID; // [in] filter data see above
  745. { For Windows >= Vista }
  746. // state: UINT;
  747. end;
  748. _HD_ITEM = _HD_ITEMW;
  749. THDItemA = _HD_ITEMA;
  750. THDItemW = _HD_ITEMW;
  751. THDItem = THDItemW;
  752. HD_ITEMA = _HD_ITEMA;
  753. HD_ITEMW = _HD_ITEMW;
  754. HD_ITEM = HD_ITEMW;
  755. const
  756. HDI_WIDTH = $0001;
  757. HDI_HEIGHT = HDI_WIDTH;
  758. HDI_TEXT = $0002;
  759. HDI_FORMAT = $0004;
  760. HDI_LPARAM = $0008;
  761. HDI_BITMAP = $0010;
  762. HDI_IMAGE = $0020;
  763. HDI_DI_SETITEM = $0040;
  764. HDI_ORDER = $0080;
  765. { For IE >= 0x0500 }
  766. HDI_FILTER = $0100;
  767. { For Windows >= Vista }
  768. HDI_STATE = $0200;
  769. HDF_LEFT = $0000; { Same as LVCFMT_LEFT }
  770. HDF_RIGHT = $0001; { Same as LVCFMT_RIGHT }
  771. HDF_CENTER = $0002; { Same as LVCFMT_CENTER }
  772. HDF_JUSTIFYMASK = $0003; { Same as LVCFMT_JUSTIFYMASK }
  773. HDF_RTLREADING = $0004; { Same as LVCFMT_LEFT }
  774. HDF_BITMAP = $2000;
  775. HDF_STRING = $4000;
  776. HDF_OWNERDRAW = $8000; { Same as LVCFMT_COL_HAS_IMAGES }
  777. HDF_IMAGE = $0800; { Same as LVCFMT_IMAGE }
  778. HDF_BITMAP_ON_RIGHT = $1000; { Same as LVCFMT_BITMAP_ON_RIGHT }
  779. { For Windows >= XP }
  780. HDF_SORTUP = $0400;
  781. HDF_SORTDOWN = $0200;
  782. { For Windows >= Vista }
  783. HDF_CHECKBOX = $0040;
  784. HDF_CHECKED = $0080;
  785. HDF_FIXEDWIDTH = $0100; { Can't resize the column; same as LVCFMT_FIXED_WIDTH }
  786. HDF_SPLITBUTTON = $1000000; { Column is a split button; same as LVCFMT_SPLITBUTTON }
  787. { For Windows >= Vista }
  788. HDIS_FOCUSED = $00000001;
  789. HDM_GETITEMCOUNT = HDM_FIRST + 0;
  790. function Header_GetItemCount(Header: HWnd): Integer; {inline;}
  791. const
  792. HDM_INSERTITEMW = HDM_FIRST + 10;
  793. HDM_INSERTITEMA = HDM_FIRST + 1;
  794. {$IFDEF UNICODE}
  795. HDM_INSERTITEM = HDM_INSERTITEMW;
  796. {$ELSE}
  797. HDM_INSERTITEM = HDM_INSERTITEMA;
  798. {$ENDIF}
  799. function Header_InsertItem(Header: HWnd; Index: Integer;
  800. const Item: THDItem): Integer; {inline;}
  801. function Header_InsertItemA(Header: HWnd; Index: Integer;
  802. const Item: THDItemA): Integer; {inline;}
  803. function Header_InsertItemW(Header: HWnd; Index: Integer;
  804. const Item: THDItemW): Integer; {inline;}
  805. const
  806. HDM_DELETEITEM = HDM_FIRST + 2;
  807. function Header_DeleteItem(Header: HWnd; Index: Integer): Bool; {inline;}
  808. const
  809. HDM_GETITEMW = HDM_FIRST + 11;
  810. HDM_GETITEMA = HDM_FIRST + 3;
  811. {$IFDEF UNICODE}
  812. HDM_GETITEM = HDM_GETITEMW;
  813. {$ELSE}
  814. HDM_GETITEM = HDM_GETITEMA;
  815. {$ENDIF}
  816. function Header_GetItem(Header: HWnd; Index: Integer;
  817. var Item: THDItem): Bool; {inline;}
  818. function Header_GetItemA(Header: HWnd; Index: Integer;
  819. var Item: THDItemA): Bool; {inline;}
  820. function Header_GetItemW(Header: HWnd; Index: Integer;
  821. var Item: THDItemW): Bool; {inline;}
  822. const
  823. HDM_SETITEMA = HDM_FIRST + 4;
  824. HDM_SETITEMW = HDM_FIRST + 12;
  825. {$IFDEF UNICODE}
  826. HDM_SETITEM = HDM_SETITEMW;
  827. {$ELSE}
  828. HDM_SETITEM = HDM_SETITEMA;
  829. {$ENDIF}
  830. function Header_SetItem(Header: HWnd; Index: Integer; const Item: THDItem): Bool; {inline;}
  831. function Header_SetItemA(Header: HWnd; Index: Integer; const Item: THDItemA): Bool; {inline;}
  832. function Header_SetItemW(Header: HWnd; Index: Integer; const Item: THDItemW): Bool; {inline;}
  833. type
  834. PHDLayout = ^THDLayout;
  835. _HD_LAYOUT = packed record
  836. Rect: ^TRect;
  837. WindowPos: PWindowPos;
  838. end;
  839. THDLayout = _HD_LAYOUT;
  840. HD_LAYOUT = _HD_LAYOUT;
  841. const
  842. HDM_LAYOUT = HDM_FIRST + 5;
  843. function Header_Layout(Header: HWnd; Layout: PHDLayout): Bool; {inline;}
  844. const
  845. HHT_NOWHERE = $0001;
  846. HHT_ONHEADER = $0002;
  847. HHT_ONDIVIDER = $0004;
  848. HHT_ONDIVOPEN = $0008;
  849. HHT_ABOVE = $0100;
  850. HHT_BELOW = $0200;
  851. HHT_TORIGHT = $0400;
  852. HHT_TOLEFT = $0800;
  853. { For Windows >= Vista }
  854. HHT_ONITEMSTATEICON = $1000;
  855. HHT_ONDROPDOWN = $2000;
  856. HHT_ONOVERFLOW = $4000;
  857. type
  858. PHDHitTestInfo = ^THDHitTestInfo;
  859. _HD_HITTESTINFO = packed record
  860. Point: TPoint;
  861. Flags: Cardinal;
  862. Item: Integer;
  863. end;
  864. THDHitTestInfo = _HD_HITTESTINFO;
  865. HD_HITTESTINFO = _HD_HITTESTINFO;
  866. const
  867. HDM_HITTEST = HDM_FIRST + 6;
  868. HDM_GETITEMRECT = HDM_FIRST + 7;
  869. HDM_SETIMAGELIST = HDM_FIRST + 8;
  870. HDM_GETIMAGELIST = HDM_FIRST + 9;
  871. HDM_ORDERTOINDEX = HDM_FIRST + 15;
  872. HDM_CREATEDRAGIMAGE = HDM_FIRST + 16; // wparam = which item = by index;
  873. HDM_GETORDERARRAY = HDM_FIRST + 17;
  874. HDM_SETORDERARRAY = HDM_FIRST + 18;
  875. HDM_SETHOTDIVIDER = HDM_FIRST + 19;
  876. HDM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  877. HDM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  878. { For IE >= 0x0500 }
  879. HDM_SETBITMAPMARGIN = HDM_FIRST + 20;
  880. HDM_GETBITMAPMARGIN = HDM_FIRST + 21;
  881. HDM_SETFILTERCHANGETIMEOUT = HDM_FIRST + 22;
  882. HDM_EDITFILTER = HDM_FIRST + 23;
  883. HDM_CLEARFILTER = HDM_FIRST + 24;
  884. { For Windows >= 0x0600 }
  885. // Not currently implemented
  886. //HDM_TRANSLATEACCELERATOR = CCM_TRANSLATEACCELERATOR;
  887. { For Windows >= Vista}
  888. HDM_GETITEMDROPDOWNRECT = HDM_FIRST + 25; // rect of item's drop down button
  889. HDM_GETOVERFLOWRECT = HDM_FIRST + 26; // rect of overflow button
  890. HDM_GETFOCUSEDITEM = HDM_FIRST + 27;
  891. HDM_SETFOCUSEDITEM = HDM_FIRST + 28;
  892. function Header_GetItemRect(hwnd: HWND; iItem: Integer; lprc: PRect): Integer; {inline;}
  893. function Header_SetImageList(hwnd: HWND; himl: HIMAGELIST): HIMAGELIST; {inline;}
  894. function Header_GetImageList(hwnd: HWND): HIMAGELIST; {inline;}
  895. function Header_OrderToIndex(hwnd: HWND; i: Integer): Integer; {inline;}
  896. function Header_CreateDragImage(hwnd: HWND; i: Integer): HIMAGELIST; {inline;}
  897. function Header_GetOrderArray(hwnd: HWND; iCount: Integer; lpi: PInteger): Integer; {inline;}
  898. function Header_SetOrderArray(hwnd: HWND; iCount: Integer; lpi: PInteger): Integer; {inline;}
  899. // lparam = int array of size HDM_GETITEMCOUNT
  900. // the array specifies the order that all items should be displayed.
  901. // e.g. { 2, 0, 1}
  902. // says the index 2 item should be shown in the 0ths position
  903. // index 0 should be shown in the 1st position
  904. // index 1 should be shown in the 2nd position
  905. function Header_SetHotDivider(hwnd: HWND; fPos: BOOL; dw: DWORD): Integer; {inline;}
  906. // convenience message for external dragdrop
  907. // wParam = BOOL specifying whether the lParam is a dwPos of the cursor
  908. // position or the index of which divider to hotlight
  909. // lParam = depends on wParam (-1 and wParm = FALSE turns off hotlight)
  910. function Header_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): Integer; {inline;}
  911. function Header_GetUnicodeFormat(hwnd: HWND): Integer; {inline;}
  912. { For IE >= 0x0500 }
  913. function Header_SetBitmapMargin(hwnd: HWND; iWidth: Integer): Integer; {inline;}
  914. function Header_GetBitmapMargin(hwnd: HWND): Integer; {inline;}
  915. function Header_SetFilterChangeTimeout(hwnd: HWND; i: Integer): Integer; {inline;}
  916. function Header_EditFilter(hwnd: HWND; i: Integer; fDiscardChanges: BOOL): Integer; {inline;}
  917. function Header_ClearFilter(hwnd: HWND; i: Integer): Integer; {inline;}
  918. function Header_ClearAllFilters(hwnd: HWND): Integer; {inline;}
  919. { For Windows >= Vista}
  920. function Header_GetItemDropDownRect(hwnd: HWND; iItem: Integer; var lprc: TRect): BOOL; {inline;}
  921. function Header_GetOverflowRect(hwnd: HWND; var lprc: TRect): BOOL; {inline;}
  922. function Header_GetFocusedItem(hwnd: HWND): Integer; {inline;}
  923. function Header_SetFocusedItem(hwnd: HWND; iItem: Integer): BOOL; {inline;}
  924. const
  925. HDN_ITEMCHANGINGA = HDN_FIRST-0;
  926. HDN_ITEMCHANGEDA = HDN_FIRST-1;
  927. HDN_ITEMCLICKA = HDN_FIRST-2;
  928. HDN_ITEMDBLCLICKA = HDN_FIRST-3;
  929. HDN_DIVIDERDBLCLICKA = HDN_FIRST-5;
  930. HDN_BEGINTRACKA = HDN_FIRST-6;
  931. HDN_ENDTRACKA = HDN_FIRST-7;
  932. HDN_TRACKA = HDN_FIRST-8;
  933. HDN_GETDISPINFOA = HDN_FIRST-9;
  934. HDN_BEGINDRAG = HDN_FIRST-10;
  935. HDN_ENDDRAG = HDN_FIRST-11;
  936. { For IE >= 0x0500 }
  937. HDN_FILTERCHANGE = HDN_FIRST-12;
  938. HDN_FILTERBTNCLICK = HDN_FIRST-13;
  939. { For IE >= 0x0600 }
  940. HDN_BEGINFILTEREDIT = HDN_FIRST-14;
  941. HDN_ENDFILTEREDIT = HDN_FIRST-15;
  942. { For Windows >= Vista }
  943. HDN_ITEMSTATEICONCLICK = HDN_FIRST-16;
  944. HDN_ITEMKEYDOWN = HDN_FIRST-17;
  945. HDN_DROPDOWN = HDN_FIRST-18;
  946. HDN_OVERFLOWCLICK = HDN_FIRST-19;
  947. HDN_ITEMCHANGINGW = HDN_FIRST-20;
  948. HDN_ITEMCHANGEDW = HDN_FIRST-21;
  949. HDN_ITEMCLICKW = HDN_FIRST-22;
  950. HDN_ITEMDBLCLICKW = HDN_FIRST-23;
  951. HDN_DIVIDERDBLCLICKW = HDN_FIRST-25;
  952. HDN_BEGINTRACKW = HDN_FIRST-26;
  953. HDN_ENDTRACKW = HDN_FIRST-27;
  954. HDN_TRACKW = HDN_FIRST-28;
  955. HDN_GETDISPINFOW = HDN_FIRST-29;
  956. {$IFDEF UNICODE}
  957. HDN_ITEMCHANGING = HDN_ITEMCHANGINGW;
  958. HDN_ITEMCHANGED = HDN_ITEMCHANGEDW;
  959. HDN_ITEMCLICK = HDN_ITEMCLICKW;
  960. HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKW;
  961. HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKW;
  962. HDN_BEGINTRACK = HDN_BEGINTRACKW;
  963. HDN_ENDTRACK = HDN_ENDTRACKW;
  964. HDN_TRACK = HDN_TRACKW;
  965. HDN_GETDISPINFO = HDN_GETDISPINFOW;
  966. {$ELSE}
  967. HDN_ITEMCHANGING = HDN_ITEMCHANGINGA;
  968. HDN_ITEMCHANGED = HDN_ITEMCHANGEDA;
  969. HDN_ITEMCLICK = HDN_ITEMCLICKA;
  970. HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA;
  971. HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA;
  972. HDN_BEGINTRACK = HDN_BEGINTRACKA;
  973. HDN_ENDTRACK = HDN_ENDTRACKA;
  974. HDN_TRACK = HDN_TRACKA;
  975. HDN_GETDISPINFO = HDN_GETDISPINFOA;
  976. {$ENDIF}
  977. type
  978. tagNMHEADERA = packed record
  979. Hdr: TNMHdr;
  980. Item: Integer;
  981. Button: Integer;
  982. PItem: PHDItemA;
  983. end;
  984. tagNMHEADERW = packed record
  985. Hdr: TNMHdr;
  986. Item: Integer;
  987. Button: Integer;
  988. PItem: PHDItemW;
  989. end;
  990. tagNMHEADER = tagNMHEADERW;
  991. HD_NOTIFYA = tagNMHEADERA;
  992. HD_NOTIFYW = tagNMHEADERW;
  993. HD_NOTIFY = HD_NOTIFYW;
  994. PHDNotifyA = ^THDNotifyA;
  995. PHDNotifyW = ^THDNotifyW;
  996. PHDNotify = PHDNotifyW;
  997. THDNotifyA = tagNMHEADERA;
  998. THDNotifyW = tagNMHEADERW;
  999. THDNotify = THDNotifyW;
  1000. tagNMHDDISPINFOA = record
  1001. hdr: TNMHdr;
  1002. iItem: Integer;
  1003. mask: UINT;
  1004. pszText: PAnsiChar;
  1005. cchTextMax: Integer;
  1006. iImage: Integer;
  1007. lParam: LPARAM;
  1008. end;
  1009. tagNMHDDISPINFOW = record
  1010. hdr: TNMHdr;
  1011. iItem: Integer;
  1012. mask: UINT;
  1013. pszText: PWideChar;
  1014. cchTextMax: Integer;
  1015. iImage: Integer;
  1016. lParam: LPARAM;
  1017. end;
  1018. tagNMHDDISPINFO = tagNMHDDISPINFOW;
  1019. PNMHDispInfoA = ^TNMHDispInfoA;
  1020. PNMHDispInfoW = ^TNMHDispInfoW;
  1021. PNMHDispInfo = PNMHDispInfoW;
  1022. TNMHDispInfoA = tagNMHDDISPINFOA;
  1023. TNMHDispInfoW = tagNMHDDISPINFOW;
  1024. TNMHDispInfo = TNMHDispInfoW;
  1025. { ====== TOOLBAR CONTROL =================== }
  1026. const
  1027. TOOLBARCLASSNAME = 'ToolbarWindow32';
  1028. type
  1029. PTBButton = ^TTBButton;
  1030. _TBBUTTON = packed record
  1031. iBitmap: Integer;
  1032. idCommand: Integer;
  1033. fsState: Byte;
  1034. fsStyle: Byte;
  1035. bReserved: array[1..2] of Byte;
  1036. dwData: Longint;
  1037. iString: Integer;
  1038. end;
  1039. TTBButton = _TBBUTTON;
  1040. PColorMap = ^TColorMap;
  1041. _COLORMAP = packed record
  1042. cFrom: TColorRef;
  1043. cTo: TColorRef;
  1044. end;
  1045. TColorMap = _COLORMAP;
  1046. COLORMAP = _COLORMAP;
  1047. function CreateToolBarEx(Wnd: HWnd; ws: Longint; ID: UINT;
  1048. Bitmaps: Integer; BMInst: THandle; BMID: Cardinal; Buttons: PTBButton;
  1049. NumButtons: Integer; dxButton, dyButton: Integer;
  1050. dxBitmap, dyBitmap: Integer; StructSize: UINT): HWnd; stdcall;
  1051. function CreateMappedBitmap(Instance: THandle; Bitmap: Integer;
  1052. Flags: UINT; ColorMap: PColorMap; NumMaps: Integer): HBitmap; stdcall;
  1053. const
  1054. CMB_MASKED = $02;
  1055. TBSTATE_CHECKED = $01;
  1056. TBSTATE_PRESSED = $02;
  1057. TBSTATE_ENABLED = $04;
  1058. TBSTATE_HIDDEN = $08;
  1059. TBSTATE_INDETERMINATE = $10;
  1060. TBSTATE_WRAP = $20;
  1061. TBSTATE_ELLIPSES = $40;
  1062. TBSTATE_MARKED = $80;
  1063. TBSTYLE_BUTTON = $00;
  1064. TBSTYLE_SEP = $01;
  1065. TBSTYLE_CHECK = $02;
  1066. TBSTYLE_GROUP = $04;
  1067. TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK;
  1068. TBSTYLE_DROPDOWN = $08;
  1069. TBSTYLE_AUTOSIZE = $0010; // automatically calculate the cx of the button
  1070. TBSTYLE_NOPREFIX = $0020; // if this button should not have accel prefix
  1071. TBSTYLE_TOOLTIPS = $0100;
  1072. TBSTYLE_WRAPABLE = $0200;
  1073. TBSTYLE_ALTDRAG = $0400;
  1074. TBSTYLE_FLAT = $0800;
  1075. TBSTYLE_LIST = $1000;
  1076. TBSTYLE_CUSTOMERASE = $2000;
  1077. TBSTYLE_REGISTERDROP = $4000;
  1078. TBSTYLE_TRANSPARENT = $8000;
  1079. TBSTYLE_EX_DRAWDDARROWS = $00000001;
  1080. { For IE >= 0x0500 }
  1081. BTNS_BUTTON = TBSTYLE_BUTTON;
  1082. BTNS_SEP = TBSTYLE_SEP;
  1083. BTNS_CHECK = TBSTYLE_CHECK;
  1084. BTNS_GROUP = TBSTYLE_GROUP;
  1085. BTNS_CHECKGROUP = TBSTYLE_CHECKGROUP;
  1086. BTNS_DROPDOWN = TBSTYLE_DROPDOWN;
  1087. BTNS_AUTOSIZE = TBSTYLE_AUTOSIZE;
  1088. BTNS_NOPREFIX = TBSTYLE_NOPREFIX;
  1089. { For IE >= 0x0501 }
  1090. BTNS_SHOWTEXT = $0040; // ignored unless TBSTYLE_EX_MIXEDBUTTONS is set
  1091. { For IE >= 0x0500 }
  1092. BTNS_WHOLEDROPDOWN = $0080; // draw drop-down arrow, but without split arrow section
  1093. { For IE >= 0x0501 }
  1094. TBSTYLE_EX_MIXEDBUTTONS = $00000008;
  1095. TBSTYLE_EX_HIDECLIPPEDBUTTONS = $00000010; // don't show partially obscured buttons
  1096. { For Windows >= XP }
  1097. TBSTYLE_EX_DOUBLEBUFFER = $00000080; // Double Buffer the toolbar
  1098. type
  1099. // Custom Draw Structure
  1100. _NMTBCUSTOMDRAW = packed record
  1101. nmcd: TNMCustomDraw;
  1102. hbrMonoDither: HBRUSH;
  1103. hbrLines: HBRUSH; // For drawing lines on buttons
  1104. hpenLines: HPEN; // For drawing lines on buttons
  1105. clrText: COLORREF; // Color of text
  1106. clrMark: COLORREF; // Color of text bk when marked. (only if TBSTATE_MARKED)
  1107. clrTextHighlight: COLORREF; // Color of text when highlighted
  1108. clrBtnFace: COLORREF; // Background of the button
  1109. clrBtnHighlight: COLORREF; // 3D highlight
  1110. clrHighlightHotTrack: COLORREF; // In conjunction with fHighlightHotTrack
  1111. // will cause button to highlight like a menu
  1112. rcText: TRect; // Rect for text
  1113. nStringBkMode: Integer;
  1114. nHLStringBkMode: Integer;
  1115. { For Windows >= XP }
  1116. //iListGap: Integer;
  1117. end;
  1118. PNMTBCustomDraw = ^TNMTBCustomDraw;
  1119. TNMTBCustomDraw = _NMTBCUSTOMDRAW;
  1120. const
  1121. // Toolbar custom draw return flags
  1122. TBCDRF_NOEDGES = $00010000; // Don't draw button edges
  1123. TBCDRF_HILITEHOTTRACK = $00020000; // Use color of the button bk when hottracked
  1124. TBCDRF_NOOFFSET = $00040000; // Don't offset button if pressed
  1125. TBCDRF_NOMARK = $00080000; // Don't draw default highlight of image/text for TBSTATE_MARKED
  1126. TBCDRF_NOETCHEDEFFECT = $00100000; // Don't draw etched effect for disabled items
  1127. { For IE >= 0x0500 }
  1128. TBCDRF_BLENDICON = $00200000; // Use ILD_BLEND50 on the icon image
  1129. TBCDRF_NOBACKGROUND = $00400000; // Use ILD_BLEND50 on the icon image
  1130. { For Windows >= Vista }
  1131. TBCDRF_USECDCOLORS = $00800000; // Use CustomDrawColors to RenderText regardless of VisualStyle
  1132. TB_ENABLEBUTTON = WM_USER + 1;
  1133. TB_CHECKBUTTON = WM_USER + 2;
  1134. TB_PRESSBUTTON = WM_USER + 3;
  1135. TB_HIDEBUTTON = WM_USER + 4;
  1136. TB_INDETERMINATE = WM_USER + 5;
  1137. TB_MARKBUTTON = WM_USER + 6;
  1138. TB_ISBUTTONENABLED = WM_USER + 9;
  1139. TB_ISBUTTONCHECKED = WM_USER + 10;
  1140. TB_ISBUTTONPRESSED = WM_USER + 11;
  1141. TB_ISBUTTONHIDDEN = WM_USER + 12;
  1142. TB_ISBUTTONINDETERMINATE = WM_USER + 13;
  1143. TB_ISBUTTONHIGHLIGHTED = WM_USER + 14;
  1144. TB_SETSTATE = WM_USER + 17;
  1145. TB_GETSTATE = WM_USER + 18;
  1146. TB_ADDBITMAP = WM_USER + 19;
  1147. type
  1148. PTBAddBitmap = ^TTBAddBitmap;
  1149. tagTBADDBITMAP = packed record
  1150. hInst: THandle;
  1151. nID: UINT;
  1152. end;
  1153. TTBAddBitmap = tagTBADDBITMAP;
  1154. TBADDBITMAP = tagTBADDBITMAP;
  1155. const
  1156. HINST_COMMCTRL = THandle(-1);
  1157. IDB_STD_SMALL_COLOR = 0;
  1158. IDB_STD_LARGE_COLOR = 1;
  1159. IDB_VIEW_SMALL_COLOR = 4;
  1160. IDB_VIEW_LARGE_COLOR = 5;
  1161. IDB_HIST_SMALL_COLOR = 8;
  1162. IDB_HIST_LARGE_COLOR = 9;
  1163. { icon indexes for standard bitmap }
  1164. STD_CUT = 0;
  1165. STD_COPY = 1;
  1166. STD_PASTE = 2;
  1167. STD_UNDO = 3;
  1168. STD_REDOW = 4;
  1169. STD_DELETE = 5;
  1170. STD_FILENEW = 6;
  1171. STD_FILEOPEN = 7;
  1172. STD_FILESAVE = 8;
  1173. STD_PRINTPRE = 9;
  1174. STD_PROPERTIES = 10;
  1175. STD_HELP = 11;
  1176. STD_FIND = 12;
  1177. STD_REPLACE = 13;
  1178. STD_PRINT = 14;
  1179. { icon indexes for standard view bitmap }
  1180. VIEW_LARGEICONS = 0;
  1181. VIEW_SMALLICONS = 1;
  1182. VIEW_LIST = 2;
  1183. VIEW_DETAILS = 3;
  1184. VIEW_SORTNAME = 4;
  1185. VIEW_SORTSIZE = 5;
  1186. VIEW_SORTDATE = 6;
  1187. VIEW_SORTTYPE = 7;
  1188. VIEW_PARENTFOLDER = 8;
  1189. VIEW_NETCONNECT = 9;
  1190. VIEW_NETDISCONNECT = 10;
  1191. VIEW_NEWFOLDER = 11;
  1192. VIEW_VIEWMENU = 12;
  1193. { icon indexes for history bitmap }
  1194. HIST_BACK = 0;
  1195. HIST_FORWARD = 1;
  1196. HIST_FAVORITES = 2;
  1197. HIST_ADDTOFAVORITES = 3;
  1198. HIST_VIEWTREE = 4;
  1199. TB_ADDBUTTONSA = WM_USER + 20;
  1200. TB_INSERTBUTTONA = WM_USER + 21;
  1201. TB_DELETEBUTTON = WM_USER + 22;
  1202. TB_GETBUTTON = WM_USER + 23;
  1203. TB_BUTTONCOUNT = WM_USER + 24;
  1204. TB_COMMANDTOINDEX = WM_USER + 25;
  1205. type
  1206. PTBSaveParamsA = ^TTBSaveParamsA;
  1207. PTBSaveParamsW = ^TTBSaveParamsW;
  1208. PTBSaveParams = PTBSaveParamsW;
  1209. tagTBSAVEPARAMSA = record
  1210. hkr: THandle;
  1211. pszSubKey: PAnsiChar;
  1212. pszValueName: PAnsiChar;
  1213. end;
  1214. tagTBSAVEPARAMSW = record
  1215. hkr: THandle;
  1216. pszSubKey: PWideChar;
  1217. pszValueName: PWideChar;
  1218. end;
  1219. tagTBSAVEPARAMS = tagTBSAVEPARAMSW;
  1220. TTBSaveParamsA = tagTBSAVEPARAMSA;
  1221. TTBSaveParamsW = tagTBSAVEPARAMSW;
  1222. TTBSaveParams = TTBSaveParamsW;
  1223. TBSAVEPARAMSA = tagTBSAVEPARAMSA;
  1224. TBSAVEPARAMSW = tagTBSAVEPARAMSW;
  1225. TBSAVEPARAMS = TBSAVEPARAMSW;
  1226. const
  1227. TB_SAVERESTOREA = WM_USER + 26;
  1228. TB_ADDSTRINGA = WM_USER + 28;
  1229. TB_GETBUTTONTEXTA = WM_USER + 45;
  1230. TBN_GETBUTTONINFOA = TBN_FIRST-0;
  1231. TB_SAVERESTOREW = WM_USER + 76;
  1232. TB_ADDSTRINGW = WM_USER + 77;
  1233. TB_GETBUTTONTEXTW = WM_USER + 75;
  1234. TBN_GETBUTTONINFOW = TBN_FIRST-20;
  1235. {$IFDEF UNICODE}
  1236. TB_SAVERESTORE = TB_SAVERESTOREW;
  1237. TB_ADDSTRING = TB_ADDSTRINGW;
  1238. TB_GETBUTTONTEXT = TB_GETBUTTONTEXTW;
  1239. TBN_GETBUTTONINFO = TBN_GETBUTTONINFOW;
  1240. {$ELSE}
  1241. TB_SAVERESTORE = TB_SAVERESTOREA;
  1242. TB_ADDSTRING = TB_ADDSTRINGA;
  1243. TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA;
  1244. TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA;
  1245. {$ENDIF}
  1246. TB_CUSTOMIZE = WM_USER + 27;
  1247. TB_GETITEMRECT = WM_USER + 29;
  1248. TB_BUTTONSTRUCTSIZE = WM_USER + 30;
  1249. TB_SETBUTTONSIZE = WM_USER + 31;
  1250. TB_SETBITMAPSIZE = WM_USER + 32;
  1251. TB_AUTOSIZE = WM_USER + 33;
  1252. TB_GETTOOLTIPS = WM_USER + 35;
  1253. TB_SETTOOLTIPS = WM_USER + 36;
  1254. TB_SETPARENT = WM_USER + 37;
  1255. TB_SETROWS = WM_USER + 39;
  1256. TB_GETROWS = WM_USER + 40;
  1257. TB_SETCMDID = WM_USER + 42;
  1258. TB_CHANGEBITMAP = WM_USER + 43;
  1259. TB_GETBITMAP = WM_USER + 44;
  1260. TB_REPLACEBITMAP = WM_USER + 46;
  1261. TB_SETINDENT = WM_USER + 47;
  1262. TB_SETIMAGELIST = WM_USER + 48;
  1263. TB_GETIMAGELIST = WM_USER + 49;
  1264. TB_LOADIMAGES = WM_USER + 50;
  1265. TB_GETRECT = WM_USER + 51; { wParam is the Cmd instead of index }
  1266. TB_SETHOTIMAGELIST = WM_USER + 52;
  1267. TB_GETHOTIMAGELIST = WM_USER + 53;
  1268. TB_SETDISABLEDIMAGELIST = WM_USER + 54;
  1269. TB_GETDISABLEDIMAGELIST = WM_USER + 55;
  1270. TB_SETSTYLE = WM_USER + 56;
  1271. TB_GETSTYLE = WM_USER + 57;
  1272. TB_GETBUTTONSIZE = WM_USER + 58;
  1273. TB_SETBUTTONWIDTH = WM_USER + 59;
  1274. TB_SETMAXTEXTROWS = WM_USER + 60;
  1275. TB_GETTEXTROWS = WM_USER + 61;
  1276. TB_GETOBJECT = WM_USER + 62; // wParam == IID, lParam void **ppv
  1277. TB_GETHOTITEM = WM_USER + 71;
  1278. TB_SETHOTITEM = WM_USER + 72; // wParam == iHotItem
  1279. TB_SETANCHORHIGHLIGHT = WM_USER + 73; // wParam == TRUE/FALSE
  1280. TB_GETANCHORHIGHLIGHT = WM_USER + 74;
  1281. TB_MAPACCELERATORA = WM_USER + 78; // wParam == ch, lParam int * pidBtn
  1282. type
  1283. TBINSERTMARK = packed record
  1284. iButton: Integer;
  1285. dwFlags: DWORD;
  1286. end;
  1287. PTBInsertMark = ^TTBInsertMark;
  1288. TTBInsertMark = TBINSERTMARK;
  1289. const
  1290. TBIMHT_AFTER = $00000001; // TRUE = insert After iButton, otherwise before
  1291. TBIMHT_BACKGROUND = $00000002; // TRUE iff missed buttons completely
  1292. TB_GETINSERTMARK = WM_USER + 79; // lParam == LPTBINSERTMARK
  1293. TB_SETINSERTMARK = WM_USER + 80; // lParam == LPTBINSERTMARK
  1294. TB_INSERTMARKHITTEST = WM_USER + 81; // wParam == LPPOINT lParam == LPTBINSERTMARK
  1295. TB_MOVEBUTTON = WM_USER + 82;
  1296. TB_GETMAXSIZE = WM_USER + 83; // lParam == LPSIZE
  1297. TB_SETEXTENDEDSTYLE = WM_USER + 84; // For TBSTYLE_EX_*
  1298. TB_GETEXTENDEDSTYLE = WM_USER + 85; // For TBSTYLE_EX_*
  1299. TB_GETPADDING = WM_USER + 86;
  1300. TB_SETPADDING = WM_USER + 87;
  1301. TB_SETINSERTMARKCOLOR = WM_USER + 88;
  1302. TB_GETINSERTMARKCOLOR = WM_USER + 89;
  1303. TB_SETCOLORSCHEME = CCM_SETCOLORSCHEME; // lParam is color scheme
  1304. TB_GETCOLORSCHEME = CCM_GETCOLORSCHEME; // fills in COLORSCHEME pointed to by lParam
  1305. TB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  1306. TB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  1307. TB_MAPACCELERATORW = WM_USER + 90; // wParam == ch, lParam int * pidBtn
  1308. {$IFDEF UNICODE}
  1309. TB_MAPACCELERATOR = TB_MAPACCELERATORW;
  1310. {$ELSE}
  1311. TB_MAPACCELERATOR = TB_MAPACCELERATORA;
  1312. {$ENDIF}
  1313. type
  1314. TBREPLACEBITMAP = packed record
  1315. hInstOld: THandle;
  1316. nIDOld: Cardinal;
  1317. hInstNew: THandle;
  1318. nIDNew: Cardinal;
  1319. nButtons: Integer;
  1320. end;
  1321. PTBReplaceBitmap = ^TTBReplaceBitmap;
  1322. TTBReplaceBitmap = TBREPLACEBITMAP;
  1323. const
  1324. TBBF_LARGE = $0001;
  1325. TB_GETBITMAPFLAGS = WM_USER + 41;
  1326. TBIF_IMAGE = $00000001;
  1327. TBIF_TEXT = $00000002;
  1328. TBIF_STATE = $00000004;
  1329. TBIF_STYLE = $00000008;
  1330. TBIF_LPARAM = $00000010;
  1331. TBIF_COMMAND = $00000020;
  1332. TBIF_SIZE = $00000040;
  1333. TBIF_BYINDEX = $80000000;
  1334. type
  1335. TBBUTTONINFOA = record
  1336. cbSize: UINT;
  1337. dwMask: DWORD;
  1338. idCommand: Integer;
  1339. iImage: Integer;
  1340. fsState: Byte;
  1341. fsStyle: Byte;
  1342. cx: Word;
  1343. lParam: DWORD;
  1344. pszText: PAnsiChar;
  1345. cchText: Integer;
  1346. end;
  1347. TBBUTTONINFOW = record
  1348. cbSize: UINT;
  1349. dwMask: DWORD;
  1350. idCommand: Integer;
  1351. iImage: Integer;
  1352. fsState: Byte;
  1353. fsStyle: Byte;
  1354. cx: Word;
  1355. lParam: DWORD;
  1356. pszText: PWideChar;
  1357. cchText: Integer;
  1358. end;
  1359. TBBUTTONINFO = TBBUTTONINFOW;
  1360. PTBButtonInfoA = ^TTBButtonInfoA;
  1361. PTBButtonInfoW = ^TTBButtonInfoW;
  1362. PTBButtonInfo = PTBButtonInfoW;
  1363. TTBButtonInfoA = TBBUTTONINFOA;
  1364. TTBButtonInfoW = TBBUTTONINFOW;
  1365. TTBButtonInfo = TTBButtonInfoW;
  1366. const
  1367. // BUTTONINFO APIs do NOT support the string pool.
  1368. TB_GETBUTTONINFOW = WM_USER + 63;
  1369. TB_SETBUTTONINFOW = WM_USER + 64;
  1370. TB_GETBUTTONINFOA = WM_USER + 65;
  1371. TB_SETBUTTONINFOA = WM_USER + 66;
  1372. {$IFDEF UNICODE}
  1373. TB_GETBUTTONINFO = TB_GETBUTTONINFOW;
  1374. TB_SETBUTTONINFO = TB_SETBUTTONINFOW;
  1375. {$ELSE}
  1376. TB_GETBUTTONINFO = TB_GETBUTTONINFOA;
  1377. TB_SETBUTTONINFO = TB_SETBUTTONINFOA;
  1378. {$ENDIF}
  1379. TB_INSERTBUTTONW = WM_USER + 67;
  1380. TB_ADDBUTTONSW = WM_USER + 68;
  1381. TB_HITTEST = WM_USER + 69;
  1382. // New post Win95/NT4 for InsertButton and AddButton. if iString member
  1383. // is a pointer to a string, it will be handled as a string like listview
  1384. // = although LPSTR_TEXTCALLBACK is not supported;.
  1385. {$IFDEF UNICODE}
  1386. TB_INSERTBUTTON = TB_INSERTBUTTONW;
  1387. TB_ADDBUTTONS = TB_ADDBUTTONSW;
  1388. {$ELSE}
  1389. TB_INSERTBUTTON = TB_INSERTBUTTONA;
  1390. TB_ADDBUTTONS = TB_ADDBUTTONSA;
  1391. {$ENDIF}
  1392. TB_SETDRAWTEXTFLAGS = WM_USER + 70; // wParam == mask lParam == bit values
  1393. TB_GETSTRINGW = WM_USER + 91;
  1394. TB_GETSTRINGA = WM_USER + 92;
  1395. {$IFDEF UNICODE}
  1396. TB_GETSTRING = TB_GETSTRINGW;
  1397. {$ELSE}
  1398. TB_GETSTRING = TB_GETSTRINGA;
  1399. {$ENDIF}
  1400. { For Windows >= XP }
  1401. TBMF_PAD = $00000001;
  1402. TBMF_BARPAD = $00000002;
  1403. TBMF_BUTTONSPACING = $00000004;
  1404. type
  1405. { For Windows >= XP }
  1406. { $EXTERNALSYM TBMETRICSA}
  1407. TBMETRICSA = packed record
  1408. cbSize: Integer;
  1409. dwMask: DWORD;
  1410. cxPad: Integer; { PAD }
  1411. cyPad: Integer;
  1412. cxBarPad: Integer;{ BARPAD }
  1413. cyBarPad: Integer;
  1414. cxButtonSpacing: Integer;{ BUTTONSPACING }
  1415. cyButtonSpacing: Integer;
  1416. end;
  1417. { $EXTERNALSYM TBMETRICSW}
  1418. TBMETRICSW = packed record
  1419. cbSize: Integer;
  1420. dwMask: DWORD;
  1421. cxPad: Integer; { PAD }
  1422. cyPad: Integer;
  1423. cxBarPad: Integer;{ BARPAD }
  1424. cyBarPad: Integer;
  1425. cxButtonSpacing: Integer;{ BUTTONSPACING }
  1426. cyButtonSpacing: Integer;
  1427. end;
  1428. TBMETRICS = TBMETRICSW;
  1429. PTBMetricsA = ^TTBMetricsA;
  1430. PTBMetricsW = ^TTBMetricsW;
  1431. PTBMetrics = PTBMetricsW;
  1432. TTBMetricsA = TBMETRICSA;
  1433. TTBMetricsW = TBMETRICSW;
  1434. TTBMetrics = TTBMetricsW;
  1435. const
  1436. { For Windows >= XP }
  1437. TB_GETMETRICS = WM_USER + 101;
  1438. TB_SETMETRICS = WM_USER + 102;
  1439. { For Windows >= Vista }
  1440. TB_SETPRESSEDIMAGELIST = WM_USER + 104;
  1441. TB_GETPRESSEDIMAGELIST = WM_USER + 105;
  1442. { For Windows >= XP }
  1443. TB_SETWINDOWTHEME = CCM_SETWINDOWTHEME;
  1444. const
  1445. TBN_BEGINDRAG = TBN_FIRST-1;
  1446. TBN_ENDDRAG = TBN_FIRST-2;
  1447. TBN_BEGINADJUST = TBN_FIRST-3;
  1448. TBN_ENDADJUST = TBN_FIRST-4;
  1449. TBN_RESET = TBN_FIRST-5;
  1450. TBN_QUERYINSERT = TBN_FIRST-6;
  1451. TBN_QUERYDELETE = TBN_FIRST-7;
  1452. TBN_TOOLBARCHANGE = TBN_FIRST-8;
  1453. TBN_CUSTHELP = TBN_FIRST-9;
  1454. TBN_DROPDOWN = TBN_FIRST-10;
  1455. TBN_CLOSEUP = TBN_FIRST-11;
  1456. TBN_GETOBJECT = TBN_FIRST-12;
  1457. TBN_RESTORE = TBN_FIRST-21;
  1458. TBN_SAVE = TBN_FIRST-22;
  1459. type
  1460. // Structure for TBN_HOTITEMCHANGE notification
  1461. tagNMTBHOTITEM = packed record
  1462. hdr: TNMHdr;
  1463. idOld: Integer;
  1464. idNew: Integer;
  1465. dwFlags: DWORD; // HICF_*
  1466. end;
  1467. PNMTBHotItem = ^TNMTBHotItem;
  1468. TNMTBHotItem = tagNMTBHOTITEM;
  1469. const
  1470. // Hot item change flags
  1471. HICF_OTHER = $00000000;
  1472. HICF_MOUSE = $00000001; // Triggered by mouse
  1473. HICF_ARROWKEYS = $00000002; // Triggered by arrow keys
  1474. HICF_ACCELERATOR = $00000004; // Triggered by accelerator
  1475. HICF_DUPACCEL = $00000008; // This accelerator is not unique
  1476. HICF_ENTERING = $00000010; // idOld is invalid
  1477. HICF_LEAVING = $00000020; // idNew is invalid
  1478. HICF_RESELECT = $00000040; // hot item reselected
  1479. TBN_HOTITEMCHANGE = TBN_FIRST - 13;
  1480. TBN_DRAGOUT = TBN_FIRST - 14; // this is sent when the user clicks down on a button then drags off the button
  1481. TBN_DELETINGBUTTON = TBN_FIRST - 15; // uses TBNOTIFY
  1482. TBN_GETDISPINFOA = TBN_FIRST - 16; // This is sent when the toolbar needs some display information
  1483. TBN_GETDISPINFOW = TBN_FIRST - 17; // This is sent when the toolbar needs some display information
  1484. TBN_GETINFOTIPA = TBN_FIRST - 18;
  1485. TBN_GETINFOTIPW = TBN_FIRST - 19;
  1486. type
  1487. tagNMTBGETINFOTIPA = record
  1488. hdr: TNMHdr;
  1489. pszText: PAnsiChar;
  1490. cchTextMax: Integer;
  1491. iItem: Integer;
  1492. lParam: LPARAM;
  1493. end;
  1494. tagNMTBGETINFOTIPW = record
  1495. hdr: TNMHdr;
  1496. pszText: PWideChar;
  1497. cchTextMax: Integer;
  1498. iItem: Integer;
  1499. lParam: LPARAM;
  1500. end;
  1501. tagNMTBGETINFOTIP = tagNMTBGETINFOTIPW;
  1502. PNMTBGetInfoTipA = ^TNMTBGetInfoTipA;
  1503. PNMTBGetInfoTipW = ^TNMTBGetInfoTipW;
  1504. PNMTBGetInfoTip = PNMTBGetInfoTipW;
  1505. TNMTBGetInfoTipA = tagNMTBGETINFOTIPA;
  1506. TNMTBGetInfoTipW = tagNMTBGETINFOTIPW;
  1507. TNMTBGetInfoTip = TNMTBGetInfoTipW;
  1508. const
  1509. TBNF_IMAGE = $00000001;
  1510. TBNF_TEXT = $00000002;
  1511. TBNF_DI_SETITEM = $10000000;
  1512. type
  1513. NMTBDISPINFOA = record
  1514. hdr: TNMHdr;
  1515. dwMask: DWORD; // [in] Specifies the values requested .[out] Client ask the data to be set for future use
  1516. idCommand: Integer; // [in] id of button we're requesting info for
  1517. lParam: DWORD; // [in] lParam of button
  1518. iImage: Integer; // [out] image index
  1519. pszText: PAnsiChar; // [out] new text for item
  1520. cchText: Integer; // [in] size of buffer pointed to by pszText
  1521. end;
  1522. NMTBDISPINFOW = record
  1523. hdr: TNMHdr;
  1524. dwMask: DWORD; // [in] Specifies the values requested .[out] Client ask the data to be set for future use
  1525. idCommand: Integer; // [in] id of button we're requesting info for
  1526. lParam: DWORD; // [in] lParam of button
  1527. iImage: Integer; // [out] image index
  1528. pszText: PWideChar; // [out] new text for item
  1529. cchText: Integer; // [in] size of buffer pointed to by pszText
  1530. end;
  1531. NMTBDISPINFO = NMTBDISPINFOW;
  1532. PNMTBDispInfoA = ^TNMTBDispInfoA;
  1533. PNMTBDispInfoW = ^TNMTBDispInfoW;
  1534. PNMTBDispInfo = PNMTBDispInfoW;
  1535. TNMTBDispInfoA = NMTBDISPINFOA;
  1536. TNMTBDispInfoW = NMTBDISPINFOW;
  1537. TNMTBDispInfo = TNMTBDispInfoW;
  1538. const
  1539. // Return codes for TBN_DROPDOWN
  1540. TBDDRET_DEFAULT = 0;
  1541. TBDDRET_NODEFAULT = 1;
  1542. TBDDRET_TREATPRESSED = 2; // Treat as a standard press button
  1543. type
  1544. tagNMTOOLBARA = record
  1545. hdr: TNMHdr;
  1546. iItem: Integer;
  1547. tbButton: TTBButton;
  1548. cchText: Integer;
  1549. pszText: PAnsiChar;
  1550. end;
  1551. tagNMTOOLBARW = record
  1552. hdr: TNMHdr;
  1553. iItem: Integer;
  1554. tbButton: TTBButton;
  1555. cchText: Integer;
  1556. pszText: PWideChar;
  1557. end;
  1558. tagNMTOOLBAR = tagNMTOOLBARW;
  1559. PNMToolBarA = ^TNMToolBarA;
  1560. PNMToolBarW = ^TNMToolBarW;
  1561. PNMToolBar = PNMToolBarW;
  1562. TNMToolBarA = tagNMTOOLBARA;
  1563. TNMToolBarW = tagNMTOOLBARW;
  1564. TNMToolBar = TNMToolBarW;
  1565. { ====== REBAR CONTROL =================== }
  1566. const
  1567. REBARCLASSNAME = 'ReBarWindow32';
  1568. type
  1569. tagREBARINFO = packed record
  1570. cbSize: UINT;
  1571. fMask: UINT;
  1572. himl: HIMAGELIST;
  1573. end;
  1574. PReBarInfo = ^TReBarInfo;
  1575. TReBarInfo = tagREBARINFO;
  1576. const
  1577. RBIM_IMAGELIST = $00000001;
  1578. RBS_TOOLTIPS = $00000100;
  1579. RBS_VARHEIGHT = $00000200;
  1580. RBS_BANDBORDERS = $00000400;
  1581. RBS_FIXEDORDER = $00000800;
  1582. RBS_REGISTERDROP = $00001000;
  1583. RBS_AUTOSIZE = $00002000;
  1584. RBS_VERTICALGRIPPER = $00004000; // this always has the vertical gripper (default for horizontal mode)
  1585. RBS_DBLCLKTOGGLE = $00008000;
  1586. RBBS_BREAK = $00000001; // break to new line
  1587. RBBS_FIXEDSIZE = $00000002; // band can't be sized
  1588. RBBS_CHILDEDGE = $00000004; // edge around top and bottom of child window
  1589. RBBS_HIDDEN = $00000008; // don't show
  1590. RBBS_NOVERT = $00000010; // don't show when vertical
  1591. RBBS_FIXEDBMP = $00000020; // bitmap doesn't move during band resize
  1592. RBBS_VARIABLEHEIGHT = $00000040; // allow autosizing of this child vertically
  1593. RBBS_GRIPPERALWAYS = $00000080; // always show the gripper
  1594. RBBS_NOGRIPPER = $00000100; // never show the gripper
  1595. { For IE >= 0x0500 }
  1596. RBBS_USECHEVRON = $00000200; { display drop-down button for this band if it's sized smaller than ideal width }
  1597. { For IE >= 0x0501 }
  1598. RBBS_HIDETITLE = $00000400; { keep band title hidden }
  1599. RBBS_TOPALIGN = $00000800; { keep band in top row }
  1600. RBBIM_STYLE = $00000001;
  1601. RBBIM_COLORS = $00000002;
  1602. RBBIM_TEXT = $00000004;
  1603. RBBIM_IMAGE = $00000008;
  1604. RBBIM_CHILD = $00000010;
  1605. RBBIM_CHILDSIZE = $00000020;
  1606. RBBIM_SIZE = $00000040;
  1607. RBBIM_BACKGROUND = $00000080;
  1608. RBBIM_ID = $00000100;
  1609. RBBIM_IDEALSIZE = $00000200;
  1610. RBBIM_LPARAM = $00000400;
  1611. RBBIM_HEADERSIZE = $00000800; // control the size of the header
  1612. { For Windows >= Vista }
  1613. RBBIM_CHEVRONLOCATION = $00001000;
  1614. RBBIM_CHEVRONSTATE = $00002000;
  1615. type
  1616. tagREBARBANDINFOA = record
  1617. cbSize: UINT;
  1618. fMask: UINT;
  1619. fStyle: UINT;
  1620. clrFore: TColorRef;
  1621. clrBack: TColorRef;
  1622. lpText: PAnsiChar;
  1623. cch: UINT;
  1624. iImage: Integer;
  1625. hwndChild: HWnd;
  1626. cxMinChild: UINT;
  1627. cyMinChild: UINT;
  1628. cx: UINT;
  1629. hbmBack: HBitmap;
  1630. wID: UINT;
  1631. cyChild: UINT;
  1632. cyMaxChild: UINT;
  1633. cyIntegral: UINT;
  1634. cxIdeal: UINT;
  1635. lParam: LPARAM;
  1636. cxHeader: UINT;
  1637. //rcChevronLocation: TRect; // the rect is in client co-ord wrt hwndChild
  1638. //uChevronState: UINT; // STATE_SYSTEM_*
  1639. end;
  1640. tagREBARBANDINFOW = record
  1641. cbSize: UINT;
  1642. fMask: UINT;
  1643. fStyle: UINT;
  1644. clrFore: TColorRef;
  1645. clrBack: TColorRef;
  1646. lpText: PWideChar;
  1647. cch: UINT;
  1648. iImage: Integer;
  1649. hwndChild: HWnd;
  1650. cxMinChild: UINT;
  1651. cyMinChild: UINT;
  1652. cx: UINT;
  1653. hbmBack: HBitmap;
  1654. wID: UINT;
  1655. cyChild: UINT;
  1656. cyMaxChild: UINT;
  1657. cyIntegral: UINT;
  1658. cxIdeal: UINT;
  1659. lParam: LPARAM;
  1660. cxHeader: UINT;
  1661. //rcChevronLocation: TRect; // the rect is in client co-ord wrt hwndChild
  1662. //uChevronState: UINT; // STATE_SYSTEM_*
  1663. end;
  1664. tagREBARBANDINFO = tagREBARBANDINFOW;
  1665. PReBarBandInfoA = ^TReBarBandInfoA;
  1666. PReBarBandInfoW = ^TReBarBandInfoW;
  1667. PReBarBandInfo = PReBarBandInfoW;
  1668. TReBarBandInfoA = tagREBARBANDINFOA;
  1669. TReBarBandInfoW = tagREBARBANDINFOW;
  1670. TReBarBandInfo = TReBarBandInfoW;
  1671. (*const
  1672. REBARBANDINFOA_V3_SIZE = CCSIZEOF_STRUCT(REBARBANDINFOA, wID);
  1673. REBARBANDINFOW_V3_SIZE = CCSIZEOF_STRUCT(REBARBANDINFOW, wID);
  1674. REBARBANDINFOA_V6_SIZE = CCSIZEOF_STRUCT(REBARBANDINFOA, cxHeader);
  1675. REBARBANDINFOW_V6_SIZE = CCSIZEOF_STRUCT(REBARBANDINFOW, cxHeader); *)
  1676. const
  1677. RB_INSERTBANDA = WM_USER + 1;
  1678. RB_DELETEBAND = WM_USER + 2;
  1679. RB_GETBARINFO = WM_USER + 3;
  1680. RB_SETBARINFO = WM_USER + 4;
  1681. RB_GETBANDINFO_PRE_IE4 = WM_USER + 5;
  1682. RB_SETBANDINFOA = WM_USER + 6;
  1683. RB_SETPARENT = WM_USER + 7;
  1684. RB_HITTEST = WM_USER + 8;
  1685. RB_GETRECT = WM_USER + 9;
  1686. RB_INSERTBANDW = WM_USER + 10;
  1687. RB_SETBANDINFOW = WM_USER + 11;
  1688. RB_GETBANDCOUNT = WM_USER + 12;
  1689. RB_GETROWCOUNT = WM_USER + 13;
  1690. RB_GETROWHEIGHT = WM_USER + 14;
  1691. RB_IDTOINDEX = WM_USER + 16; // wParam == id
  1692. RB_GETTOOLTIPS = WM_USER + 17;
  1693. RB_SETTOOLTIPS = WM_USER + 18;
  1694. RB_SETBKCOLOR = WM_USER + 19; // sets the default BK color
  1695. RB_GETBKCOLOR = WM_USER + 20; // defaults to CLR_NONE
  1696. RB_SETTEXTCOLOR = WM_USER + 21;
  1697. RB_GETTEXTCOLOR = WM_USER + 22; // defaults to 0x00000000
  1698. RB_SIZETORECT = WM_USER + 23; // resize the rebar/break bands and such to this rect (lparam;
  1699. { For Windows >= XP }
  1700. RBSTR_CHANGERECT = $0001; { flags for RB_SIZETORECT }
  1701. RB_SETCOLORSCHEME = CCM_SETCOLORSCHEME; { lParam is color scheme }
  1702. RB_GETCOLORSCHEME = CCM_GETCOLORSCHEME; { fills in COLORSCHEME pointed to by lParam }
  1703. // for manual drag control
  1704. // lparam == cursor pos
  1705. // -1 means do it yourself.
  1706. // -2 means use what you had saved before
  1707. RB_BEGINDRAG = WM_USER + 24;
  1708. RB_ENDDRAG = WM_USER + 25;
  1709. RB_DRAGMOVE = WM_USER + 26;
  1710. RB_GETBARHEIGHT = WM_USER + 27;
  1711. RB_GETBANDINFOW = WM_USER + 28;
  1712. RB_GETBANDINFOA = WM_USER + 29;
  1713. RB_MINIMIZEBAND = WM_USER + 30;
  1714. RB_MAXIMIZEBAND = WM_USER + 31;
  1715. RB_GETDROPTARGET = CCM_GETDROPTARGET;
  1716. RB_GETBANDBORDERS = WM_USER + 34; // returns in lparam = lprc the amount of edges added to band wparam
  1717. RB_SHOWBAND = WM_USER + 35; // show/hide band
  1718. RB_SETPALETTE = WM_USER + 37;
  1719. RB_GETPALETTE = WM_USER + 38;
  1720. RB_MOVEBAND = WM_USER + 39;
  1721. RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  1722. RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  1723. { For Windows >= XP }
  1724. RB_GETBANDMARGINS = WM_USER + 40;
  1725. RB_SETWINDOWTHEME = CCM_SETWINDOWTHEME;
  1726. { For Windows >= Vista }
  1727. RB_SETEXTENDEDSTYLE = WM_USER + 41;
  1728. RB_GETEXTENDEDSTYLE = WM_USER + 42;
  1729. { For IE >= 0x0500 }
  1730. RB_PUSHCHEVRON = WM_USER + 43;
  1731. { For Windows >= Vista }
  1732. RB_SETBANDWIDTH = WM_USER + 44; { set width for docked band }
  1733. {$IFDEF UNICODE}
  1734. RB_INSERTBAND = RB_INSERTBANDW;
  1735. RB_SETBANDINFO = RB_SETBANDINFOW;
  1736. RB_GETBANDINFO = RB_GETBANDINFOW;
  1737. {$ELSE}
  1738. RB_INSERTBAND = RB_INSERTBANDA;
  1739. RB_SETBANDINFO = RB_SETBANDINFOA;
  1740. RB_GETBANDINFO = RB_GETBANDINFOA;
  1741. {$ENDIF}
  1742. RBN_HEIGHTCHANGE = RBN_FIRST - 0;
  1743. RBN_GETOBJECT = RBN_FIRST - 1;
  1744. RBN_LAYOUTCHANGED = RBN_FIRST - 2;
  1745. RBN_AUTOSIZE = RBN_FIRST - 3;
  1746. RBN_BEGINDRAG = RBN_FIRST - 4;
  1747. RBN_ENDDRAG = RBN_FIRST - 5;
  1748. RBN_DELETINGBAND = RBN_FIRST - 6; // Uses NMREBAR
  1749. RBN_DELETEDBAND = RBN_FIRST - 7; // Uses NMREBAR
  1750. RBN_CHILDSIZE = RBN_FIRST - 8;
  1751. { For IE >= 0x0500 }
  1752. RBN_CHEVRONPUSHED = RBN_FIRST - 10;
  1753. { For IE >= 0x0600 }
  1754. RBN_SPLITTERDRAG = RBN_FIRST - 11;
  1755. { For IE >= 0x0500 }
  1756. RBN_MINMAX = RBN_FIRST - 21;
  1757. { For Windows >= XP }
  1758. RBN_AUTOBREAK = RBN_FIRST - 22;
  1759. type
  1760. tagNMREBARCHILDSIZE = packed record
  1761. hdr: TNMHdr;
  1762. uBand: UINT;
  1763. wID: UINT;
  1764. rcChild: TRect;
  1765. rcBand: TRect;
  1766. end;
  1767. PNMReBarChildSize = ^TNMReBarChildSize;
  1768. TNMReBarChildSize = tagNMREBARCHILDSIZE;
  1769. tagNMREBAR = packed record
  1770. hdr: TNMHdr;
  1771. dwMask: DWORD; // RBNM_*
  1772. uBand: UINT;
  1773. fStyle: UINT;
  1774. wID: UINT;
  1775. lParam: LPARAM;
  1776. end;
  1777. PNMReBar = ^TNMReBar;
  1778. TNMReBar = tagNMREBAR;
  1779. const
  1780. // Mask flags for NMREBAR
  1781. RBNM_ID = $00000001;
  1782. RBNM_STYLE = $00000002;
  1783. RBNM_LPARAM = $00000004;
  1784. type
  1785. tagNMRBAUTOSIZE = packed record
  1786. hdr: TNMHdr;
  1787. fChanged: BOOL;
  1788. rcTarget: TRect;
  1789. rcActual: TRect;
  1790. end;
  1791. PNMRBAutoSize = ^TNMRBAutoSize;
  1792. TNMRBAutoSize = tagNMRBAUTOSIZE;
  1793. { For IE >= 0x0500 }
  1794. tagNMREBARCHEVRON = packed record
  1795. hdr: NMHDR;
  1796. uBand: UINT;
  1797. wID: UINT;
  1798. lParam: LPARAM;
  1799. rc: TRect;
  1800. lParamNM: LPARAM;
  1801. end;
  1802. PNMReBarChevron = ^TNMReBarChevron;
  1803. TNMReBarChevron = tagNMREBARCHEVRON;
  1804. { For IE >= 0x0600 }
  1805. { $EXTERNALSYM tagNMREBARSPLITTER}
  1806. tagNMREBARSPLITTER = packed record
  1807. hdr: NMHDR;
  1808. rcSizing: TRect;
  1809. end;
  1810. PNMReBarSplitter = ^TNMReBarSplitter;
  1811. TNMReBarSplitter = tagNMREBARSPLITTER;
  1812. const
  1813. { For Windows >= XP }
  1814. RBAB_AUTOSIZE = $0001; { These are not flags and are all mutually exclusive }
  1815. RBAB_ADDBAND = $0002;
  1816. type
  1817. { $EXTERNALSYM tagNMREBARAUTOBREAK}
  1818. tagNMREBARAUTOBREAK = packed record
  1819. hdr: NMHDR;
  1820. uBand: UINT;
  1821. wID: UINT;
  1822. lParam: LPARAM;
  1823. uMsg: UINT;
  1824. fStyleCurrent: UINT;
  1825. fAutoBreak: BOOL;
  1826. end;
  1827. PNMReBarAutoBreak = ^TNMReBarAutoBreak;
  1828. TNMReBarAutoBreak = tagNMREBARAUTOBREAK;
  1829. const
  1830. RBHT_NOWHERE = $0001;
  1831. RBHT_CAPTION = $0002;
  1832. RBHT_CLIENT = $0003;
  1833. RBHT_GRABBER = $0004;
  1834. { For IE >= 0x0500 }
  1835. RBHT_CHEVRON = $0008;
  1836. { For IE >= 0x0600 }
  1837. RBHT_SPLITTER = $0010;
  1838. type
  1839. _RB_HITTESTINFO = packed record
  1840. pt: TPoint;
  1841. flags: UINT;
  1842. iBand: Integer;
  1843. end;
  1844. PRBHitTestInfo = ^TRBHitTestInfo;
  1845. TRBHitTestInfo = _RB_HITTESTINFO;
  1846. { ====== TOOLTIPS CONTROL ========================== }
  1847. const
  1848. TOOLTIPS_CLASS = 'tooltips_class32';
  1849. type
  1850. PToolInfoA = ^TToolInfoA;
  1851. PToolInfoW = ^TToolInfoW;
  1852. PToolInfo = PToolInfoW;
  1853. tagTOOLINFOA = record
  1854. cbSize: UINT;
  1855. uFlags: UINT;
  1856. hwnd: HWND;
  1857. uId: UINT;
  1858. Rect: TRect;
  1859. hInst: THandle;
  1860. lpszText: PAnsiChar;
  1861. lParam: LPARAM;
  1862. { For Windows >= XP }
  1863. //lpReserved: Pointer;
  1864. end;
  1865. tagTOOLINFOW = record
  1866. cbSize: UINT;
  1867. uFlags: UINT;
  1868. hwnd: HWND;
  1869. uId: UINT;
  1870. Rect: TRect;
  1871. hInst: THandle;
  1872. lpszText: PWideChar;
  1873. lParam: LPARAM;
  1874. { For Windows >= XP }
  1875. //lpReserved: Pointer;
  1876. end;
  1877. tagTOOLINFO = tagTOOLINFOW;
  1878. TToolInfoA = tagTOOLINFOA;
  1879. TToolInfoW = tagTOOLINFOW;
  1880. TToolInfo = TToolInfoW;
  1881. TOOLINFOA = tagTOOLINFOA;
  1882. TOOLINFOW = tagTOOLINFOW;
  1883. TOOLINFO = TOOLINFOW;
  1884. const
  1885. TTS_ALWAYSTIP = $01;
  1886. TTS_NOPREFIX = $02;
  1887. { For IE >= 0x0500 }
  1888. TTS_NOANIMATE = $10;
  1889. TTS_NOFADE = $20;
  1890. TTS_BALLOON = $40;
  1891. TTS_CLOSE = $80;
  1892. { For Windows >= Vista }
  1893. TTS_USEVISUALSTYLE = $100; // Use themed hyperlinks
  1894. TTF_IDISHWND = $0001;
  1895. // Use this to center around trackpoint in trackmode
  1896. // -OR- to center around tool in normal mode.
  1897. // Use TTF_ABSOLUTE to place the tip exactly at the track coords when
  1898. // in tracking mode. TTF_ABSOLUTE can be used in conjunction with TTF_CENTERTIP
  1899. // to center the tip absolutely about the track point.
  1900. TTF_CENTERTIP = $0002;
  1901. TTF_RTLREADING = $0004;
  1902. TTF_SUBCLASS = $0010;
  1903. TTF_TRACK = $0020;
  1904. TTF_ABSOLUTE = $0080;
  1905. TTF_TRANSPARENT = $0100;
  1906. TTF_PARSELINKS = $1000; // For IE >= 0x0501
  1907. TTF_DI_SETITEM = $8000; // valid only on the TTN_NEEDTEXT callback
  1908. TTDT_AUTOMATIC = 0;
  1909. TTDT_RESHOW = 1;
  1910. TTDT_AUTOPOP = 2;
  1911. TTDT_INITIAL = 3;
  1912. // ToolTip Icons (Set with TTM_SETTITLE)
  1913. TTI_NONE = 0;
  1914. TTI_INFO = 1;
  1915. TTI_WARNING = 2;
  1916. TTI_ERROR = 3;
  1917. { For Windows >= Vista }
  1918. TTI_INFO_LARGE = 4;
  1919. TTI_WARNING_LARGE = 5;
  1920. TTI_ERROR_LARGE = 6;
  1921. // Tool Tip Messages
  1922. TTM_ACTIVATE = WM_USER + 1;
  1923. TTM_SETDELAYTIME = WM_USER + 3;
  1924. TTM_ADDTOOLA = WM_USER + 4;
  1925. TTM_DELTOOLA = WM_USER + 5;
  1926. TTM_NEWTOOLRECTA = WM_USER + 6;
  1927. TTM_GETTOOLINFOA = WM_USER + 8;
  1928. TTM_SETTOOLINFOA = WM_USER + 9;
  1929. TTM_HITTESTA = WM_USER + 10;
  1930. TTM_GETTEXTA = WM_USER + 11;
  1931. TTM_UPDATETIPTEXTA = WM_USER + 12;
  1932. TTM_ENUMTOOLSA = WM_USER + 14;
  1933. TTM_GETCURRENTTOOLA = WM_USER + 15;
  1934. TTM_ADDTOOLW = WM_USER + 50;
  1935. TTM_DELTOOLW = WM_USER + 51;
  1936. TTM_NEWTOOLRECTW = WM_USER + 52;
  1937. TTM_GETTOOLINFOW = WM_USER + 53;
  1938. TTM_SETTOOLINFOW = WM_USER + 54;
  1939. TTM_HITTESTW = WM_USER + 55;
  1940. TTM_GETTEXTW = WM_USER + 56;
  1941. TTM_UPDATETIPTEXTW = WM_USER + 57;
  1942. TTM_ENUMTOOLSW = WM_USER + 58;
  1943. TTM_GETCURRENTTOOLW = WM_USER + 59;
  1944. TTM_WINDOWFROMPOINT = WM_USER + 16;
  1945. TTM_TRACKACTIVATE = WM_USER + 17; // wParam = TRUE/FALSE start end lparam = LPTOOLINFO
  1946. TTM_TRACKPOSITION = WM_USER + 18; // lParam = dwPos
  1947. TTM_SETTIPBKCOLOR = WM_USER + 19;
  1948. TTM_SETTIPTEXTCOLOR = WM_USER + 20;
  1949. TTM_GETDELAYTIME = WM_USER + 21;
  1950. TTM_GETTIPBKCOLOR = WM_USER + 22;
  1951. TTM_GETTIPTEXTCOLOR = WM_USER + 23;
  1952. TTM_SETMAXTIPWIDTH = WM_USER + 24;
  1953. TTM_GETMAXTIPWIDTH = WM_USER + 25;
  1954. TTM_SETMARGIN = WM_USER + 26; // lParam = lprc
  1955. TTM_GETMARGIN = WM_USER + 27; // lParam = lprc
  1956. TTM_POP = WM_USER + 28;
  1957. TTM_UPDATE = WM_USER + 29;
  1958. { For IE >= 0X0500 }
  1959. TTM_GETBUBBLESIZE = WM_USER + 30;
  1960. TTM_ADJUSTRECT = WM_USER + 31;
  1961. TTM_SETTITLEA = WM_USER + 32; { wParam = TTI_*, lParam = char* szTitle }
  1962. TTM_SETTITLEW = WM_USER + 33; { wParam = TTI_*, lParam = wchar* szTitle }
  1963. { For Windows >= XP }
  1964. TTM_POPUP = WM_USER + 34;
  1965. TTM_GETTITLE = WM_USER + 35; { wParam = 0, lParam = TTGETTITLE* }
  1966. type
  1967. { For Windows >= XP }
  1968. { $EXTERNALSYM _TTGETTITLE}
  1969. _TTGETTITLE = record
  1970. dwSize: DWORD;
  1971. uTitleBitmap: Integer;
  1972. cch: Integer;
  1973. pszTitle: PWCHAR;
  1974. end;
  1975. PTTGetTitle = ^TTTGetTitle;
  1976. TTTGetTitle = _TTGETTITLE;
  1977. const
  1978. {$IFDEF UNICODE}
  1979. TTM_ADDTOOL = TTM_ADDTOOLW;
  1980. TTM_DELTOOL = TTM_DELTOOLW;
  1981. TTM_NEWTOOLRECT = TTM_NEWTOOLRECTW;
  1982. TTM_GETTOOLINFO = TTM_GETTOOLINFOW;
  1983. TTM_SETTOOLINFO = TTM_SETTOOLINFOW;
  1984. TTM_HITTEST = TTM_HITTESTW;
  1985. TTM_GETTEXT = TTM_GETTEXTW;
  1986. TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTW;
  1987. TTM_ENUMTOOLS = TTM_ENUMTOOLSW;
  1988. TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLW;
  1989. {$ELSE}
  1990. TTM_ADDTOOL = TTM_ADDTOOLA;
  1991. TTM_DELTOOL = TTM_DELTOOLA;
  1992. TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA;
  1993. TTM_GETTOOLINFO = TTM_GETTOOLINFOA;
  1994. TTM_SETTOOLINFO = TTM_SETTOOLINFOA;
  1995. TTM_HITTEST = TTM_HITTESTA;
  1996. TTM_GETTEXT = TTM_GETTEXTA;
  1997. TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA;
  1998. TTM_ENUMTOOLS = TTM_ENUMTOOLSA;
  1999. TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA;
  2000. {$ENDIF}
  2001. { For IE >= 0X0500 }
  2002. TTM_SETTITLE = TTM_SETTITLEW;
  2003. { For Windows >= XP }
  2004. TTM_SETWINDOWTHEME = CCM_SETWINDOWTHEME;
  2005. TTM_RELAYEVENT = WM_USER + 7;
  2006. TTM_GETTOOLCOUNT = WM_USER +13;
  2007. type
  2008. PTTHitTestInfoA = ^TTTHitTestInfoA;
  2009. PTTHitTestInfoW = ^TTTHitTestInfoW;
  2010. PTTHitTestInfo = PTTHitTestInfoW;
  2011. _TT_HITTESTINFOA = record
  2012. hwnd: HWND;
  2013. pt: TPoint;
  2014. ti: TToolInfoA;
  2015. end;
  2016. _TT_HITTESTINFOW = record
  2017. hwnd: HWND;
  2018. pt: TPoint;
  2019. ti: TToolInfoW;
  2020. end;
  2021. _TT_HITTESTINFO = _TT_HITTESTINFOW;
  2022. TTTHitTestInfoA = _TT_HITTESTINFOA;
  2023. TTTHitTestInfoW = _TT_HITTESTINFOW;
  2024. TTTHitTestInfo = TTTHitTestInfoW;
  2025. TTHITTESTINFOA = _TT_HITTESTINFOA;
  2026. TTHITTESTINFOW = _TT_HITTESTINFOW;
  2027. TTHITTESTINFO = TTHITTESTINFOW;
  2028. const
  2029. TTN_NEEDTEXTA = TTN_FIRST - 0;
  2030. TTN_NEEDTEXTW = TTN_FIRST - 10;
  2031. {$IFDEF UNICODE}
  2032. TTN_NEEDTEXT = TTN_NEEDTEXTW;
  2033. {$ELSE}
  2034. TTN_NEEDTEXT = TTN_NEEDTEXTA;
  2035. {$ENDIF}
  2036. TTN_SHOW = TTN_FIRST - 1;
  2037. TTN_POP = TTN_FIRST - 2;
  2038. type
  2039. tagNMTTDISPINFOA = record
  2040. hdr: TNMHdr;
  2041. lpszText: PAnsiChar;
  2042. szText: array[0..79] of AnsiChar;
  2043. hinst: HINST;
  2044. uFlags: UINT;
  2045. lParam: LPARAM;
  2046. end;
  2047. tagNMTTDISPINFOW = record
  2048. hdr: TNMHdr;
  2049. lpszText: PWideChar;
  2050. szText: array[0..79] of WideChar;
  2051. hinst: HINST;
  2052. uFlags: UINT;
  2053. lParam: LPARAM;
  2054. end;
  2055. tagNMTTDISPINFO = tagNMTTDISPINFOW;
  2056. PNMTTDispInfoA = ^TNMTTDispInfoA;
  2057. PNMTTDispInfoW = ^TNMTTDispInfoW;
  2058. PNMTTDispInfo = PNMTTDispInfoW;
  2059. TNMTTDispInfoA = tagNMTTDISPINFOA;
  2060. TNMTTDispInfoW = tagNMTTDISPINFOW;
  2061. TNMTTDispInfo = TNMTTDispInfoW;
  2062. tagTOOLTIPTEXTA = tagNMTTDISPINFOA;
  2063. tagTOOLTIPTEXTW = tagNMTTDISPINFOW;
  2064. tagTOOLTIPTEXT = tagTOOLTIPTEXTW;
  2065. TOOLTIPTEXTA = tagNMTTDISPINFOA;
  2066. TOOLTIPTEXTW = tagNMTTDISPINFOW;
  2067. TOOLTIPTEXT = TOOLTIPTEXTW;
  2068. TToolTipTextA = tagNMTTDISPINFOA;
  2069. TToolTipTextW = tagNMTTDISPINFOW;
  2070. TToolTipText = TToolTipTextW;
  2071. PToolTipTextA = ^TToolTipTextA;
  2072. PToolTipTextW = ^TToolTipTextW;
  2073. PToolTipText = PToolTipTextW;
  2074. { ====== STATUS BAR CONTROL ================= }
  2075. const
  2076. SBARS_SIZEGRIP = $0100;
  2077. procedure DrawStatusText(hDC: HDC; lprc: PRect; pzsText: PWideChar;
  2078. uFlags: UINT); stdcall;
  2079. procedure DrawStatusTextA(hDC: HDC; lprc: PRect; pzsText: PAnsiChar;
  2080. uFlags: UINT); stdcall;
  2081. procedure DrawStatusTextW(hDC: HDC; lprc: PRect; pzsText: PWideChar;
  2082. uFlags: UINT); stdcall;
  2083. function CreateStatusWindow(Style: Longint; lpszText: PWideChar;
  2084. hwndParent: HWND; wID: UINT): HWND; stdcall;
  2085. function CreateStatusWindowA(Style: Longint; lpszText: PAnsiChar;
  2086. hwndParent: HWND; wID: UINT): HWND; stdcall;
  2087. function CreateStatusWindowW(Style: Longint; lpszText: PWideChar;
  2088. hwndParent: HWND; wID: UINT): HWND; stdcall;
  2089. const
  2090. STATUSCLASSNAME = 'msctls_statusbar32';
  2091. const
  2092. SB_SETTEXTA = WM_USER+1;
  2093. SB_GETTEXTA = WM_USER+2;
  2094. SB_GETTEXTLENGTHA = WM_USER+3;
  2095. SB_SETTIPTEXTA = WM_USER+16;
  2096. SB_GETTIPTEXTA = WM_USER+18;
  2097. SB_SETTEXTW = WM_USER+11;
  2098. SB_GETTEXTW = WM_USER+13;
  2099. SB_GETTEXTLENGTHW = WM_USER+12;
  2100. SB_SETTIPTEXTW = WM_USER+17;
  2101. SB_GETTIPTEXTW = WM_USER+19;
  2102. {$IFDEF UNICODE}
  2103. SB_SETTEXT = SB_SETTEXTW;
  2104. SB_GETTEXT = SB_GETTEXTW;
  2105. SB_GETTEXTLENGTH = SB_GETTEXTLENGTHW;
  2106. SB_SETTIPTEXT = SB_SETTIPTEXTW;
  2107. SB_GETTIPTEXT = SB_GETTIPTEXTW;
  2108. {$ELSE}
  2109. SB_SETTEXT = SB_SETTEXTA;
  2110. SB_GETTEXT = SB_GETTEXTA;
  2111. SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA;
  2112. SB_SETTIPTEXT = SB_SETTIPTEXTA;
  2113. SB_GETTIPTEXT = SB_GETTIPTEXTA;
  2114. {$ENDIF}
  2115. SB_SETPARTS = WM_USER+4;
  2116. SB_GETPARTS = WM_USER+6;
  2117. SB_GETBORDERS = WM_USER+7;
  2118. SB_SETMINHEIGHT = WM_USER+8;
  2119. SB_SIMPLE = WM_USER+9;
  2120. SB_GETRECT = WM_USER + 10;
  2121. SB_ISSIMPLE = WM_USER+14;
  2122. SB_SETICON = WM_USER+15;
  2123. SB_GETICON = WM_USER+20;
  2124. SB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  2125. SB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  2126. SBT_OWNERDRAW = $1000;
  2127. SBT_NOBORDERS = $0100;
  2128. SBT_POPOUT = $0200;
  2129. SBT_RTLREADING = $0400;
  2130. SBT_TOOLTIPS = $0800;
  2131. SB_SETBKCOLOR = CCM_SETBKCOLOR; // lParam = bkColor
  2132. // status bar notifications
  2133. SBN_SIMPLEMODECHANGE = SBN_FIRST - 0;
  2134. { ====== MENU HELP ========================== }
  2135. procedure MenuHelp(Msg: UINT; wParam: WPARAM; lParam: LPARAM;
  2136. hMainMenu: HMENU; hInst: THandle; hwndStatus: HWND; lpwIDs: PUINT); stdcall;
  2137. function ShowHideMenuCtl(hWnd: HWND; uFlags: UINT; lpInfo: PINT): Bool; stdcall;
  2138. procedure GetEffectiveClientRect(hWnd: HWND; lprc: PRect; lpInfo: PINT); stdcall;
  2139. const
  2140. MINSYSCOMMAND = SC_SIZE;
  2141. { ====== TRACKBAR CONTROL =================== }
  2142. TRACKBAR_CLASS = 'msctls_trackbar32';
  2143. const
  2144. TBS_AUTOTICKS = $0001;
  2145. TBS_VERT = $0002;
  2146. TBS_HORZ = $0000;
  2147. TBS_TOP = $0004;
  2148. TBS_BOTTOM = $0000;
  2149. TBS_LEFT = $0004;
  2150. TBS_RIGHT = $0000;
  2151. TBS_BOTH = $0008;
  2152. TBS_NOTICKS = $0010;
  2153. TBS_ENABLESELRANGE = $0020;
  2154. TBS_FIXEDLENGTH = $0040;
  2155. TBS_NOTHUMB = $0080;
  2156. TBS_TOOLTIPS = $0100;
  2157. { For IE >= 0x0500 }
  2158. TBS_REVERSED = $0200; { Accessibility hint: the smaller number (usually the min value) means "high" and the larger number (usually the max value) means "low" }
  2159. { For IE >= 0x0501 }
  2160. TBS_DOWNISLEFT = $0400; { Down=Left and Up=Right (default is Down=Right and Up=Left) }
  2161. { For IE >= 0x0600 }
  2162. TBS_NOTIFYBEFOREMOVE = $0800; { Trackbar should notify parent before repositioning the slider due to user action (enables snapping) }
  2163. { For NTDDI_VERSION >= NTDDI_LONGHORN }
  2164. TBS_TRANSPARENTBKGND = $1000; { Background is painted by the parent via WM_PRINTCLIENT }
  2165. TBM_GETPOS = WM_USER;
  2166. TBM_GETRANGEMIN = WM_USER+1;
  2167. TBM_GETRANGEMAX = WM_USER+2;
  2168. TBM_GETTIC = WM_USER+3;
  2169. TBM_SETTIC = WM_USER+4;
  2170. TBM_SETPOS = WM_USER+5;
  2171. TBM_SETRANGE = WM_USER+6;
  2172. TBM_SETRANGEMIN = WM_USER+7;
  2173. TBM_SETRANGEMAX = WM_USER+8;
  2174. TBM_CLEARTICS = WM_USER+9;
  2175. TBM_SETSEL = WM_USER+10;
  2176. TBM_SETSELSTART = WM_USER+11;
  2177. TBM_SETSELEND = WM_USER+12;
  2178. TBM_GETPTICS = WM_USER+14;
  2179. TBM_GETTICPOS = WM_USER+15;
  2180. TBM_GETNUMTICS = WM_USER+16;
  2181. TBM_GETSELSTART = WM_USER+17;
  2182. TBM_GETSELEND = WM_USER+18;
  2183. TBM_CLEARSEL = WM_USER+19;
  2184. TBM_SETTICFREQ = WM_USER+20;
  2185. TBM_SETPAGESIZE = WM_USER+21;
  2186. TBM_GETPAGESIZE = WM_USER+22;
  2187. TBM_SETLINESIZE = WM_USER+23;
  2188. TBM_GETLINESIZE = WM_USER+24;
  2189. TBM_GETTHUMBRECT = WM_USER+25;
  2190. TBM_GETCHANNELRECT = WM_USER+26;
  2191. TBM_SETTHUMBLENGTH = WM_USER+27;
  2192. TBM_GETTHUMBLENGTH = WM_USER+28;
  2193. TBM_SETTOOLTIPS = WM_USER+29;
  2194. TBM_GETTOOLTIPS = WM_USER+30;
  2195. TBM_SETTIPSIDE = WM_USER+31;
  2196. // TrackBar Tip Side flags
  2197. TBTS_TOP = 0;
  2198. TBTS_LEFT = 1;
  2199. TBTS_BOTTOM = 2;
  2200. TBTS_RIGHT = 3;
  2201. TBM_SETBUDDY = WM_USER+32; // wparam = BOOL fLeft; (or right)
  2202. TBM_GETBUDDY = WM_USER+33; // wparam = BOOL fLeft; (or right)
  2203. TBM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  2204. TBM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  2205. TB_LINEUP = 0;
  2206. TB_LINEDOWN = 1;
  2207. TB_PAGEUP = 2;
  2208. TB_PAGEDOWN = 3;
  2209. TB_THUMBPOSITION = 4;
  2210. TB_THUMBTRACK = 5;
  2211. TB_TOP = 6;
  2212. TB_BOTTOM = 7;
  2213. TB_ENDTRACK = 8;
  2214. // custom draw item specs
  2215. TBCD_TICS = $0001;
  2216. TBCD_THUMB = $0002;
  2217. TBCD_CHANNEL = $0003;
  2218. { For Windows >= Vista }
  2219. TRBN_THUMBPOSCHANGING = TRBN_FIRST-1;
  2220. { ====== DRAG LIST CONTROL ================== }
  2221. type
  2222. PDragListInfo = ^TDragListInfo;
  2223. tagDRAGLISTINFO = packed record
  2224. uNotification: UINT;
  2225. hWnd: HWND;
  2226. ptCursor: TPoint;
  2227. end;
  2228. TDragListInfo = tagDRAGLISTINFO;
  2229. DRAGLISTINFO = tagDRAGLISTINFO;
  2230. const
  2231. DL_BEGINDRAG = WM_USER+133;
  2232. DL_DRAGGING = WM_USER+134;
  2233. DL_DROPPED = WM_USER+135;
  2234. DL_CANCELDRAG = WM_USER+136;
  2235. DL_CURSORSET = 0;
  2236. DL_STOPCURSOR = 1;
  2237. DL_COPYCURSOR = 2;
  2238. DL_MOVECURSOR = 3;
  2239. const
  2240. DRAGLISTMSGSTRING = 'commctrl_DragListMsg';
  2241. procedure MakeDragList(hLB: HWND); stdcall;
  2242. procedure DrawInsert(hwndParent: HWND; hLB: HWND; nItem: Integer); stdcall;
  2243. function LBItemFromPt(hLB: HWND; pt: TPoint; bAutoScroll: Bool): Integer; stdcall;
  2244. { ====== UPDOWN CONTROL ========================== }
  2245. const
  2246. UPDOWN_CLASS = 'msctls_updown32';
  2247. type
  2248. PUDAccel = ^TUDAccel;
  2249. _UDACCEL = packed record
  2250. nSec: UINT;
  2251. nInc: UINT;
  2252. end;
  2253. TUDAccel = _UDACCEL;
  2254. UDACCEL = _UDACCEL;
  2255. const
  2256. UD_MAXVAL = $7fff;
  2257. UD_MINVAL = -UD_MAXVAL;
  2258. UDS_WRAP = $0001;
  2259. UDS_SETBUDDYINT = $0002;
  2260. UDS_ALIGNRIGHT = $0004;
  2261. UDS_ALIGNLEFT = $0008;
  2262. UDS_AUTOBUDDY = $0010;
  2263. UDS_ARROWKEYS = $0020;
  2264. UDS_HORZ = $0040;
  2265. UDS_NOTHOUSANDS = $0080;
  2266. UDS_HOTTRACK = $0100;
  2267. UDM_SETRANGE = WM_USER+101;
  2268. UDM_GETRANGE = WM_USER+102;
  2269. UDM_SETPOS = WM_USER+103;
  2270. UDM_GETPOS = WM_USER+104;
  2271. UDM_SETBUDDY = WM_USER+105;
  2272. UDM_GETBUDDY = WM_USER+106;
  2273. UDM_SETACCEL = WM_USER+107;
  2274. UDM_GETACCEL = WM_USER+108;
  2275. UDM_SETBASE = WM_USER+109;
  2276. UDM_GETBASE = WM_USER+110;
  2277. UDM_SETRANGE32 = WM_USER+111;
  2278. UDM_GETRANGE32 = WM_USER+112; // wParam & lParam are LPINT
  2279. UDM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  2280. UDM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  2281. function CreateUpDownControl(dwStyle: Longint; X, Y, CX, CY: Integer;
  2282. hParent: HWND; nID: Integer; hInst: THandle; hBuddy: HWND;
  2283. nUpper, nLower, nPos: Integer): HWND; stdcall;
  2284. type
  2285. PNMUpDown = ^TNMUpDown;
  2286. _NM_UPDOWN = packed record
  2287. hdr: TNMHDR;
  2288. iPos: Integer;
  2289. iDelta: Integer;
  2290. end;
  2291. TNMUpDown = _NM_UPDOWN;
  2292. NM_UPDOWN = _NM_UPDOWN;
  2293. const
  2294. UDN_DELTAPOS = UDN_FIRST - 1;
  2295. { ====== PROGRESS CONTROL ========================= }
  2296. const
  2297. PROGRESS_CLASS = 'msctls_progress32';
  2298. type
  2299. PBRANGE = record
  2300. iLow: Integer;
  2301. iHigh: Integer;
  2302. end;
  2303. PPBRange = ^TPBRange;
  2304. TPBRange = PBRANGE;
  2305. const
  2306. PBS_SMOOTH = 01;
  2307. PBS_VERTICAL = 04;
  2308. PBM_SETRANGE = WM_USER+1;
  2309. PBM_SETPOS = WM_USER+2;
  2310. PBM_DELTAPOS = WM_USER+3;
  2311. PBM_SETSTEP = WM_USER+4;
  2312. PBM_STEPIT = WM_USER+5;
  2313. PBM_SETRANGE32 = WM_USER+6; // lParam = high, wParam = low
  2314. PBM_GETRANGE = WM_USER+7; // lParam = PPBRange or Nil
  2315. // wParam = False: Result = high
  2316. // wParam = True: Result = low
  2317. PBM_GETPOS = WM_USER+8;
  2318. PBM_SETBARCOLOR = WM_USER+9; // lParam = bar color
  2319. PBM_SETBKCOLOR = CCM_SETBKCOLOR; // lParam = bkColor
  2320. { For Windows >= XP }
  2321. PBS_MARQUEE = $08;
  2322. PBM_SETMARQUEE = WM_USER+10;
  2323. { For Windows >= Vista }
  2324. PBS_SMOOTHREVERSE = $10;
  2325. { For Windows >= Vista }
  2326. PBM_GETSTEP = WM_USER+13;
  2327. PBM_GETBKCOLOR = WM_USER+14;
  2328. PBM_GETBARCOLOR = WM_USER+15;
  2329. PBM_SETSTATE = WM_USER+16; { wParam = PBST_[State] (NORMAL, ERROR, PAUSED) }
  2330. PBM_GETSTATE = WM_USER+17;
  2331. { For Windows >= Vista }
  2332. PBST_NORMAL = $0001;
  2333. PBST_ERROR = $0002;
  2334. PBST_PAUSED = $0003;
  2335. { ====== HOTKEY CONTROL ========================== }
  2336. const
  2337. HOTKEYF_SHIFT = $01;
  2338. HOTKEYF_CONTROL = $02;
  2339. HOTKEYF_ALT = $04;
  2340. HOTKEYF_EXT = $08;
  2341. HKCOMB_NONE = $0001;
  2342. HKCOMB_S = $0002;
  2343. HKCOMB_C = $0004;
  2344. HKCOMB_A = $0008;
  2345. HKCOMB_SC = $0010;
  2346. HKCOMB_SA = $0020;
  2347. HKCOMB_CA = $0040;
  2348. HKCOMB_SCA = $0080;
  2349. HKM_SETHOTKEY = WM_USER+1;
  2350. HKM_GETHOTKEY = WM_USER+2;
  2351. HKM_SETRULES = WM_USER+3;
  2352. const
  2353. HOTKEYCLASS = 'msctls_hotkey32';
  2354. { ====== COMMON CONTROL STYLES ================ }
  2355. const
  2356. CCS_TOP = $00000001;
  2357. CCS_NOMOVEY = $00000002;
  2358. CCS_BOTTOM = $00000003;
  2359. CCS_NORESIZE = $00000004;
  2360. CCS_NOPARENTALIGN = $00000008;
  2361. CCS_ADJUSTABLE = $00000020;
  2362. CCS_NODIVIDER = $00000040;
  2363. CCS_VERT = $00000080;
  2364. CCS_LEFT = (CCS_VERT or CCS_TOP);
  2365. CCS_RIGHT = (CCS_VERT or CCS_BOTTOM);
  2366. CCS_NOMOVEX = (CCS_VERT or CCS_NOMOVEY);
  2367. // ====== SysLink control =========================================
  2368. const
  2369. { For Windows >= XP }
  2370. INVALID_LINK_INDEX = -1;
  2371. MAX_LINKID_TEXT = 48;
  2372. L_MAX_URL_LENGTH = 2048 + 32 + sizeof('://');
  2373. { For Windows >= XP }
  2374. WC_LINK = 'SysLink';
  2375. { For Windows >= XP }
  2376. LWS_TRANSPARENT = $0001;
  2377. LWS_IGNORERETURN = $0002;
  2378. { For Windows >= Vista }
  2379. LWS_NOPREFIX = $0004;
  2380. LWS_USEVISUALSTYLE = $0008;
  2381. LWS_USECUSTOMTEXT = $0010;
  2382. LWS_RIGHT = $0020;
  2383. { For Windows >= XP }
  2384. LIF_ITEMINDEX = $00000001;
  2385. LIF_STATE = $00000002;
  2386. LIF_ITEMID = $00000004;
  2387. LIF_URL = $00000008;
  2388. { For Windows >= XP }
  2389. LIS_FOCUSED = $00000001;
  2390. LIS_ENABLED = $00000002;
  2391. LIS_VISITED = $00000004;
  2392. { For Windows >= Vista }
  2393. LIS_HOTTRACK = $00000008;
  2394. LIS_DEFAULTCOLORS = $00000010; // Don't use any custom text colors
  2395. type
  2396. { For Windows >= XP }
  2397. { $EXTERNALSYM tagLITEM}
  2398. tagLITEM = record
  2399. mask: UINT;
  2400. iLink: Integer;
  2401. state: UINT;
  2402. stateMask: UINT;
  2403. szID: packed array[0..MAX_LINKID_TEXT-1] of WCHAR;
  2404. szUrl: packed array[0..L_MAX_URL_LENGTH-1] of WCHAR;
  2405. end;
  2406. PLItem = ^TLItem;
  2407. TLItem = tagLITEM;
  2408. { For Windows >= XP }
  2409. { $EXTERNALSYM tagLHITTESTINFO}
  2410. tagLHITTESTINFO = record
  2411. pt: TPoint;
  2412. item: TLItem;
  2413. end;
  2414. PLHitTestInfo = ^TLHitTestInfo;
  2415. TLHitTestInfo = tagLHITTESTINFO;
  2416. { For Windows >= XP }
  2417. { $EXTERNALSYM tagNMLINK}
  2418. tagNMLINK = record
  2419. hdr: NMHDR;
  2420. item: TLItem;
  2421. end;
  2422. PNMLink = ^TNMLink;
  2423. TNMLink = tagNMLINK;
  2424. // SysLink notifications
  2425. // NM_CLICK // wParam: control ID, lParam: PNMLINK, ret: ignored.
  2426. // LinkWindow messages
  2427. const
  2428. { For Windows >= XP }
  2429. LM_HITTEST = WM_USER+$300; // wParam: n/a, lparam: PLHITTESTINFO, ret: BOOL
  2430. LM_GETIDEALHEIGHT = WM_USER+$301; // wParam: cxMaxWidth, lparam: n/a, ret: cy
  2431. LM_SETITEM = WM_USER+$302; // wParam: n/a, lparam: LITEM*, ret: BOOL
  2432. LM_GETITEM = WM_USER+$303; // wParam: n/a, lparam: LITEM*, ret: BOOL
  2433. LM_GETIDEALSIZE = LM_GETIDEALHEIGHT; // wParam: cxMaxWidth, lparam: SIZE*, ret: cy
  2434. { ====== LISTVIEW CONTROL ====================== }
  2435. const
  2436. WC_LISTVIEW = 'SysListView32';
  2437. const
  2438. { List View Styles }
  2439. LVS_ICON = $0000;
  2440. LVS_REPORT = $0001;
  2441. LVS_SMALLICON = $0002;
  2442. LVS_LIST = $0003;
  2443. LVS_TYPEMASK = $0003;
  2444. LVS_SINGLESEL = $0004;
  2445. LVS_SHOWSELALWAYS = $0008;
  2446. LVS_SORTASCENDING = $0010;
  2447. LVS_SORTDESCENDING = $0020;
  2448. LVS_SHAREIMAGELISTS = $0040;
  2449. LVS_NOLABELWRAP = $0080;
  2450. LVS_AUTOARRANGE = $0100;
  2451. LVS_EDITLABELS = $0200;
  2452. LVS_OWNERDATA = $1000;
  2453. LVS_NOSCROLL = $2000;
  2454. LVS_TYPESTYLEMASK = $FC00;
  2455. LVS_ALIGNTOP = $0000;
  2456. LVS_ALIGNLEFT = $0800;
  2457. LVS_ALIGNMASK = $0c00;
  2458. LVS_OWNERDRAWFIXED = $0400;
  2459. LVS_NOCOLUMNHEADER = $4000;
  2460. LVS_NOSORTHEADER = $8000;
  2461. { List View Extended Styles }
  2462. LVS_EX_GRIDLINES = $00000001;
  2463. LVS_EX_SUBITEMIMAGES = $00000002;
  2464. LVS_EX_CHECKBOXES = $00000004;
  2465. LVS_EX_TRACKSELECT = $00000008;
  2466. LVS_EX_HEADERDRAGDROP = $00000010;
  2467. LVS_EX_FULLROWSELECT = $00000020; // applies to report mode only
  2468. LVS_EX_ONECLICKACTIVATE = $00000040;
  2469. LVS_EX_TWOCLICKACTIVATE = $00000080;
  2470. LVS_EX_FLATSB = $00000100;
  2471. LVS_EX_REGIONAL = $00000200;
  2472. LVS_EX_INFOTIP = $00000400; // listview does InfoTips for you
  2473. LVS_EX_UNDERLINEHOT = $00000800;
  2474. LVS_EX_UNDERLINECOLD = $00001000;
  2475. LVS_EX_MULTIWORKAREAS = $00002000;
  2476. { For IE >= 0x0500 }
  2477. LVS_EX_LABELTIP = $00004000; { listview unfolds partly hidden labels if it does not have infotip text }
  2478. LVS_EX_BORDERSELECT = $00008000; { border selection style instead of highlight }
  2479. { For Windows >= XP }
  2480. LVS_EX_DOUBLEBUFFER = $00010000;
  2481. LVS_EX_HIDELABELS = $00020000;
  2482. LVS_EX_SINGLEROW = $00040000;
  2483. LVS_EX_SNAPTOGRID = $00080000; { Icons automatically snap to grid. }
  2484. LVS_EX_SIMPLESELECT = $00100000; { Also changes overlay rendering to top right for icon mode. }
  2485. { For Windows >= Vista }
  2486. LVS_EX_JUSTIFYCOLUMNS = $00200000; { Icons are lined up in columns that use up the whole view area. }
  2487. LVS_EX_TRANSPARENTBKGND = $00400000; { Background is painted by the parent via WM_PRINTCLIENT }
  2488. LVS_EX_TRANSPARENTSHADOWTEXT = $00800000; { Enable shadow text on transparent backgrounds only (useful with bitmaps) }
  2489. LVS_EX_AUTOAUTOARRANGE = $01000000; { Icons automatically arrange if no icon positions have been set }
  2490. LVS_EX_HEADERINALLVIEWS = $02000000; { Display column header in all view modes }
  2491. LVS_EX_AUTOCHECKSELECT = $08000000;
  2492. LVS_EX_AUTOSIZECOLUMNS = $10000000;
  2493. LVS_EX_COLUMNSNAPPOINTS = $40000000;
  2494. LVS_EX_COLUMNOVERFLOW = $80000000;
  2495. const
  2496. LVM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  2497. function ListView_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL; {inline;}
  2498. const
  2499. LVM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  2500. function ListView_GetUnicodeFormat(hwnd: HWND): BOOL; {inline;}
  2501. const
  2502. LVM_GETBKCOLOR = LVM_FIRST + 0;
  2503. function ListView_GetBkColor(hWnd: HWND): TColorRef; {inline;}
  2504. const
  2505. LVM_SETBKCOLOR = LVM_FIRST + 1;
  2506. function ListView_SetBkColor(hWnd: HWND; clrBk: TColorRef): Bool; {inline;}
  2507. const
  2508. LVM_GETIMAGELIST = LVM_FIRST + 2;
  2509. function ListView_GetImageList(hWnd: HWND; iImageList: Integer): HIMAGELIST; {inline;}
  2510. const
  2511. LVSIL_NORMAL = 0;
  2512. LVSIL_SMALL = 1;
  2513. LVSIL_STATE = 2;
  2514. LVSIL_GROUPHEADER = 3;
  2515. const
  2516. LVM_SETIMAGELIST = LVM_FIRST + 3;
  2517. function ListView_SetImageList(hWnd: HWND; himl: HIMAGELIST;
  2518. iImageList: Integer): HIMAGELIST; {inline;}
  2519. const
  2520. LVM_GETITEMCOUNT = LVM_FIRST + 4;
  2521. function ListView_GetItemCount(hWnd: HWND): Integer; {inline;}
  2522. const
  2523. LVIF_TEXT = $0001;
  2524. LVIF_IMAGE = $0002;
  2525. LVIF_PARAM = $0004;
  2526. LVIF_STATE = $0008;
  2527. LVIF_INDENT = $0010;
  2528. LVIF_NORECOMPUTE = $0800;
  2529. { For Windows >= XP }
  2530. LVIF_GROUPID = $00000100;
  2531. LVIF_COLUMNS = $00000200;
  2532. { For Windows >= Vista }
  2533. LVIF_COLFMT = $00010000; { The piColFmt member is valid in addition to puColumns }
  2534. LVIS_FOCUSED = $0001;
  2535. LVIS_SELECTED = $0002;
  2536. LVIS_CUT = $0004;
  2537. LVIS_DROPHILITED = $0008;
  2538. LVIS_ACTIVATING = $0020;
  2539. LVIS_OVERLAYMASK = $0F00;
  2540. LVIS_STATEIMAGEMASK = $F000;
  2541. function IndexToStateImageMask(I: Longint): Longint; {inline;}
  2542. const
  2543. I_INDENTCALLBACK = -1;
  2544. I_IMAGENONE = -2;
  2545. { For Windows >= XP }
  2546. I_COLUMNSCALLBACK = -1;
  2547. I_GROUPIDCALLBACK = -1;
  2548. I_GROUPIDNONE = -2;
  2549. (*
  2550. LVITEMA_V5_SIZE = CCSIZEOF_STRUCT(LVITEMA, puColumns);
  2551. LVITEMW_V5_SIZE = CCSIZEOF_STRUCT(LVITEMW, puColumns);
  2552. LVITEM_V5_SIZE = LVITEMW_V5_SIZE;
  2553. *)
  2554. type
  2555. PLVItemA = ^TLVItemA;
  2556. PLVItemW = ^TLVItemW;
  2557. PLVItem = PLVItemW;
  2558. tagLVITEMA = record
  2559. mask: UINT;
  2560. iItem: Integer;
  2561. iSubItem: Integer;
  2562. state: UINT;
  2563. stateMask: UINT;
  2564. pszText: PAnsiChar;
  2565. cchTextMax: Integer;
  2566. iImage: Integer;
  2567. lParam: LPARAM;
  2568. iIndent: Integer;
  2569. iGroupId: Integer;
  2570. cColumns: Integer;{ tile view columns }
  2571. puColumns: PUINT;
  2572. //piColFmt: PInteger;
  2573. //iGroup: Integer;{ readonly. only valid for owner data. }
  2574. end;
  2575. tagLVITEMW = record
  2576. mask: UINT;
  2577. iItem: Integer;
  2578. iSubItem: Integer;
  2579. state: UINT;
  2580. stateMask: UINT;
  2581. pszText: PWideChar;
  2582. cchTextMax: Integer;
  2583. iImage: Integer;
  2584. lParam: LPARAM;
  2585. iIndent: Integer;
  2586. iGroupId: Integer;
  2587. cColumns: Integer;{ tile view columns }
  2588. puColumns: PUINT;
  2589. //piColFmt: PInteger;
  2590. //iGroup: Integer;{ readonly. only valid for owner data. }
  2591. end;
  2592. tagLVITEM = tagLVITEMW;
  2593. _LV_ITEMA = tagLVITEMA;
  2594. _LV_ITEMW = tagLVITEMW;
  2595. _LV_ITEM = _LV_ITEMW;
  2596. TLVItemA = tagLVITEMA;
  2597. TLVItemW = tagLVITEMW;
  2598. TLVItem = TLVItemW;
  2599. LV_ITEMA = tagLVITEMA;
  2600. LV_ITEMW = tagLVITEMW;
  2601. LV_ITEM = LV_ITEMW;
  2602. const
  2603. LPSTR_TEXTCALLBACKA = LPSTR(-1);
  2604. LPSTR_TEXTCALLBACKW = LPWSTR(-1);
  2605. {$IFDEF UNICODE}
  2606. LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKW;
  2607. {$ELSE}
  2608. LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKA;
  2609. {$ENDIF}
  2610. I_IMAGECALLBACK = -1;
  2611. const
  2612. LVM_GETITEMA = LVM_FIRST + 5;
  2613. LVM_SETITEMA = LVM_FIRST + 6;
  2614. LVM_INSERTITEMA = LVM_FIRST + 7;
  2615. LVM_GETITEMW = LVM_FIRST + 75;
  2616. LVM_SETITEMW = LVM_FIRST + 76;
  2617. LVM_INSERTITEMW = LVM_FIRST + 77;
  2618. {$IFDEF UNICODE}
  2619. LVM_GETITEM = LVM_GETITEMW;
  2620. LVM_SETITEM = LVM_SETITEMW;
  2621. LVM_INSERTITEM = LVM_INSERTITEMW;
  2622. {$ELSE}
  2623. LVM_GETITEM = LVM_GETITEMA;
  2624. LVM_SETITEM = LVM_SETITEMA;
  2625. LVM_INSERTITEM = LVM_INSERTITEMA;
  2626. {$ENDIF}
  2627. LVM_DELETEITEM = LVM_FIRST + 8;
  2628. LVM_DELETEALLITEMS = LVM_FIRST + 9;
  2629. LVM_GETCALLBACKMASK = LVM_FIRST + 10;
  2630. LVM_SETCALLBACKMASK = LVM_FIRST + 11;
  2631. function ListView_GetItem(hWnd: HWND; var pItem: TLVItem): Bool; {inline;}
  2632. function ListView_GetItemA(hWnd: HWND; var pItem: TLVItemA): Bool; {inline;}
  2633. function ListView_GetItemW(hWnd: HWND; var pItem: TLVItemW): Bool; {inline;}
  2634. function ListView_SetItem(hWnd: HWND; const pItem: TLVItem): Bool; {inline;}
  2635. function ListView_SetItemA(hWnd: HWND; const pItem: TLVItemA): Bool; {inline;}
  2636. function ListView_SetItemW(hWnd: HWND; const pItem: TLVItemW): Bool; {inline;}
  2637. function ListView_InsertItem(hWnd: HWND; const pItem: TLVItem): Integer; {inline;}
  2638. function ListView_InsertItemA(hWnd: HWND; const pItem: TLVItemA): Integer; {inline;}
  2639. function ListView_InsertItemW(hWnd: HWND; const pItem: TLVItemW): Integer; {inline;}
  2640. function ListView_DeleteItem(hWnd: HWND; i: Integer): Bool; {inline;}
  2641. function ListView_DeleteAllItems(hWnd: HWND): Bool; {inline;}
  2642. function ListView_GetCallbackMask(hWnd: HWND): UINT; {inline;}
  2643. function ListView_SetCallbackMask(hWnd: HWND; mask: UINT): Bool; {inline;}
  2644. const
  2645. LVNI_ALL = $0000;
  2646. LVNI_FOCUSED = $0001;
  2647. LVNI_SELECTED = $0002;
  2648. LVNI_CUT = $0004;
  2649. LVNI_DROPHILITED = $0008;
  2650. LVNI_ABOVE = $0100;
  2651. LVNI_BELOW = $0200;
  2652. LVNI_TOLEFT = $0400;
  2653. LVNI_TORIGHT = $0800;
  2654. const
  2655. LVM_GETNEXTITEM = LVM_FIRST + 12;
  2656. function ListView_GetNextItem(hWnd: HWND; iStart: Integer; Flags: UINT): Integer;
  2657. const
  2658. LVFI_PARAM = $0001;
  2659. LVFI_STRING = $0002;
  2660. LVFI_PARTIAL = $0008;
  2661. LVFI_WRAP = $0020;
  2662. LVFI_NEARESTXY = $0040;
  2663. type
  2664. PLVFindInfoA = ^TLVFindInfoA;
  2665. PLVFindInfoW = ^TLVFindInfoW;
  2666. PLVFindInfo = PLVFindInfoW;
  2667. tagLVFINDINFOA = record
  2668. flags: UINT;
  2669. psz: PAnsiChar;
  2670. lParam: LPARAM;
  2671. pt: TPoint;
  2672. vkDirection: UINT;
  2673. end;
  2674. tagLVFINDINFOW = record
  2675. flags: UINT;
  2676. psz: PWideChar;
  2677. lParam: LPARAM;
  2678. pt: TPoint;
  2679. vkDirection: UINT;
  2680. end;
  2681. tagLVFINDINFO = tagLVFINDINFOW;
  2682. _LV_FINDINFOA = tagLVFINDINFOA;
  2683. _LV_FINDINFOW = tagLVFINDINFOW;
  2684. _LV_FINDINFO = _LV_FINDINFOW;
  2685. TLVFindInfoA = tagLVFINDINFOA;
  2686. TLVFindInfoW = tagLVFINDINFOW;
  2687. TLVFindInfo = TLVFindInfoW;
  2688. LV_FINDINFOA = tagLVFINDINFOA;
  2689. LV_FINDINFOW = tagLVFINDINFOW;
  2690. LV_FINDINFO = LV_FINDINFOW;
  2691. const
  2692. LVM_FINDITEMA = LVM_FIRST + 13;
  2693. LVM_FINDITEMW = LVM_FIRST + 83;
  2694. {$IFDEF UNICODE}
  2695. LVM_FINDITEM = LVM_FINDITEMW;
  2696. {$ELSE}
  2697. LVM_FINDITEM = LVM_FINDITEMA;
  2698. {$ENDIF}
  2699. function ListView_FindItem(hWnd: HWND; iStart: Integer;
  2700. const plvfi: TLVFindInfo): Integer; {inline;}
  2701. function ListView_FindItemA(hWnd: HWND; iStart: Integer;
  2702. const plvfi: TLVFindInfoA): Integer; {inline;}
  2703. function ListView_FindItemW(hWnd: HWND; iStart: Integer;
  2704. const plvfi: TLVFindInfoW): Integer; {inline;}
  2705. const
  2706. LVIR_BOUNDS = 0;
  2707. LVIR_ICON = 1;
  2708. LVIR_LABEL = 2;
  2709. LVIR_SELECTBOUNDS = 3;
  2710. const
  2711. LVM_GETITEMRECT = LVM_FIRST + 14;
  2712. function ListView_GetItemRect(hWnd: HWND; i: Integer; var prc: TRect;
  2713. Code: Integer): Bool;
  2714. const
  2715. LVM_SETITEMPOSITION = LVM_FIRST + 15;
  2716. function ListView_SetItemPosition(hWnd: HWND; i, x, y: Integer): Bool;
  2717. const
  2718. LVM_GETITEMPOSITION = LVM_FIRST + 16;
  2719. function ListView_GetItemPosition(hwndLV: HWND; i: Integer; var ppt: TPoint): Bool; {inline;}
  2720. const
  2721. LVM_GETSTRINGWIDTHA = LVM_FIRST + 17;
  2722. LVM_GETSTRINGWIDTHW = LVM_FIRST + 87;
  2723. {$IFDEF UNICODE}
  2724. LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHW;
  2725. {$ELSE}
  2726. LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA;
  2727. {$ENDIF}
  2728. function ListView_GetStringWidth(hwndLV: HWND; psz: PWideChar): Integer; {inline;}
  2729. function ListView_GetStringWidthA(hwndLV: HWND; psz: PAnsiChar): Integer; {inline;}
  2730. function ListView_GetStringWidthW(hwndLV: HWND; psz: PWideChar): Integer; {inline;}
  2731. const
  2732. LVHT_NOWHERE = $0001;
  2733. LVHT_ONITEMICON = $0002;
  2734. LVHT_ONITEMLABEL = $0004;
  2735. LVHT_ONITEMSTATEICON = $0008;
  2736. LVHT_ONITEM = LVHT_ONITEMICON or LVHT_ONITEMLABEL or
  2737. LVHT_ONITEMSTATEICON;
  2738. LVHT_ABOVE = $0008;
  2739. LVHT_BELOW = $0010;
  2740. LVHT_TORIGHT = $0020;
  2741. LVHT_TOLEFT = $0040;
  2742. type
  2743. PLVHitTestInfo = ^TLVHitTestInfo;
  2744. tagLVHITTESTINFO = packed record
  2745. pt: TPoint;
  2746. flags: UINT;
  2747. iItem: Integer;
  2748. iSubItem: Integer; // this is was NOT in win95. valid only for LVM_SUBITEMHITTEST
  2749. { For Windows >= Vista }
  2750. //iGroup: Integer; // readonly. index of group. only valid for owner data.
  2751. // supports single item in multiple groups.
  2752. end;
  2753. TLVHitTestInfo = tagLVHITTESTINFO;
  2754. LV_HITTESTINFO = tagLVHITTESTINFO;
  2755. _LV_HITTESTINFO = tagLVHITTESTINFO;
  2756. const
  2757. LVM_HITTEST = LVM_FIRST + 18;
  2758. function ListView_HitTest(hwndLV: HWND; var pinfo: TLVHitTestInfo): Integer; {inline;}
  2759. const
  2760. LVM_ENSUREVISIBLE = LVM_FIRST + 19;
  2761. function ListView_EnsureVisible(hwndLV: HWND; i: Integer; fPartialOK: Bool): Bool;
  2762. const
  2763. LVM_SCROLL = LVM_FIRST + 20;
  2764. function ListView_Scroll(hwndLV: HWnd; DX, DY: Integer): Bool; {inline;}
  2765. const
  2766. LVM_REDRAWITEMS = LVM_FIRST + 21;
  2767. function ListView_RedrawItems(hwndLV: HWND; iFirst, iLast: Integer): Bool; {inline;}
  2768. const
  2769. LVA_DEFAULT = $0000;
  2770. LVA_ALIGNLEFT = $0001;
  2771. LVA_ALIGNTOP = $0002;
  2772. LVA_ALIGNRIGHT = $0003;
  2773. LVA_ALIGNBOTTOM = $0004;
  2774. LVA_SNAPTOGRID = $0005;
  2775. LVA_SORTASCENDING = $0100;
  2776. LVA_SORTDESCENDING = $0200;
  2777. LVM_ARRANGE = LVM_FIRST + 22;
  2778. function ListView_Arrange(hwndLV: HWND; Code: UINT): Bool; {inline;}
  2779. const
  2780. LVM_EDITLABELA = LVM_FIRST + 23;
  2781. LVM_EDITLABELW = LVM_FIRST + 118;
  2782. {$IFDEF UNICODE}
  2783. LVM_EDITLABEL = LVM_EDITLABELW;
  2784. {$ELSE}
  2785. LVM_EDITLABEL = LVM_EDITLABELA;
  2786. {$ENDIF}
  2787. function ListView_EditLabel(hwndLV: HWND; i: Integer): HWND; {inline;}
  2788. function ListView_EditLabelA(hwndLV: HWND; i: Integer): HWND; {inline;}
  2789. function ListView_EditLabelW(hwndLV: HWND; i: Integer): HWND; {inline;}
  2790. const
  2791. LVM_GETEDITCONTROL = LVM_FIRST + 24;
  2792. function ListView_GetEditControl(hwndLV: HWND): HWND; {inline;}
  2793. type
  2794. PLVColumnA = ^TLVColumnA;
  2795. PLVColumnW = ^TLVColumnW;
  2796. PLVColumn = PLVColumnW;
  2797. tagLVCOLUMNA = record
  2798. mask: UINT;
  2799. fmt: Integer;
  2800. cx: Integer;
  2801. pszText: PAnsiChar;
  2802. cchTextMax: Integer;
  2803. iSubItem: Integer;
  2804. iImage: Integer;
  2805. iOrder: Integer;
  2806. { For Windows >= Vista }
  2807. //cxMin: Integer; // min snap point
  2808. //cxDefault: Integer; // default snap point
  2809. //cxIdeal: Integer; // read only. ideal may not eqaul current width if auto sized (LVS_EX_AUTOSIZECOLUMNS) to a lesser width.
  2810. end;
  2811. tagLVCOLUMNW = record
  2812. mask: UINT;
  2813. fmt: Integer;
  2814. cx: Integer;
  2815. pszText: PWideChar;
  2816. cchTextMax: Integer;
  2817. iSubItem: Integer;
  2818. iImage: Integer;
  2819. iOrder: Integer;
  2820. { For Windows >= Vista }
  2821. //cxMin: Integer; // min snap point
  2822. //cxDefault: Integer; // default snap point
  2823. //cxIdeal: Integer; // read only. ideal may not eqaul current width if auto sized (LVS_EX_AUTOSIZECOLUMNS) to a lesser width.
  2824. end;
  2825. tagLVCOLUMN = tagLVCOLUMNW;
  2826. _LV_COLUMNA = tagLVCOLUMNA;
  2827. _LV_COLUMNW = tagLVCOLUMNW;
  2828. _LV_COLUMN = _LV_COLUMNW;
  2829. TLVColumnA = tagLVCOLUMNA;
  2830. TLVColumnW = tagLVCOLUMNW;
  2831. TLVColumn = TLVColumnW;
  2832. LV_COLUMNA = tagLVCOLUMNA;
  2833. LV_COLUMNW = tagLVCOLUMNW;
  2834. LV_COLUMN = LV_COLUMNW;
  2835. const
  2836. LVCF_FMT = $0001;
  2837. LVCF_WIDTH = $0002;
  2838. LVCF_TEXT = $0004;
  2839. LVCF_SUBITEM = $0008;
  2840. LVCF_IMAGE = $0010;
  2841. LVCF_ORDER = $0020;
  2842. { For Windows >= Vista }
  2843. LVCF_MINWIDTH = $0040;
  2844. LVCF_DEFAULTWIDTH = $0080;
  2845. LVCF_IDEALWIDTH = $0100;
  2846. // LVCFMT_ flags up to FFFF are shared with the header control (HDF_ flags).
  2847. // Flags above FFFF are listview-specific.
  2848. LVCFMT_LEFT = $0000;
  2849. LVCFMT_RIGHT = $0001;
  2850. LVCFMT_CENTER = $0002;
  2851. LVCFMT_JUSTIFYMASK = $0003;
  2852. LVCFMT_IMAGE = $0800;
  2853. LVCFMT_BITMAP_ON_RIGHT = $1000;
  2854. LVCFMT_COL_HAS_IMAGES = $8000;
  2855. { For Windows >= Vista }
  2856. LVCFMT_FIXED_WIDTH = $00100; // Can't resize the column; same as HDF_FIXEDWIDTH
  2857. LVCFMT_NO_DPI_SCALE = $40000; // If not set, CCM_DPISCALE will govern scaling up fixed width
  2858. LVCFMT_FIXED_RATIO = $80000; // Width will augment with the row height
  2859. { For Windows >= Vista }
  2860. // The following flags
  2861. LVCFMT_LINE_BREAK = $100000; // Move to the top of the next list of columns
  2862. LVCFMT_FILL = $200000; // Fill the remainder of the tile area. Might have a title.
  2863. LVCFMT_WRAP = $400000; // This sub-item can be wrapped.
  2864. LVCFMT_NO_TITLE = $800000; // This sub-item doesn't have an title.
  2865. LVCFMT_TILE_PLACEMENTMASK = LVCFMT_LINE_BREAK or LVCFMT_FILL;
  2866. { For Windows >= Vista }
  2867. LVCFMT_SPLITBUTTON = $1000000; // Column is a split button; same as HDF_SPLITBUTTON
  2868. LVM_GETCOLUMNA = LVM_FIRST + 25;
  2869. LVM_GETCOLUMNW = LVM_FIRST + 95;
  2870. {$IFDEF UNICODE}
  2871. LVM_GETCOLUMN = LVM_GETCOLUMNW;
  2872. {$ELSE}
  2873. LVM_GETCOLUMN = LVM_GETCOLUMNA;
  2874. {$ENDIF}
  2875. function ListView_GetColumn(hwnd: HWND; iCol: Integer;
  2876. var pcol: TLVColumn): Bool; {inline;}
  2877. function ListView_GetColumnA(hwnd: HWND; iCol: Integer;
  2878. var pcol: TLVColumnA): Bool; {inline;}
  2879. function ListView_GetColumnW(hwnd: HWND; iCol: Integer;
  2880. var pcol: TLVColumnW): Bool; {inline;}
  2881. const
  2882. LVM_SETCOLUMNA = LVM_FIRST + 26;
  2883. LVM_SETCOLUMNW = LVM_FIRST + 96;
  2884. {$IFDEF UNICODE}
  2885. LVM_SETCOLUMN = LVM_SETCOLUMNW;
  2886. {$ELSE}
  2887. LVM_SETCOLUMN = LVM_SETCOLUMNA;
  2888. {$ENDIF}
  2889. function ListView_SetColumn(hwnd: HWnd; iCol: Integer; const pcol: TLVColumn): Bool; {inline;}
  2890. function ListView_SetColumnA(hwnd: HWnd; iCol: Integer; const pcol: TLVColumnA): Bool; {inline;}
  2891. function ListView_SetColumnW(hwnd: HWnd; iCol: Integer; const pcol: TLVColumnW): Bool; {inline;}
  2892. const
  2893. LVM_INSERTCOLUMNA = LVM_FIRST + 27;
  2894. LVM_INSERTCOLUMNW = LVM_FIRST + 97;
  2895. {$IFDEF UNICODE}
  2896. LVM_INSERTCOLUMN = LVM_INSERTCOLUMNW;
  2897. {$ELSE}
  2898. LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA;
  2899. {$ENDIF}
  2900. function ListView_InsertColumn(hwnd: HWND; iCol: Integer;
  2901. const pcol: TLVColumn): Integer; {inline;}
  2902. function ListView_InsertColumnA(hwnd: HWND; iCol: Integer;
  2903. const pcol: TLVColumnA): Integer; {inline;}
  2904. function ListView_InsertColumnW(hwnd: HWND; iCol: Integer;
  2905. const pcol: TLVColumnW): Integer; {inline;}
  2906. const
  2907. LVM_DELETECOLUMN = LVM_FIRST + 28;
  2908. function ListView_DeleteColumn(hwnd: HWND; iCol: Integer): Bool; {inline;}
  2909. const
  2910. LVM_GETCOLUMNWIDTH = LVM_FIRST + 29;
  2911. function ListView_GetColumnWidth(hwnd: HWND; iCol: Integer): Integer; {inline;}
  2912. const
  2913. LVSCW_AUTOSIZE = -1;
  2914. LVSCW_AUTOSIZE_USEHEADER = -2;
  2915. LVM_SETCOLUMNWIDTH = LVM_FIRST + 30;
  2916. function ListView_SetColumnWidth(hwnd: HWnd; iCol: Integer; cx: Integer): Bool;
  2917. const
  2918. LVM_GETHEADER = LVM_FIRST + 31;
  2919. function ListView_GetHeader(hwnd: HWND): HWND;
  2920. const
  2921. LVM_CREATEDRAGIMAGE = LVM_FIRST + 33;
  2922. function ListView_CreateDragImage(hwnd: HWND; i: Integer;
  2923. const lpptUpLeft: TPoint): HIMAGELIST; {inline;}
  2924. const
  2925. LVM_GETVIEWRECT = LVM_FIRST + 34;
  2926. function ListView_GetViewRect(hwnd: HWND; var prc: TRect): Bool; {inline;}
  2927. const
  2928. LVM_GETTEXTCOLOR = LVM_FIRST + 35;
  2929. function ListView_GetTextColor(hwnd: HWND): TColorRef; {inline;}
  2930. const
  2931. LVM_SETTEXTCOLOR = LVM_FIRST + 36;
  2932. function ListView_SetTextColor(hwnd: HWND; clrText: TColorRef): Bool; {inline;}
  2933. const
  2934. LVM_GETTEXTBKCOLOR = LVM_FIRST + 37;
  2935. function ListView_GetTextBkColor(hwnd: HWND): TColorRef; {inline;}
  2936. const
  2937. LVM_SETTEXTBKCOLOR = LVM_FIRST + 38;
  2938. function ListView_SetTextBkColor(hwnd: HWND; clrTextBk: TColorRef): Bool; {inline;}
  2939. const
  2940. LVM_GETTOPINDEX = LVM_FIRST + 39;
  2941. function ListView_GetTopIndex(hwndLV: HWND): Integer; {inline;}
  2942. const
  2943. LVM_GETCOUNTPERPAGE = LVM_FIRST + 40;
  2944. function ListView_GetCountPerPage(hwndLV: HWND): Integer; {inline;}
  2945. const
  2946. LVM_GETORIGIN = LVM_FIRST + 41;
  2947. function ListView_GetOrigin(hwndLV: HWND; var ppt: TPoint): Bool; {inline;}
  2948. const
  2949. LVM_UPDATE = LVM_FIRST + 42;
  2950. function ListView_Update(hwndLV: HWND; i: Integer): Bool; {inline;}
  2951. const
  2952. LVM_SETITEMSTATE = LVM_FIRST + 43;
  2953. function ListView_SetItemState(hwndLV: HWND; i: Integer; data, mask: UINT): Bool;
  2954. const
  2955. LVM_GETITEMSTATE = LVM_FIRST + 44;
  2956. function ListView_GetItemState(hwndLV: HWND; i, mask: Integer): Integer; {inline;}
  2957. function ListView_GetCheckState(hwndLV: HWND; i: Integer): UINT; {inline;}
  2958. procedure ListView_SetCheckState(hwndLV: HWND; i: Integer; Checked: Boolean);
  2959. const
  2960. LVM_GETITEMTEXTA = LVM_FIRST + 45;
  2961. LVM_GETITEMTEXTW = LVM_FIRST + 115;
  2962. {$IFDEF UNICODE}
  2963. LVM_GETITEMTEXT = LVM_GETITEMTEXTW;
  2964. {$ELSE}
  2965. LVM_GETITEMTEXT = LVM_GETITEMTEXTA;
  2966. {$ENDIF}
  2967. function ListView_GetItemText(hwndLV: HWND; i, iSubItem: Integer;
  2968. pszText: PWideChar; cchTextMax: Integer): Integer;
  2969. function ListView_GetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  2970. pszText: PAnsiChar; cchTextMax: Integer): Integer;
  2971. function ListView_GetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  2972. pszText: PWideChar; cchTextMax: Integer): Integer;
  2973. const
  2974. LVM_SETITEMTEXTA = LVM_FIRST + 46;
  2975. LVM_SETITEMTEXTW = LVM_FIRST + 116;
  2976. {$IFDEF UNICODE}
  2977. LVM_SETITEMTEXT = LVM_SETITEMTEXTW;
  2978. {$ELSE}
  2979. LVM_SETITEMTEXT = LVM_SETITEMTEXTA;
  2980. {$ENDIF}
  2981. function ListView_SetItemText(hwndLV: HWND; i, iSubItem: Integer;
  2982. pszText: PWideChar): Bool;
  2983. function ListView_SetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  2984. pszText: PAnsiChar): Bool;
  2985. function ListView_SetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  2986. pszText: PWideChar): Bool;
  2987. const
  2988. // these flags only apply to LVS_OWNERDATA listviews in report or list mode
  2989. LVSICF_NOINVALIDATEALL = $00000001;
  2990. LVSICF_NOSCROLL = $00000002;
  2991. LVM_SETITEMCOUNT = LVM_FIRST + 47;
  2992. procedure ListView_SetItemCount(hwndLV: HWND; cItems: Integer); {inline;}
  2993. procedure ListView_SetItemCountEx(hwndLV: HWND; cItems: Integer; dwFlags: DWORD); {inline;}
  2994. type
  2995. PFNLVCOMPARE = function(lParam1, lParam2, lParamSort: Integer): Integer stdcall;
  2996. TLVCompare = PFNLVCOMPARE;
  2997. const
  2998. LVM_SORTITEMS = LVM_FIRST + 48;
  2999. function ListView_SortItems(hwndLV: HWND; pfnCompare: TLVCompare;
  3000. lPrm: Longint): Bool; {inline;}
  3001. const
  3002. LVM_SETITEMPOSITION32 = LVM_FIRST + 49;
  3003. procedure ListView_SetItemPosition32(hwndLV: HWND; i, x, y: Integer);
  3004. const
  3005. LVM_GETSELECTEDCOUNT = LVM_FIRST + 50;
  3006. function ListView_GetSelectedCount(hwndLV: HWND): UINT; {inline;}
  3007. const
  3008. LVM_GETITEMSPACING = LVM_FIRST + 51;
  3009. function ListView_GetItemSpacing(hwndLV: HWND; fSmall: Integer): Longint; {inline;}
  3010. const
  3011. LVM_GETISEARCHSTRINGA = LVM_FIRST + 52;
  3012. LVM_GETISEARCHSTRINGW = LVM_FIRST + 117;
  3013. {$IFDEF UNICODE}
  3014. LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGW;
  3015. {$ELSE}
  3016. LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA;
  3017. {$ENDIF}
  3018. function ListView_GetISearchString(hwndLV: HWND; lpsz: PWideChar): Bool; {inline;}
  3019. function ListView_GetISearchStringA(hwndLV: HWND; lpsz: PAnsiChar): Bool; {inline;}
  3020. function ListView_GetISearchStringW(hwndLV: HWND; lpsz: PWideChar): Bool; {inline;}
  3021. const
  3022. LVM_SETICONSPACING = LVM_FIRST + 53;
  3023. // -1 for cx and cy means we'll use the default (system settings)
  3024. // 0 for cx or cy means use the current setting (allows you to change just one param)
  3025. function ListView_SetIconSpacing(hwndLV: HWND; cx, cy: Word): DWORD;
  3026. const
  3027. LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
  3028. function ListView_SetExtendedListViewStyle(hwndLV: HWND; dw: DWORD): BOOL; {inline;}
  3029. const
  3030. LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55;
  3031. function ListView_GetExtendedListViewStyle(hwndLV: HWND): DWORD; {inline;}
  3032. const
  3033. LVM_GETSUBITEMRECT = LVM_FIRST + 56;
  3034. function ListView_GetSubItemRect(hwndLV: HWND; iItem, iSubItem: Integer;
  3035. code: DWORD; prc: PRect): BOOL;
  3036. const
  3037. LVM_SUBITEMHITTEST = LVM_FIRST + 57;
  3038. function ListView_SubItemHitTest(hwndLV: HWND; plvhti: PLVHitTestInfo): Integer; {inline;}
  3039. const
  3040. LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58;
  3041. function ListView_SetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  3042. pi: PInteger): BOOL; {inline;}
  3043. const
  3044. LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59;
  3045. function ListView_GetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  3046. pi: PInteger): BOOL; {inline;}
  3047. const
  3048. LVM_SETHOTITEM = LVM_FIRST + 60;
  3049. function ListView_SetHotItem(hwndLV: HWND; i: Integer): Integer; {inline;}
  3050. const
  3051. LVM_GETHOTITEM = LVM_FIRST + 61;
  3052. function ListView_GetHotItem(hwndLV: HWND): Integer; {inline;}
  3053. const
  3054. LVM_SETHOTCURSOR = LVM_FIRST + 62;
  3055. function ListView_SetHotCursor(hwndLV: HWND; hcur: HCURSOR): HCURSOR; {inline;}
  3056. const
  3057. LVM_GETHOTCURSOR = LVM_FIRST + 63;
  3058. function ListView_GetHotCursor(hwndLV: HWND): HCURSOR; {inline;}
  3059. const
  3060. LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64;
  3061. function ListView_ApproximateViewRect(hwndLV: HWND; iWidth, iHeight: Word;
  3062. iCount: Integer): DWORD;
  3063. const
  3064. LV_MAX_WORKAREAS = 16;
  3065. LVM_SETWORKAREA = LVM_FIRST + 65;
  3066. function ListView_SetWorkAreas(hwndLV: HWND; nWorkAreas: Integer; prc: PRect): BOOL; {inline;}
  3067. const
  3068. LVM_GETSELECTIONMARK = LVM_FIRST + 66;
  3069. function ListView_GetSelectionMark(hwnd: HWND): Integer; {inline;}
  3070. const
  3071. LVM_SETSELECTIONMARK = LVM_FIRST + 67;
  3072. function ListView_SetSelectionMark(hwnd: HWND; i: Integer): Integer; {inline;}
  3073. const
  3074. LVM_GETWORKAREAS = LVM_FIRST + 70;
  3075. function ListView_GetWorkAreas(hwnd: HWND; nWorkAreas: Integer; prc: PRect): BOOL; {inline;}
  3076. const
  3077. LVM_SETHOVERTIME = LVM_FIRST + 71;
  3078. function ListView_SetHoverTime(hwndLV: HWND; dwHoverTimeMs: DWORD): DWORD; {inline;}
  3079. const
  3080. LVM_GETHOVERTIME = LVM_FIRST + 72;
  3081. function ListView_GetHoverTime(hwndLV: HWND): Integer; {inline;}
  3082. const
  3083. LVM_GETNUMBEROFWORKAREAS = LVM_FIRST + 73;
  3084. function ListView_GetNumberOfWorkAreas(hwnd: HWND; pnWorkAreas: PInteger): Integer; {inline;}
  3085. const
  3086. LVM_SETTOOLTIPS = LVM_FIRST + 74;
  3087. function ListView_SetToolTips(hwndLV: HWND; hwndNewHwnd: HWND): HWND; {inline;}
  3088. const
  3089. LVM_GETTOOLTIPS = LVM_FIRST + 78;
  3090. function ListView_GetToolTips(hwndLV: HWND): HWND; {inline;}
  3091. type
  3092. tagLVBKIMAGEA = record
  3093. ulFlags: ULONG; // LVBKIF_*
  3094. hbm: HBITMAP;
  3095. pszImage: PAnsiChar;
  3096. cchImageMax: UINT;
  3097. xOffsetPercent: Integer;
  3098. yOffsetPercent: Integer;
  3099. end;
  3100. tagLVBKIMAGEW = record
  3101. ulFlags: ULONG; // LVBKIF_*
  3102. hbm: HBITMAP;
  3103. pszImage: PWideChar;
  3104. cchImageMax: UINT;
  3105. xOffsetPercent: Integer;
  3106. yOffsetPercent: Integer;
  3107. end;
  3108. tagLVBKIMAGE = tagLVBKIMAGEW;
  3109. PLVBKImageA = ^TLVBKImageA;
  3110. PLVBKImageW = ^TLVBKImageW;
  3111. PLVBKImage = PLVBKImageW;
  3112. TLVBKImageA = tagLVBKIMAGEA;
  3113. TLVBKImageW = tagLVBKIMAGEW;
  3114. TLVBKImage = TLVBKImageW;
  3115. const
  3116. LVBKIF_SOURCE_NONE = $00000000;
  3117. LVBKIF_SOURCE_HBITMAP = $00000001;
  3118. LVBKIF_SOURCE_URL = $00000002;
  3119. LVBKIF_SOURCE_MASK = $00000003;
  3120. LVBKIF_STYLE_NORMAL = $00000000;
  3121. LVBKIF_STYLE_TILE = $00000010;
  3122. LVBKIF_STYLE_MASK = $00000010;
  3123. { For Windows >= XP }
  3124. LVBKIF_FLAG_TILEOFFSET = $00000100;
  3125. LVBKIF_TYPE_WATERMARK = $10000000;
  3126. LVBKIF_FLAG_ALPHABLEND = $20000000;
  3127. LVM_SETBKIMAGEA = LVM_FIRST + 68;
  3128. LVM_SETBKIMAGEW = LVM_FIRST + 138;
  3129. LVM_GETBKIMAGEA = LVM_FIRST + 69;
  3130. LVM_GETBKIMAGEW = LVM_FIRST + 139;
  3131. { For Windows >= XP }
  3132. LVM_SETSELECTEDCOLUMN = LVM_FIRST + 140;
  3133. LVM_SETVIEW = LVM_FIRST + 142;
  3134. LVM_GETVIEW = LVM_FIRST + 143;
  3135. { For Windows >= XP }
  3136. function ListView_SetSelectedColumn(hwnd: HWND; iCol: Integer): Integer; {inline;}
  3137. function ListView_SetView(hwnd: HWND; iView: Integer): Integer; {inline;}
  3138. function ListView_GetView(hwnd: HWND): Integer; {inline;}
  3139. const
  3140. { For Windows >= XP }
  3141. LV_VIEW_ICON = $0000;
  3142. LV_VIEW_DETAILS = $0001;
  3143. LV_VIEW_SMALLICON = $0002;
  3144. LV_VIEW_LIST = $0003;
  3145. LV_VIEW_TILE = $0004;
  3146. LV_VIEW_MAX = $0004;
  3147. { For Windows >= XP }
  3148. LVGF_NONE = $00000000;
  3149. LVGF_HEADER = $00000001;
  3150. LVGF_FOOTER = $00000002;
  3151. LVGF_STATE = $00000004;
  3152. LVGF_ALIGN = $00000008;
  3153. LVGF_GROUPID = $00000010;
  3154. { For Windows >= Vista }
  3155. LVGF_SUBTITLE = $00000100; { pszSubtitle is valid }
  3156. LVGF_TASK = $00000200; { pszTask is valid }
  3157. LVGF_DESCRIPTIONTOP = $00000400; { pszDescriptionTop is valid }
  3158. LVGF_DESCRIPTIONBOTTOM = $00000800; { pszDescriptionBottom is valid }
  3159. LVGF_TITLEIMAGE = $00001000; { iTitleImage is valid }
  3160. LVGF_EXTENDEDIMAGE = $00002000; { iExtendedImage is valid }
  3161. LVGF_ITEMS = $00004000; { iFirstItem and cItems are valid }
  3162. LVGF_SUBSET = $00008000; { pszSubsetTitle is valid }
  3163. LVGF_SUBSETITEMS = $00010000; { readonly, cItems holds count of items in visible subset, iFirstItem is valid }
  3164. { For Windows >= XP }
  3165. LVGS_NORMAL = $00000000;
  3166. LVGS_COLLAPSED = $00000001;
  3167. LVGS_HIDDEN = $00000002;
  3168. LVGS_NOHEADER = $00000004;
  3169. LVGS_COLLAPSIBLE = $00000008;
  3170. LVGS_FOCUSED = $00000010;
  3171. LVGS_SELECTED = $00000020;
  3172. LVGS_SUBSETED = $00000040;
  3173. LVGS_SUBSETLINKFOCUSED = $00000080;
  3174. { For Windows >= XP }
  3175. LVGA_HEADER_LEFT = $00000001;
  3176. LVGA_HEADER_CENTER = $00000002;
  3177. LVGA_HEADER_RIGHT = $00000004; { Don't forget to validate exclusivity }
  3178. LVGA_FOOTER_LEFT = $00000008;
  3179. LVGA_FOOTER_CENTER = $00000010;
  3180. LVGA_FOOTER_RIGHT = $00000020; { Don't forget to validate exclusivity }
  3181. type
  3182. { For Windows >= XP }
  3183. { $EXTERNALSYM tagLVGROUP}
  3184. tagLVGROUP = record
  3185. cbSize: UINT;
  3186. mask: UINT;
  3187. pszHeader: LPWSTR;
  3188. cchHeader: Integer;
  3189. pszFooter: LPWSTR;
  3190. cchFooter: Integer;
  3191. iGroupId: Integer;
  3192. stateMask: UINT;
  3193. state: UINT;
  3194. uAlign: UINT;
  3195. pszSubtitle: LPWSTR;
  3196. cchSubtitle: UINT;
  3197. pszTask: LPWSTR;
  3198. cchTask: UINT;
  3199. pszDescriptionTop: LPWSTR;
  3200. cchDescriptionTop: UINT;
  3201. pszDescriptionBottom: LPWSTR;
  3202. cchDescriptionBottom: UINT;
  3203. iTitleImage: Integer;
  3204. iExtendedImage: Integer;
  3205. iFirstItem: Integer; { Read only }
  3206. cItems: UINT; { Read only }
  3207. pszSubsetTitle: LPWSTR; { NULL if group is not subset }
  3208. cchSubsetTitle: UINT;
  3209. end;
  3210. PLVGroup = ^TLVGroup;
  3211. TLVGroup = tagLVGROUP;
  3212. const
  3213. { For Windows >= XP }
  3214. LVM_INSERTGROUP = LVM_FIRST + 145;
  3215. LVM_SETGROUPINFO = LVM_FIRST + 147;
  3216. LVM_GETGROUPINFO = LVM_FIRST + 149;
  3217. LVM_REMOVEGROUP = LVM_FIRST + 150;
  3218. LVM_MOVEGROUP = LVM_FIRST + 151;
  3219. { For Windows >= Vista }
  3220. LVM_GETGROUPCOUNT = LVM_FIRST + 152;
  3221. LVM_GETGROUPINFOBYINDEX = LVM_FIRST + 153;
  3222. LVM_MOVEITEMTOGROUP = LVM_FIRST + 154;
  3223. { For Windows >= XP }
  3224. function ListView_InsertGroup(hwnd: HWND; index: Integer; const pgrp: TLVGroup): Integer; {inline;}
  3225. function ListView_SetGroupInfo(hwnd: HWND; iGroupId: Integer; const pgrp: TLVGroup): Integer; {inline;}
  3226. function ListView_GetGroupInfo(hwnd: HWND; iGroupId: Integer; var pgrp: TLVGroup): Integer; {inline;}
  3227. function ListView_RemoveGroup(hwnd: HWND; iGroupId: Integer): Integer; {inline;}
  3228. function ListView_MoveGroup(hwnd: HWND; iGroupId, toIndex: Integer): Integer; {inline;}
  3229. { For Windows >= Vista }
  3230. function ListView_GetGroupCount(hwnd: HWND): Integer; {inline;}
  3231. function ListView_GetGroupInfoByIndex(hwnd: HWND; iIndex: Integer; var pgrp: TLVGroup): Integer; {inline;}
  3232. function ListView_MoveItemToGroup(hwnd: HWND; idItemFrom, idGroupTo: Integer): Integer; {inline;}
  3233. const
  3234. { For Windows >= Vista }
  3235. LVGGR_GROUP = 0; // Entire expanded group
  3236. LVGGR_HEADER = 1; // Header only (collapsed group)
  3237. LVGGR_LABEL = 2; // Label only
  3238. LVGGR_SUBSETLINK = 3; // subset link only
  3239. { For Windows >= Vista }
  3240. LVM_GETGROUPRECT = LVM_FIRST + 98;
  3241. { For Windows >= Vista }
  3242. function ListView_GetGroupRect(hwnd: HWND; iGroupId, iType: Integer;
  3243. var prc: TRect): Integer; {inline;}
  3244. const
  3245. { For Windows >= XP }
  3246. LVGMF_NONE = $00000000;
  3247. LVGMF_BORDERSIZE = $00000001;
  3248. LVGMF_BORDERCOLOR = $00000002;
  3249. LVGMF_TEXTCOLOR = $00000004;
  3250. type
  3251. { For Windows >= XP }
  3252. { $EXTERNALSYM tagLVGROUPMETRICS}
  3253. tagLVGROUPMETRICS = packed record
  3254. cbSize: UINT;
  3255. mask: UINT;
  3256. Left: UINT;
  3257. Top: UINT;
  3258. Right: UINT;
  3259. Bottom: UINT;
  3260. crLeft: COLORREF;
  3261. crTop: COLORREF;
  3262. crRight: COLORREF;
  3263. crBottom: COLORREF;
  3264. crHeader: COLORREF;
  3265. crFooter: COLORREF;
  3266. end;
  3267. PLVGroupMetrics = ^TLVGroupMetrics;
  3268. TLVGroupMetrics = tagLVGROUPMETRICS;
  3269. const
  3270. { For Windows >= XP }
  3271. LVM_SETGROUPMETRICS = LVM_FIRST + 155;
  3272. LVM_GETGROUPMETRICS = LVM_FIRST + 156;
  3273. LVM_ENABLEGROUPVIEW = LVM_FIRST + 157;
  3274. LVM_SORTGROUPS = LVM_FIRST + 158;
  3275. type
  3276. { For Windows >= XP }
  3277. { $EXTERNALSYM PFNLVGROUPCOMPARE}
  3278. PFNLVGROUPCOMPARE = function(Group1_ID: Integer; Group2_ID: Integer;
  3279. pvData: Pointer): Integer; stdcall;
  3280. TFNLVGroupCompare = PFNLVGROUPCOMPARE;
  3281. { For Windows >= XP }
  3282. function ListView_SetGroupMetrics(hwnd: HWND; const pGroupMetrics: TLVGroupMetrics): Integer; {inline;}
  3283. function ListView_GetGroupMetrics(hwnd: HWND; var pGroupMetrics: TLVGroupMetrics): Integer; {inline;}
  3284. function ListView_EnableGroupView(hwnd: HWND; fEnable: BOOL): Integer; {inline;}
  3285. function ListView_SortGroups(hwnd: HWND; pfnGroupCompare: TFNLVGroupCompare; plv: Pointer): Integer; {inline;}
  3286. type
  3287. { For Windows >= XP }
  3288. { $EXTERNALSYM tagLVINSERTGROUPSORTED}
  3289. tagLVINSERTGROUPSORTED = record
  3290. pfnGroupCompare: PFNLVGROUPCOMPARE;
  3291. pvData: Pointer;
  3292. lvGroup: TLVGroup;
  3293. end;
  3294. PLVInsertGroupSorted = ^TLVInsertGroupSorted;
  3295. TLVInsertGroupSorted = tagLVINSERTGROUPSORTED;
  3296. const
  3297. { For Windows >= XP }
  3298. LVM_INSERTGROUPSORTED = LVM_FIRST + 159;
  3299. LVM_REMOVEALLGROUPS = LVM_FIRST + 160;
  3300. LVM_HASGROUP = LVM_FIRST + 161;
  3301. { For Windows >= Vista }
  3302. LVM_GETGROUPSTATE = LVM_FIRST + 92;
  3303. LVM_GETFOCUSEDGROUP = LVM_FIRST + 93;
  3304. { For Windows >= XP }
  3305. function ListView_InsertGroupSorted(hwnd: HWND; const structInsert: TLVInsertGroupSorted): Integer; {inline;}
  3306. function ListView_RemoveAllGroups(hwnd: HWND): Integer; {inline;}
  3307. function ListView_HasGroup(hwnd: HWND; dwGroupId: Integer): Integer; {inline;}
  3308. { For Windows >= Vista }
  3309. function ListView_SetGroupState(hwnd: HWND; dwGroupId, dwMask, dwState: UINT): Integer;
  3310. function ListView_GetGroupState(hwnd: HWND; dwGroupId, dwMask: UINT): Integer; {inline;}
  3311. function ListView_GetFocusedGroup(hwnd: HWND): Integer; {inline;}
  3312. const
  3313. { For Windows >= XP }
  3314. LVTVIF_AUTOSIZE = $00000000;
  3315. LVTVIF_FIXEDWIDTH = $00000001;
  3316. LVTVIF_FIXEDHEIGHT = $00000002;
  3317. LVTVIF_FIXEDSIZE = $00000003;
  3318. { For Windows >= Vista }
  3319. LVTVIF_EXTENDED = $00000004;
  3320. { For Windows >= XP }
  3321. LVTVIM_TILESIZE = $00000001;
  3322. LVTVIM_COLUMNS = $00000002;
  3323. LVTVIM_LABELMARGIN = $00000004;
  3324. type
  3325. { For Windows >= XP }
  3326. { $EXTERNALSYM tagLVTILEVIEWINFO}
  3327. tagLVTILEVIEWINFO = packed record
  3328. cbSize: UINT;
  3329. dwMask: DWORD; // LVTVIM_*
  3330. dwFlags: DWORD; // LVTVIF_*
  3331. sizeTile: SIZE;
  3332. cLines: Integer;
  3333. rcLabelMargin: TRect;
  3334. end;
  3335. PLVTileViewInfo = ^TLVTileViewInfo;
  3336. TLVTileViewInfo = tagLVTILEVIEWINFO;
  3337. { For Windows >= XP }
  3338. { $EXTERNALSYM tagLVTILEINFO}
  3339. tagLVTILEINFO = packed record
  3340. cbSize: UINT;
  3341. iItem: Integer;
  3342. cColumns: UINT;
  3343. puColumns: PUINT;
  3344. { For Windows >= Vista }
  3345. //piColFmt: PInteger;
  3346. end;
  3347. PLVTileInfo = ^TLVTileInfo;
  3348. TLVTileInfo = tagLVTILEINFO;
  3349. const
  3350. // LVTILEINFO_V5_SIZE = CCSIZEOF_STRUCT(LVTILEINFO, puColumns);
  3351. { For Windows >= XP }
  3352. LVM_SETTILEVIEWINFO = LVM_FIRST + 162;
  3353. LVM_GETTILEVIEWINFO = LVM_FIRST + 163;
  3354. LVM_SETTILEINFO = LVM_FIRST + 164;
  3355. LVM_GETTILEINFO = LVM_FIRST + 165;
  3356. { For Windows >= XP }
  3357. function ListView_SetTileViewInfo(hwnd: HWND; const ptvi: TLVTileViewInfo): Integer; {inline;}
  3358. function ListView_GetTileViewInfo(hwnd: HWND; var ptvi: TLVTileViewInfo): Integer; {inline;}
  3359. function ListView_SetTileInfo(hwnd: HWND; const pti: TLVTileInfo): Integer; {inline;}
  3360. function ListView_GetTileInfo(hwnd: HWND; var pti: TLVTileInfo): Integer; {inline;}
  3361. type
  3362. { For Windows >= XP }
  3363. { $EXTERNALSYM tagLVINSERTMARK}
  3364. tagLVINSERTMARK = packed record
  3365. cbSize: UINT;
  3366. dwFlags: DWORD;
  3367. iItem: Integer;
  3368. dwReserved: DWORD;
  3369. end;
  3370. PLVInsertMark = ^TLVInsertMark;
  3371. TLVInsertMark = tagLVINSERTMARK;
  3372. const
  3373. { For Windows >= XP }
  3374. LVIM_AFTER = $00000001; // TRUE = insert After iItem, otherwise before
  3375. { For Windows >= XP }
  3376. LVM_SETINSERTMARK = LVM_FIRST + 166;
  3377. LVM_GETINSERTMARK = LVM_FIRST + 167;
  3378. LVM_INSERTMARKHITTEST = LVM_FIRST + 168;
  3379. LVM_GETINSERTMARKRECT = LVM_FIRST + 169;
  3380. LVM_SETINSERTMARKCOLOR = LVM_FIRST + 170;
  3381. LVM_GETINSERTMARKCOLOR = LVM_FIRST + 171;
  3382. { For Windows >= XP }
  3383. function ListView_SetInsertMark(hwnd: HWND; const lvim: TLVInsertMark): BOOL; {inline;}
  3384. function ListView_GetInsertMark(hwnd: HWND; var lvim: TLVInsertMark): BOOL; {inline;}
  3385. function ListView_InsertMarkHitTest(hwnd: HWND; const point: TPoint;
  3386. const lvim: TLVInsertMark): Integer; {inline;}
  3387. function ListView_GetInsertMarkRect(hwnd: HWND; var rc: TRect): Integer; {inline;}
  3388. function ListView_SetInsertMarkColor(hwnd: HWND; color: TColorRef): TColorRef; {inline;}
  3389. function ListView_GetInsertMarkColor(hwnd: HWND): TColorRef; {inline;}
  3390. type
  3391. { For Windows >= XP }
  3392. { $EXTERNALSYM tagLVSETINFOTIP}
  3393. tagLVSETINFOTIP = record
  3394. cbSize: UINT;
  3395. dwFlags: DWORD;
  3396. pszText: LPWSTR;
  3397. iItem: Integer;
  3398. iSubItem: Integer;
  3399. end;
  3400. PLVSetInfoTip = ^TLVSetInfoTip;
  3401. TLVSetInfoTip = tagLVSETINFOTIP;
  3402. const
  3403. { For Windows >= XP }
  3404. LVM_SETINFOTIP = LVM_FIRST + 173;
  3405. LVM_GETSELECTEDCOLUMN = LVM_FIRST + 174;
  3406. LVM_ISGROUPVIEWENABLED = LVM_FIRST + 175;
  3407. LVM_GETOUTLINECOLOR = LVM_FIRST + 176;
  3408. LVM_SETOUTLINECOLOR = LVM_FIRST + 177;
  3409. LVM_CANCELEDITLABEL = LVM_FIRST + 179;
  3410. LVM_MAPINDEXTOID = LVM_FIRST + 180;
  3411. LVM_MAPIDTOINDEX = LVM_FIRST + 181;
  3412. { For Windows >= Vista }
  3413. LVM_ISITEMVISIBLE = LVM_FIRST + 182;
  3414. { For Windows >= XP }
  3415. function ListView_SetInfoTip(hwndLV: HWND; const plvInfoTip: TLVSetInfoTip): BOOL; {inline;}
  3416. function ListView_GetSelectedColumn(hwnd: HWND): UINT; {inline;}
  3417. function ListView_IsGroupViewEnabled(hwnd: HWND): BOOL; {inline;}
  3418. function ListView_GetOutlineColor(hwnd: HWND): TColorRef; {inline;}
  3419. function ListView_SetOutlineColor(hwnd: HWND; color: TColorRef): TColorRef; {inline;}
  3420. function ListView_CancelEditLabel(hwnd: HWND): Integer; {inline;}
  3421. // These next two methods make it easy to identify an item that can be repositioned
  3422. // within listview. For example: Many developers use the lParam to store an identifier that is
  3423. // unique. Unfortunatly, in order to find this item, they have to iterate through all of the items
  3424. // in the listview. Listview will maintain a unique identifier. The upper bound is the size of a DWORD.
  3425. function ListView_MapIndexToID(hwnd: HWND; index: UINT): UINT; {inline;}
  3426. function ListView_MapIDToIndex(hwnd: HWND; id: UINT): UINT; {inline;}
  3427. { For Windows >= Vista }
  3428. function ListView_IsItemVisible(hwnd: HWND; index: UINT): UINT; {inline;}
  3429. function ListView_SetGroupHeaderImageList(hwnd: HWND; himl: HIMAGELIST): HIMAGELIST; {inline;}
  3430. function ListView_GetGroupHeaderImageList(hwnd: HWND): HIMAGELIST; {inline;}
  3431. const
  3432. { For Windows >= Vista }
  3433. LVM_GETEMPTYTEXT = LVM_FIRST + 204;
  3434. LVM_GETFOOTERRECT = LVM_FIRST + 205;
  3435. { For Windows >= Vista }
  3436. function ListView_GetEmptyText(hwnd: HWND; pszText: LPWSTR; cchText: UINT): BOOL; {inline;}
  3437. function ListView_GetFooterRect(hwnd: HWND; var prc: TRect): BOOL; {inline;}
  3438. const
  3439. // footer flags
  3440. { For Windows >= Vista }
  3441. LVFF_ITEMCOUNT = $00000001;
  3442. type
  3443. { For Windows >= Vista }
  3444. { $EXTERNALSYM tagLVFOOTERINFO}
  3445. tagLVFOOTERINFO = record
  3446. mask: UINT; // LVFF_*
  3447. pszText: LPWSTR;
  3448. cchTextMax: Integer;
  3449. cItems: UINT;
  3450. end;
  3451. PLVFooterInfo = ^TLVFooterInfo;
  3452. TLVFooterInfo = tagLVFOOTERINFO;
  3453. const
  3454. { For Windows >= Vista }
  3455. LVM_GETFOOTERINFO = LVM_FIRST + 206;
  3456. LVM_GETFOOTERITEMRECT = LVM_FIRST + 207;
  3457. { For Windows >= Vista }
  3458. function ListView_GetFooterInfo(hwnd: HWND; var plvfi: TLVFooterInfo): BOOL; {inline;}
  3459. function ListView_GetFooterItemRect(hwnd: HWND; iItem: UINT; var prc: TRect): BOOL; {inline;}
  3460. const
  3461. { For Windows >= Vista }
  3462. // footer item flags
  3463. LVFIF_TEXT = $00000001;
  3464. LVFIF_STATE = $00000002;
  3465. { For Windows >= Vista }
  3466. // footer item state
  3467. LVFIS_FOCUSED = $0001;
  3468. type
  3469. { For Windows >= Vista }
  3470. { $EXTERNALSYM tagLVFOOTERITEM}
  3471. tagLVFOOTERITEM = record
  3472. mask: UINT; // LVFIF_*
  3473. iItem: Integer;
  3474. pszText: LPWSTR;
  3475. cchTextMax: Integer;
  3476. state: UINT; // LVFIS_*
  3477. stateMask: UINT; // LVFIS_*
  3478. end;
  3479. PLVFooterItem = ^TLVFooterItem;
  3480. TLVFooterItem = tagLVFOOTERITEM;
  3481. const
  3482. { For Windows >= Vista }
  3483. LVM_GETFOOTERITEM = LVM_FIRST + 208;
  3484. function ListView_GetFooterItem(hwnd: HWND; iItem: UINT; var pfi: TLVFooterItem): BOOL; {inline;}
  3485. // supports a single item in multiple groups.
  3486. type
  3487. { For Windows >= Vista }
  3488. { $EXTERNALSYM tagLVITEMINDEX}
  3489. tagLVITEMINDEX = packed record
  3490. iItem: Integer; // listview item index
  3491. iGroup: Integer; // group index (must be -1 if group view is not enabled)
  3492. end;
  3493. PLVItemIndex = ^TLVItemIndex;
  3494. TLVItemIndex = tagLVITEMINDEX;
  3495. const
  3496. { For Windows >= Vista }
  3497. LVM_GETITEMINDEXRECT = LVM_FIRST + 209;
  3498. LVM_SETITEMINDEXSTATE = LVM_FIRST + 210;
  3499. LVM_GETNEXTITEMINDEX = LVM_FIRST + 211;
  3500. { For Windows >= Vista }
  3501. function ListView_GetItemIndexRect(hwnd: HWND; const plvii: TLVItemIndex;
  3502. iSubItem, code: Integer; var prc: TRect): BOOL; {inline;}
  3503. function ListView_SetItemIndexState(hwnd: HWND; const plvii: TLVItemIndex;
  3504. data, mask: UINT): HRESULT;
  3505. function ListView_GetNextItemIndex(hwnd: HWND; var plvii: TLVItemIndex;
  3506. flags: LPARAM): BOOL; {inline;}
  3507. const
  3508. {$IFDEF UNICODE}
  3509. LVM_SETBKIMAGE = LVM_SETBKIMAGEW;
  3510. LVM_GETBKIMAGE = LVM_GETBKIMAGEW;
  3511. {$ELSE}
  3512. LVM_SETBKIMAGE = LVM_SETBKIMAGEA;
  3513. LVM_GETBKIMAGE = LVM_GETBKIMAGEA;
  3514. {$ENDIF}
  3515. function ListView_SetBkImage(hwnd: HWND; plvbki: PLVBKImage): BOOL; {inline;}
  3516. function ListView_SetBkImageA(hwnd: HWND; plvbki: PLVBKImageA): BOOL; {inline;}
  3517. function ListView_SetBkImageW(hwnd: HWND; plvbki: PLVBKImageW): BOOL; {inline;}
  3518. function ListView_GetBkImage(hwnd: HWND; plvbki: PLVBKImage): BOOL; {inline;}
  3519. function ListView_GetBkImageA(hwnd: HWND; plvbki: PLVBKImageA): BOOL; {inline;}
  3520. function ListView_GetBkImageW(hwnd: HWND; plvbki: PLVBKImageW): BOOL; {inline;}
  3521. type
  3522. tagNMLISTVIEW = packed record
  3523. hdr: TNMHDR;
  3524. iItem: Integer;
  3525. iSubItem: Integer;
  3526. uNewState: UINT;
  3527. uOldState: UINT;
  3528. uChanged: UINT;
  3529. ptAction: TPoint;
  3530. lParam: LPARAM;
  3531. end;
  3532. _NM_LISTVIEW = tagNMLISTVIEW;
  3533. NM_LISTVIEW = tagNMLISTVIEW;
  3534. PNMListView = ^TNMListView;
  3535. TNMListView = tagNMLISTVIEW;
  3536. // NMITEMACTIVATE is used instead of NMLISTVIEW in IE >= 0x400
  3537. // therefore all the fields are the same except for extra uKeyFlags
  3538. // they are used to store key flags at the time of the single click with
  3539. // delayed activation - because by the time the timer goes off a user may
  3540. // not hold the keys (shift, ctrl) any more
  3541. tagNMITEMACTIVATE = packed record
  3542. hdr: TNMHdr;
  3543. iItem: Integer;
  3544. iSubItem: Integer;
  3545. uNewState: UINT;
  3546. uOldState: UINT;
  3547. uChanged: UINT;
  3548. ptAction: TPoint;
  3549. lParam: LPARAM;
  3550. uKeyFlags: UINT;
  3551. end;
  3552. PNMItemActivate = ^TNMItemActivate;
  3553. TNMItemActivate = tagNMITEMACTIVATE;
  3554. const
  3555. // key flags stored in uKeyFlags
  3556. LVKF_ALT = $0001;
  3557. LVKF_CONTROL = $0002;
  3558. LVKF_SHIFT = $0004;
  3559. type
  3560. tagNMLVCUSTOMDRAW = packed record
  3561. nmcd: TNMCustomDraw;
  3562. clrText: COLORREF;
  3563. clrTextBk: COLORREF;
  3564. iSubItem: Integer;
  3565. (* dwItemType: DWORD;
  3566. // Item custom draw
  3567. clrFace: COLORREF;
  3568. iIconEffect: Integer;
  3569. iIconPhase: Integer;
  3570. iPartId: Integer;
  3571. iStateId: Integer;
  3572. // Group Custom Draw
  3573. rcText: TRect;
  3574. uAlign: UINT; // Alignment. Use LVGA_HEADER_CENTER, LVGA_HEADER_RIGHT, LVGA_HEADER_LEFT
  3575. *) end;
  3576. PNMLVCustomDraw = ^TNMLVCustomDraw;
  3577. TNMLVCustomDraw = tagNMLVCUSTOMDRAW;
  3578. tagNMLVCACHEHINT = packed record
  3579. hdr: TNMHDR;
  3580. iFrom: Integer;
  3581. iTo: Integer;
  3582. end;
  3583. PNMLVCacheHint = ^TNMLVCacheHint;
  3584. TNMLVCacheHint = tagNMLVCACHEHINT;
  3585. PNMCacheHint = ^TNMCacheHint;
  3586. TNMCacheHint = tagNMLVCACHEHINT;
  3587. tagNMLVFINDITEMA = record // WIN2K
  3588. hdr: TNMHdr;
  3589. iStart: Integer;
  3590. lvfi: TLVFindInfoA;
  3591. end;
  3592. tagNMLVFINDITEMW = record // WIN2K
  3593. hdr: TNMHdr;
  3594. iStart: Integer;
  3595. lvfi: TLVFindInfoW;
  3596. end;
  3597. tagNMLVFINDITEM = tagNMLVFINDITEMW;
  3598. PNMLVFinditemA = ^TNMLVFinditemA;
  3599. PNMLVFinditemW = ^TNMLVFinditemW;
  3600. PNMLVFinditem = PNMLVFinditemW;
  3601. TNMLVFinditemA = tagNMLVFINDITEMA; // WIN2K
  3602. TNMLVFinditemW = tagNMLVFINDITEMW; // WIN2K
  3603. TNMLVFinditem = TNMLVFinditemW;
  3604. PNMFinditemA = ^TNMFinditemA;
  3605. PNMFinditemW = ^TNMFinditemW;
  3606. PNMFinditem = PNMFinditemW;
  3607. TNMFinditemA = tagNMLVFINDITEMA; // WIN2K
  3608. TNMFinditemW = tagNMLVFINDITEMW; // WIN2K
  3609. TNMFinditem = TNMFinditemW;
  3610. tagNMLVODSTATECHANGE = packed record
  3611. hdr: TNMHdr;
  3612. iFrom: Integer;
  3613. iTo: Integer;
  3614. uNewState: UINT;
  3615. uOldState: UINT;
  3616. end;
  3617. PNMLVODStateChange = ^TNMLVODStateChange;
  3618. TNMLVODStateChange = tagNMLVODSTATECHANGE;
  3619. const
  3620. LVN_ITEMCHANGING = LVN_FIRST-0;
  3621. LVN_ITEMCHANGED = LVN_FIRST-1;
  3622. LVN_INSERTITEM = LVN_FIRST-2;
  3623. LVN_DELETEITEM = LVN_FIRST-3;
  3624. LVN_DELETEALLITEMS = LVN_FIRST-4;
  3625. LVN_COLUMNCLICK = LVN_FIRST-8;
  3626. LVN_BEGINDRAG = LVN_FIRST-9;
  3627. LVN_BEGINRDRAG = LVN_FIRST-11;
  3628. LVN_ODCACHEHINT = LVN_FIRST-13;
  3629. LVN_ODFINDITEMA = LVN_FIRST-52;
  3630. LVN_ODFINDITEMW = LVN_FIRST-79;
  3631. LVN_ITEMACTIVATE = LVN_FIRST-14;
  3632. LVN_ODSTATECHANGED = LVN_FIRST-15;
  3633. {$IFDEF UNICODE}
  3634. LVN_ODFINDITEM = LVN_ODFINDITEMW;
  3635. {$ELSE}
  3636. LVN_ODFINDITEM = LVN_ODFINDITEMA;
  3637. {$ENDIF}
  3638. LVN_BEGINLABELEDITA = LVN_FIRST-5;
  3639. LVN_ENDLABELEDITA = LVN_FIRST-6;
  3640. LVN_BEGINLABELEDITW = LVN_FIRST-75;
  3641. LVN_ENDLABELEDITW = LVN_FIRST-76;
  3642. {$IFDEF UNICODE}
  3643. LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITW;
  3644. LVN_ENDLABELEDIT = LVN_ENDLABELEDITW;
  3645. {$ELSE}
  3646. LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA;
  3647. LVN_ENDLABELEDIT = LVN_ENDLABELEDITA;
  3648. {$ENDIF}
  3649. LVN_HOTTRACK = LVN_FIRST-21;
  3650. LVN_GETDISPINFOA = LVN_FIRST-50;
  3651. LVN_SETDISPINFOA = LVN_FIRST-51;
  3652. LVN_GETDISPINFOW = LVN_FIRST-77;
  3653. LVN_SETDISPINFOW = LVN_FIRST-78;
  3654. {$IFDEF UNICODE}
  3655. LVN_GETDISPINFO = LVN_GETDISPINFOW;
  3656. LVN_SETDISPINFO = LVN_SETDISPINFOW;
  3657. {$ELSE}
  3658. LVN_GETDISPINFO = LVN_GETDISPINFOA;
  3659. LVN_SETDISPINFO = LVN_SETDISPINFOA;
  3660. {$ENDIF}
  3661. LVIF_DI_SETITEM = $1000;
  3662. type
  3663. {$IFNDEF UNICODE}
  3664. PLVDispInfoA = ^TLVDispInfoA;
  3665. PLVDispInfoW = ^TLVDispInfoW;
  3666. PLVDispInfo = PLVDispInfoA;
  3667. tagLVDISPINFO = record
  3668. hdr: TNMHDR;
  3669. item: TLVItemA;
  3670. end;
  3671. _LV_DISPINFO = tagLVDISPINFO;
  3672. tagLVDISPINFOW = record
  3673. hdr: TNMHDR;
  3674. item: TLVItemW;
  3675. end;
  3676. _LV_DISPINFOW = tagLVDISPINFOW;
  3677. TLVDispInfoA = tagLVDISPINFO;
  3678. TLVDispInfoW = tagLVDISPINFOW;
  3679. TLVDispInfo = TLVDispInfoA;
  3680. LV_DISPINFOA = tagLVDISPINFO;
  3681. LV_DISPINFOW = tagLVDISPINFOW;
  3682. LV_DISPINFO = LV_DISPINFOA;
  3683. {$ELSE}
  3684. PLVDispInfoA = ^TLVDispInfoA;
  3685. PLVDispInfoW = ^TLVDispInfoW;
  3686. PLVDispInfo = PLVDispInfoW;
  3687. tagLVDISPINFOW = record
  3688. hdr: TNMHDR;
  3689. item: TLVItemW;
  3690. end;
  3691. tagLVDISPINFO = tagLVDISPINFOW;
  3692. _LV_DISPINFO = tagLVDISPINFOW;
  3693. tagLVDISPINFOA = record
  3694. hdr: TNMHDR;
  3695. item: TLVItemA;
  3696. end;
  3697. _LV_DISPINFOW = tagLVDISPINFO;
  3698. TLVDispInfoW = tagLVDISPINFO;
  3699. TLVDispInfoA = tagLVDISPINFO;
  3700. TLVDispInfo = TLVDispInfoW;
  3701. LV_DISPINFOW = tagLVDISPINFOW;
  3702. LV_DISPINFOA = tagLVDISPINFO;
  3703. LV_DISPINFO = LV_DISPINFOW;
  3704. {$ENDIF}
  3705. const
  3706. LVN_KEYDOWN = LVN_FIRST-55;
  3707. type
  3708. PLVKeyDown = ^TLVKeyDown;
  3709. tagLVKEYDOWN = packed record
  3710. hdr: TNMHDR;
  3711. wVKey: Word;
  3712. flags: UINT;
  3713. end;
  3714. _LV_KEYDOWN = tagLVKEYDOWN;
  3715. TLVKeyDown = tagLVKEYDOWN;
  3716. LV_KEYDOWN = tagLVKEYDOWN;
  3717. const
  3718. LVN_MARQUEEBEGIN = LVN_FIRST-56;
  3719. type
  3720. { For Windows >= Vista }
  3721. { $EXTERNALSYM tagNMLVLINK}
  3722. tagNMLVLINK = record
  3723. hdr: NMHDR;
  3724. link: TLItem;
  3725. iItem: Integer;
  3726. iSubItem: Integer;
  3727. end;
  3728. PNMLVLink = ^TNMLVLink;
  3729. TNMLVLink = tagNMLVLINK;
  3730. type
  3731. tagNMLVGETINFOTIPA = record
  3732. hdr: TNMHdr;
  3733. dwFlags: DWORD;
  3734. pszText: PAnsiChar;
  3735. cchTextMax: Integer;
  3736. iItem: Integer;
  3737. iSubItem: Integer;
  3738. lParam: LPARAM;
  3739. end;
  3740. tagNMLVGETINFOTIPW = record
  3741. hdr: TNMHdr;
  3742. dwFlags: DWORD;
  3743. pszText: PWideChar;
  3744. cchTextMax: Integer;
  3745. iItem: Integer;
  3746. iSubItem: Integer;
  3747. lParam: LPARAM;
  3748. end;
  3749. tagNMLVGETINFOTIP = tagNMLVGETINFOTIPW;
  3750. PNMLVGetInfoTipA = ^TNMLVGetInfoTipA;
  3751. PNMLVGetInfoTipW = ^TNMLVGetInfoTipW;
  3752. PNMLVGetInfoTip = PNMLVGetInfoTipW;
  3753. TNMLVGetInfoTipA = tagNMLVGETINFOTIPA;
  3754. TNMLVGetInfoTipW = tagNMLVGETINFOTIPW;
  3755. TNMLVGetInfoTip = TNMLVGetInfoTipW;
  3756. const
  3757. // NMLVGETINFOTIPA.dwFlag values
  3758. LVGIT_UNFOLDED = $0001;
  3759. LVN_GETINFOTIPA = LVN_FIRST-57;
  3760. LVN_GETINFOTIPW = LVN_FIRST-58;
  3761. {$IFDEF UNICODE}
  3762. LVN_GETINFOTIP = LVN_GETINFOTIPW;
  3763. {$ELSE}
  3764. LVN_GETINFOTIP = LVN_GETINFOTIPA;
  3765. {$ENDIF}
  3766. //
  3767. // LVN_INCREMENTALSEARCH gives the app the opportunity to customize
  3768. // incremental search. For example, if the items are numeric,
  3769. // the app can do numerical search instead of string search.
  3770. //
  3771. // ListView notifies the app with NMLVFINDITEM.
  3772. // The app sets pnmfi->lvfi.lParam to the result of the incremental search,
  3773. // or to LVNSCH_DEFAULT if ListView should do the default search,
  3774. // or to LVNSCH_ERROR to fail the search and just beep,
  3775. // or to LVNSCH_IGNORE to stop all ListView processing.
  3776. //
  3777. // The return value is not used.
  3778. LVNSCH_DEFAULT = -1;
  3779. LVNSCH_ERROR = -2;
  3780. LVNSCH_IGNORE = -3;
  3781. LVN_INCREMENTALSEARCHA = LVN_FIRST-62;
  3782. LVN_INCREMENTALSEARCHW = LVN_FIRST-63;
  3783. LVN_INCREMENTALSEARCH = LVN_INCREMENTALSEARCHW;
  3784. { For Windows >= Vista }
  3785. LVN_COLUMNDROPDOWN = LVN_FIRST-64;
  3786. { For Windows >= Vista }
  3787. LVN_COLUMNOVERFLOWCLICK = LVN_FIRST-66;
  3788. type
  3789. { For Windows >= XP }
  3790. { $EXTERNALSYM tagNMLVSCROLL}
  3791. tagNMLVSCROLL = packed record
  3792. hdr: NMHDR;
  3793. dx: Integer;
  3794. dy: Integer;
  3795. end;
  3796. PNMLVScroll = ^TNMLVScroll;
  3797. TNMLVScroll = tagNMLVSCROLL;
  3798. const
  3799. { For Windows >= XP }
  3800. LVN_BEGINSCROLL = LVN_FIRST-80;
  3801. LVN_ENDSCROLL = LVN_FIRST-81;
  3802. { For Windows >= Vista }
  3803. LVN_LINKCLICK = LVN_FIRST-84;
  3804. { For Windows >= Vista }
  3805. EMF_CENTERED = $00000001; // render markup centered in the listview area
  3806. type
  3807. { For Windows >= Vista }
  3808. { $EXTERNALSYM tagNMLVEMPTYMARKUP}
  3809. tagNMLVEMPTYMARKUP = record
  3810. hdr: NMHDR;
  3811. // out params from client back to listview
  3812. dwFlags: DWORD; // EMF_*
  3813. szMarkup: packed array[0..L_MAX_URL_LENGTH-1] of WCHAR;// markup displayed
  3814. end;
  3815. PNMLVEmptyMarkup = ^TNMLVEmptyMarkup;
  3816. TNMLVEmptyMarkup = tagNMLVEMPTYMARKUP;
  3817. const
  3818. { For Windows >= Vista }
  3819. LVN_GETEMPTYMARKUP = LVN_FIRST-87;
  3820. { ====== TREEVIEW CONTROL =================== }
  3821. const
  3822. WC_TREEVIEW = 'SysTreeView32';
  3823. const
  3824. TVS_HASBUTTONS = $0001;
  3825. TVS_HASLINES = $0002;
  3826. TVS_LINESATROOT = $0004;
  3827. TVS_EDITLABELS = $0008;
  3828. TVS_DISABLEDRAGDROP = $0010;
  3829. TVS_SHOWSELALWAYS = $0020;
  3830. TVS_RTLREADING = $0040;
  3831. TVS_NOTOOLTIPS = $0080;
  3832. TVS_CHECKBOXES = $0100;
  3833. TVS_TRACKSELECT = $0200;
  3834. TVS_SINGLEEXPAND = $0400;
  3835. TVS_INFOTIP = $0800;
  3836. TVS_FULLROWSELECT = $1000;
  3837. TVS_NOSCROLL = $2000;
  3838. TVS_NONEVENHEIGHT = $4000;
  3839. { For IE >= 0x0500 }
  3840. TVS_NOHSCROLL = $8000; // TVS_NOSCROLL overrides this
  3841. { For Windows >= Vista }
  3842. TVS_EX_MULTISELECT = $0002;
  3843. TVS_EX_DOUBLEBUFFER = $0004;
  3844. TVS_EX_NOINDENTSTATE = $0008;
  3845. TVS_EX_RICHTOOLTIP = $0010;
  3846. TVS_EX_AUTOHSCROLL = $0020;
  3847. TVS_EX_FADEINOUTEXPANDOS = $0040;
  3848. TVS_EX_PARTIALCHECKBOXES = $0080;
  3849. TVS_EX_EXCLUSIONCHECKBOXES = $0100;
  3850. TVS_EX_DIMMEDCHECKBOXES = $0200;
  3851. TVS_EX_DRAWIMAGEASYNC = $0400;
  3852. type
  3853. HTREEITEM = ^_TREEITEM;
  3854. _TREEITEM = packed record
  3855. end;
  3856. const
  3857. TVIF_TEXT = $0001;
  3858. TVIF_IMAGE = $0002;
  3859. TVIF_PARAM = $0004;
  3860. TVIF_STATE = $0008;
  3861. TVIF_HANDLE = $0010;
  3862. TVIF_SELECTEDIMAGE = $0020;
  3863. TVIF_CHILDREN = $0040;
  3864. TVIF_INTEGRAL = $0080;
  3865. { For Windows >= Vista }
  3866. TVIF_STATEEX = $0100;
  3867. TVIF_EXPANDEDIMAGE = $0200;
  3868. TVIS_FOCUSED = $0001;
  3869. TVIS_SELECTED = $0002;
  3870. TVIS_CUT = $0004;
  3871. TVIS_DROPHILITED = $0008;
  3872. TVIS_BOLD = $0010;
  3873. TVIS_EXPANDED = $0020;
  3874. TVIS_EXPANDEDONCE = $0040;
  3875. TVIS_EXPANDPARTIAL = $0080;
  3876. TVIS_OVERLAYMASK = $0F00;
  3877. TVIS_STATEIMAGEMASK = $F000;
  3878. TVIS_USERMASK = $F000;
  3879. { For IE >= 0x0600 }
  3880. TVIS_EX_FLAT = $0001;
  3881. TVIS_EX_ALL = $0002;
  3882. { For Windows >= Vista }
  3883. TVIS_EX_DISABLED = $0002;
  3884. // Structure for TreeView's NM_TVSTATEIMAGECHANGING notification
  3885. type
  3886. { For IE >= 0x0600 }
  3887. { $EXTERNALSYM tagNMTVSTATEIMAGECHANGING}
  3888. tagNMTVSTATEIMAGECHANGING = packed record
  3889. hdr: NMHDR;
  3890. hti: HTREEITEM;
  3891. iOldStateImageIndex: Integer;
  3892. iNewStateImageIndex: Integer;
  3893. end;
  3894. PNMTVStateImageChanging = ^TNMTVStateImageChanging;
  3895. TNMTVStateImageChanging = tagNMTVSTATEIMAGECHANGING;
  3896. const
  3897. I_CHILDRENCALLBACK = -1;
  3898. type
  3899. PTVItemA = ^TTVItemA;
  3900. PTVItemW = ^TTVItemW;
  3901. PTVItem = PTVItemW;
  3902. tagTVITEMA = record
  3903. mask: UINT;
  3904. hItem: HTreeItem;
  3905. state: UINT;
  3906. stateMask: UINT;
  3907. pszText: PAnsiChar;
  3908. cchTextMax: Integer;
  3909. iImage: Integer;
  3910. iSelectedImage: Integer;
  3911. cChildren: Integer;
  3912. lParam: LPARAM;
  3913. end;
  3914. tagTVITEMW = record
  3915. mask: UINT;
  3916. hItem: HTreeItem;
  3917. state: UINT;
  3918. stateMask: UINT;
  3919. pszText: PWideChar;
  3920. cchTextMax: Integer;
  3921. iImage: Integer;
  3922. iSelectedImage: Integer;
  3923. cChildren: Integer;
  3924. lParam: LPARAM;
  3925. end;
  3926. tagTVITEM = tagTVITEMW;
  3927. _TV_ITEMA = tagTVITEMA;
  3928. _TV_ITEMW = tagTVITEMW;
  3929. _TV_ITEM = _TV_ITEMW;
  3930. TTVItemA = tagTVITEMA;
  3931. TTVItemW = tagTVITEMW;
  3932. TTVItem = TTVItemW;
  3933. TV_ITEMA = tagTVITEMA;
  3934. TV_ITEMW = tagTVITEMW;
  3935. TV_ITEM = TV_ITEMW;
  3936. // only used for Get and Set messages. no notifies
  3937. tagTVITEMEXA = record
  3938. mask: UINT;
  3939. hItem: HTREEITEM;
  3940. state: UINT;
  3941. stateMask: UINT;
  3942. pszText: PAnsiChar;
  3943. cchTextMax: Integer;
  3944. iImage: Integer;
  3945. iSelectedImage: Integer;
  3946. cChildren: Integer;
  3947. lParam: LPARAM;
  3948. iIntegral: Integer;
  3949. { For Windows >= Vista }
  3950. uStateEx: UINT;
  3951. hwnd: HWND;
  3952. iExpandedImage: Integer;
  3953. end;
  3954. tagTVITEMEXW = record
  3955. mask: UINT;
  3956. hItem: HTREEITEM;
  3957. state: UINT;
  3958. stateMask: UINT;
  3959. pszText: PWideChar;
  3960. cchTextMax: Integer;
  3961. iImage: Integer;
  3962. iSelectedImage: Integer;
  3963. cChildren: Integer;
  3964. lParam: LPARAM;
  3965. iIntegral: Integer;
  3966. { For Windows >= Vista }
  3967. uStateEx: UINT;
  3968. hwnd: HWND;
  3969. iExpandedImage: Integer;
  3970. end;
  3971. tagTVITEMEX = tagTVITEMEXW;
  3972. PTVItemExA = ^TTVItemExA;
  3973. PTVItemExW = ^TTVItemExW;
  3974. PTVItemEx = PTVItemExW;
  3975. TTVItemExA = tagTVITEMEXA;
  3976. TTVItemExW = tagTVITEMEXW;
  3977. TTVItemEx = TTVItemExW;
  3978. const
  3979. TVI_ROOT = HTreeItem($FFFF0000);
  3980. TVI_FIRST = HTreeItem($FFFF0001);
  3981. TVI_LAST = HTreeItem($FFFF0002);
  3982. TVI_SORT = HTreeItem($FFFF0003);
  3983. type
  3984. PTVInsertStructA = ^TTVInsertStructA;
  3985. PTVInsertStructW = ^TTVInsertStructW;
  3986. PTVInsertStruct = PTVInsertStructW;
  3987. tagTVINSERTSTRUCTA = record
  3988. hParent: HTreeItem;
  3989. hInsertAfter: HTreeItem;
  3990. case Integer of
  3991. 0: (itemex: TTVItemExA);
  3992. 1: (item: TTVItemA);
  3993. end;
  3994. tagTVINSERTSTRUCTW = record
  3995. hParent: HTreeItem;
  3996. hInsertAfter: HTreeItem;
  3997. case Integer of
  3998. 0: (itemex: TTVItemExW);
  3999. 1: (item: TTVItemW);
  4000. end;
  4001. tagTVINSERTSTRUCT = tagTVINSERTSTRUCTW;
  4002. _TV_INSERTSTRUCTA = tagTVINSERTSTRUCTA;
  4003. _TV_INSERTSTRUCTW = tagTVINSERTSTRUCTW;
  4004. _TV_INSERTSTRUCT = _TV_INSERTSTRUCTW;
  4005. TTVInsertStructA = tagTVINSERTSTRUCTA;
  4006. TTVInsertStructW = tagTVINSERTSTRUCTW;
  4007. TTVInsertStruct = TTVInsertStructW;
  4008. TV_INSERTSTRUCTA = tagTVINSERTSTRUCTA;
  4009. TV_INSERTSTRUCTW = tagTVINSERTSTRUCTW;
  4010. TV_INSERTSTRUCT = TV_INSERTSTRUCTW;
  4011. const
  4012. TVM_INSERTITEMA = TV_FIRST + 0;
  4013. TVM_INSERTITEMW = TV_FIRST + 50;
  4014. {$IFDEF UNICODE}
  4015. TVM_INSERTITEM = TVM_INSERTITEMW;
  4016. {$ELSE}
  4017. TVM_INSERTITEM = TVM_INSERTITEMA;
  4018. {$ENDIF}
  4019. function TreeView_InsertItem(hwnd: HWND; const lpis: TTVInsertStruct): HTreeItem; {inline;}
  4020. function TreeView_InsertItemA(hwnd: HWND; const lpis: TTVInsertStructA): HTreeItem; {inline;}
  4021. function TreeView_InsertItemW(hwnd: HWND; const lpis: TTVInsertStructW): HTreeItem; {inline;}
  4022. const
  4023. TVM_DELETEITEM = TV_FIRST + 1;
  4024. function TreeView_DeleteItem(hwnd: HWND; hitem: HTreeItem): Bool; {inline;}
  4025. function TreeView_DeleteAllItems(hwnd: HWND): Bool; {inline;}
  4026. const
  4027. TVM_EXPAND = TV_FIRST + 2;
  4028. function TreeView_Expand(hwnd: HWND; hitem: HTreeItem; code: Integer): Bool; {inline;}
  4029. const
  4030. TVE_COLLAPSE = $0001;
  4031. TVE_EXPAND = $0002;
  4032. TVE_TOGGLE = $0003;
  4033. TVE_EXPANDPARTIAL = $4000;
  4034. TVE_COLLAPSERESET = $8000;
  4035. const
  4036. TVM_GETITEMRECT = TV_FIRST + 4;
  4037. function TreeView_GetItemRect(hwnd: HWND; hitem: HTreeItem;
  4038. var prc: TRect; code: Bool): Bool;
  4039. const
  4040. TVM_GETCOUNT = TV_FIRST + 5;
  4041. function TreeView_GetCount(hwnd: HWND): UINT; {inline;}
  4042. const
  4043. TVM_GETINDENT = TV_FIRST + 6;
  4044. function TreeView_GetIndent(hwnd: HWND): UINT; {inline;}
  4045. const
  4046. TVM_SETINDENT = TV_FIRST + 7;
  4047. function TreeView_SetIndent(hwnd: HWND; indent: Integer): Bool; {inline;}
  4048. const
  4049. TVM_GETIMAGELIST = TV_FIRST + 8;
  4050. function TreeView_GetImageList(hwnd: HWND; iImage: Integer): HIMAGELIST; {inline;}
  4051. const
  4052. TVSIL_NORMAL = 0;
  4053. TVSIL_STATE = 2;
  4054. const
  4055. TVM_SETIMAGELIST = TV_FIRST + 9;
  4056. function TreeView_SetImageList(hwnd: HWND; himl: HIMAGELIST;
  4057. iImage: Integer): HIMAGELIST; {inline;}
  4058. const
  4059. TVM_GETNEXTITEM = TV_FIRST + 10;
  4060. function TreeView_GetNextItem(hwnd: HWND; hitem: HTreeItem;
  4061. code: Integer): HTreeItem; {inline;}
  4062. const
  4063. TVGN_ROOT = $0000;
  4064. TVGN_NEXT = $0001;
  4065. TVGN_PREVIOUS = $0002;
  4066. TVGN_PARENT = $0003;
  4067. TVGN_CHILD = $0004;
  4068. TVGN_FIRSTVISIBLE = $0005;
  4069. TVGN_NEXTVISIBLE = $0006;
  4070. TVGN_PREVIOUSVISIBLE = $0007;
  4071. TVGN_DROPHILITE = $0008;
  4072. TVGN_CARET = $0009;
  4073. TVGN_LASTVISIBLE = $000A;
  4074. { For IE >= 0x0600 }
  4075. TVGN_NEXTSELECTED = $000B;
  4076. { For Windows >= XP }
  4077. TVSI_NOSINGLEEXPAND = $8000; // Should not conflict with TVGN flags.
  4078. function TreeView_GetChild(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4079. function TreeView_GetNextSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4080. function TreeView_GetPrevSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4081. function TreeView_GetParent(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4082. function TreeView_GetFirstVisible(hwnd: HWND): HTreeItem;
  4083. function TreeView_GetNextVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4084. function TreeView_GetPrevVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4085. function TreeView_GetSelection(hwnd: HWND): HTreeItem;
  4086. function TreeView_GetDropHilite(hwnd: HWND): HTreeItem;
  4087. function TreeView_GetRoot(hwnd: HWND): HTreeItem;
  4088. function TreeView_GetLastVisible(hwnd: HWND): HTreeItem;
  4089. { For Windows >= Vista }
  4090. function TreeView_GetNextSelected(hwnd: HWND; hitem: HTreeItem): HTreeItem; {inline;}
  4091. const
  4092. TVM_SELECTITEM = TV_FIRST + 11;
  4093. function TreeView_Select(hwnd: HWND; hitem: HTreeItem;
  4094. code: Integer): HTreeItem; {inline;}
  4095. function TreeView_SelectItem(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4096. function TreeView_SelectDropTarget(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4097. function TreeView_SelectSetFirstVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  4098. const
  4099. TVM_GETITEMA = TV_FIRST + 12;
  4100. TVM_GETITEMW = TV_FIRST + 62;
  4101. {$IFDEF UNICODE}
  4102. TVM_GETITEM = TVM_GETITEMW;
  4103. {$ELSE}
  4104. TVM_GETITEM = TVM_GETITEMA;
  4105. {$ENDIF}
  4106. function TreeView_GetItem(hwnd: HWND; var pitem: TTVItem): Bool; {inline;}
  4107. function TreeView_GetItemA(hwnd: HWND; var pitem: TTVItemA): Bool; {inline;}
  4108. function TreeView_GetItemW(hwnd: HWND; var pitem: TTVItemW): Bool; {inline;}
  4109. const
  4110. TVM_SETITEMA = TV_FIRST + 13;
  4111. TVM_SETITEMW = TV_FIRST + 63;
  4112. {$IFDEF UNICODE}
  4113. TVM_SETITEM = TVM_SETITEMW;
  4114. {$ELSE}
  4115. TVM_SETITEM = TVM_SETITEMA;
  4116. {$ENDIF}
  4117. function TreeView_SetItem(hwnd: HWND; const pitem: TTVItem): Bool; {inline;} overload;
  4118. function TreeView_SetItem(hwnd: HWND; const pitem: TTVItemEx): Bool; {inline;} overload;
  4119. function TreeView_SetItemA(hwnd: HWND; const pitem: TTVItemA): Bool; {inline;} overload;
  4120. function TreeView_SetItemA(hwnd: HWND; const pitem: TTVItemExA): Bool; {inline;} overload;
  4121. function TreeView_SetItemW(hwnd: HWND; const pitem: TTVItemW): Bool; {inline;} overload;
  4122. function TreeView_SetItemW(hwnd: HWND; const pitem: TTVItemExW): Bool; {inline;} overload;
  4123. const
  4124. TVM_EDITLABELA = TV_FIRST + 14;
  4125. TVM_EDITLABELW = TV_FIRST + 65;
  4126. {$IFDEF UNICODE}
  4127. TVM_EDITLABEL = TVM_EDITLABELW;
  4128. {$ELSE}
  4129. TVM_EDITLABEL = TVM_EDITLABELA;
  4130. {$ENDIF}
  4131. function TreeView_EditLabel(hwnd: HWND; hitem: HTreeItem): HWND; {inline;}
  4132. function TreeView_EditLabelA(hwnd: HWND; hitem: HTreeItem): HWND; {inline;}
  4133. function TreeView_EditLabelW(hwnd: HWND; hitem: HTreeItem): HWND; {inline;}
  4134. const
  4135. TVM_GETEDITCONTROL = TV_FIRST + 15;
  4136. function TreeView_GetEditControl(hwnd: HWND): HWND; {inline;}
  4137. const
  4138. TVM_GETVISIBLECOUNT = TV_FIRST + 16;
  4139. function TreeView_GetVisibleCount(hwnd: HWND): UINT; {inline;}
  4140. const
  4141. TVM_HITTEST = TV_FIRST + 17;
  4142. type
  4143. PTVHitTestInfo = ^TTVHitTestInfo;
  4144. tagTVHITTESTINFO = packed record
  4145. pt: TPoint;
  4146. flags: UINT;
  4147. hItem: HTreeItem;
  4148. end;
  4149. _TV_HITTESTINFO = tagTVHITTESTINFO;
  4150. TTVHitTestInfo = tagTVHITTESTINFO;
  4151. TV_HITTESTINFO = tagTVHITTESTINFO;
  4152. function TreeView_HitTest(hwnd: HWND; var lpht: TTVHitTestInfo): HTreeItem; {inline;}
  4153. const
  4154. TVHT_NOWHERE = $0001;
  4155. TVHT_ONITEMICON = $0002;
  4156. TVHT_ONITEMLABEL = $0004;
  4157. TVHT_ONITEMINDENT = $0008;
  4158. TVHT_ONITEMBUTTON = $0010;
  4159. TVHT_ONITEMRIGHT = $0020;
  4160. TVHT_ONITEMSTATEICON = $0040;
  4161. TVHT_ONITEM = TVHT_ONITEMICON or TVHT_ONITEMLABEL or
  4162. TVHT_ONITEMSTATEICON;
  4163. TVHT_ABOVE = $0100;
  4164. TVHT_BELOW = $0200;
  4165. TVHT_TORIGHT = $0400;
  4166. TVHT_TOLEFT = $0800;
  4167. const
  4168. TVM_CREATEDRAGIMAGE = TV_FIRST + 18;
  4169. function TreeView_CreateDragImage(hwnd: HWND; hitem: HTreeItem): HIMAGELIST; {inline;}
  4170. const
  4171. TVM_SORTCHILDREN = TV_FIRST + 19;
  4172. function TreeView_SortChildren(hwnd: HWND; hitem: HTreeItem;
  4173. recurse: Integer): Bool; {inline;}
  4174. const
  4175. TVM_ENSUREVISIBLE = TV_FIRST + 20;
  4176. function TreeView_EnsureVisible(hwnd: HWND; hitem: HTreeItem): Bool; {inline;}
  4177. const
  4178. TVM_SORTCHILDRENCB = TV_FIRST + 21;
  4179. type
  4180. PFNTVCOMPARE = function(lParam1, lParam2, lParamSort: Longint): Integer stdcall;
  4181. TTVCompare = PFNTVCOMPARE;
  4182. type
  4183. tagTVSORTCB = packed record
  4184. hParent: HTreeItem;
  4185. lpfnCompare: TTVCompare;
  4186. lParam: LPARAM;
  4187. end;
  4188. _TV_SORTCB = tagTVSORTCB;
  4189. TTVSortCB = tagTVSORTCB;
  4190. TV_SORTCB = tagTVSORTCB;
  4191. function TreeView_SortChildrenCB(hwnd: HWND; const psort: TTVSortCB;
  4192. recurse: Integer): Bool; {inline;}
  4193. const
  4194. TVM_ENDEDITLABELNOW = TV_FIRST + 22;
  4195. function TreeView_EndEditLabelNow(hwnd: HWND; fCancel: Bool): Bool; {inline;}
  4196. const
  4197. TVM_GETISEARCHSTRINGA = TV_FIRST + 23;
  4198. TVM_GETISEARCHSTRINGW = TV_FIRST + 64;
  4199. {$IFDEF UNICODE}
  4200. TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGW;
  4201. {$ELSE}
  4202. TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA;
  4203. {$ENDIF}
  4204. function TreeView_GetISearchString(hwndTV: HWND; lpsz: PWideChar): Bool; {inline;}
  4205. function TreeView_GetISearchStringA(hwndTV: HWND; lpsz: PAnsiChar): Bool; {inline;}
  4206. function TreeView_GetISearchStringW(hwndTV: HWND; lpsz: PWideChar): Bool; {inline;}
  4207. const
  4208. TVM_SETTOOLTIPS = TV_FIRST + 24;
  4209. function TreeView_SetToolTips(wnd: HWND; hwndTT: HWND): HWND; {inline;}
  4210. const
  4211. TVM_GETTOOLTIPS = TV_FIRST + 25;
  4212. function TreeView_GetToolTips(wnd: HWND): HWND; {inline;}
  4213. const
  4214. TVM_SETINSERTMARK = TV_FIRST + 26;
  4215. function TreeView_SetInsertMark(hwnd: HWND; hItem: Integer; fAfter: BOOL): BOOL; {inline;}
  4216. const
  4217. TVM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  4218. function TreeView_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL; {inline;}
  4219. const
  4220. TVM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  4221. function TreeView_GetUnicodeFormat(hwnd: HWND): BOOL; {inline;}
  4222. const
  4223. TVM_SETITEMHEIGHT = TV_FIRST + 27;
  4224. function TreeView_SetItemHeight(hwnd: HWND; iHeight: Integer): Integer; {inline;}
  4225. const
  4226. TVM_GETITEMHEIGHT = TV_FIRST + 28;
  4227. function TreeView_GetItemHeight(hwnd: HWND): Integer; {inline;}
  4228. const
  4229. TVM_SETBKCOLOR = TV_FIRST + 29;
  4230. function TreeView_SetBkColor(hwnd: HWND; clr: COLORREF): COLORREF; {inline;}
  4231. const
  4232. TVM_SETTEXTCOLOR = TV_FIRST + 30;
  4233. function TreeView_SetTextColor(hwnd: HWND; clr: COLORREF): COLORREF; {inline;}
  4234. const
  4235. TVM_GETBKCOLOR = TV_FIRST + 31;
  4236. function TreeView_GetBkColor(hwnd: HWND): COLORREF; {inline;}
  4237. const
  4238. TVM_GETTEXTCOLOR = TV_FIRST + 32;
  4239. function TreeView_GetTextColor(hwnd: HWND): COLORREF; {inline;}
  4240. const
  4241. TVM_SETSCROLLTIME = TV_FIRST + 33;
  4242. function TreeView_SetScrollTime(hwnd: HWND; uTime: UINT): UINT; {inline;}
  4243. const
  4244. TVM_GETSCROLLTIME = TV_FIRST + 34;
  4245. function TreeView_GetScrollTime(hwnd: HWND): UINT; {inline;}
  4246. const
  4247. TVM_SETINSERTMARKCOLOR = TV_FIRST + 37;
  4248. function TreeView_SetInsertMarkColor(hwnd: HWND; clr: COLORREF): COLORREF; {inline;}
  4249. const
  4250. TVM_GETINSERTMARKCOLOR = TV_FIRST + 38;
  4251. function TreeView_GetInsertMarkColor(hwnd: HWND): COLORREF; {inline;}
  4252. { For IE >= 0x0500 }
  4253. // tvm_?etitemstate only uses mask, state and stateMask.
  4254. // so unicode or ansi is irrelevant.
  4255. function TreeView_SetItemState(hwndTV: HWND; hti: HTreeItem; State, Mask: UINT): UINT;
  4256. function TreeView_SetCheckState(hwndTV: HWND; hti: HTreeItem; fCheck: BOOL): UINT; {inline;}
  4257. const
  4258. { For IE >= 0x0500 }
  4259. TVM_GETITEMSTATE = TV_FIRST + 39;
  4260. { For IE >= 0x0500 }
  4261. function TreeView_GetItemState(hwndTV: HWND; hti: HTreeItem; mask: UINT): UINT; {inline;}
  4262. function TreeView_GetCheckState(hwndTV: HWND; hti: HTreeItem): UINT; {inline;}
  4263. const
  4264. { For IE >= 0x0500 }
  4265. TVM_SETLINECOLOR = TV_FIRST + 40;
  4266. TVM_GETLINECOLOR = TV_FIRST + 41;
  4267. { For Windows >= XP }
  4268. TVM_MAPACCIDTOHTREEITEM = TV_FIRST + 42;
  4269. TVM_MAPHTREEITEMTOACCID = TV_FIRST + 43;
  4270. TVM_SETEXTENDEDSTYLE = TV_FIRST + 44;
  4271. TVM_GETEXTENDEDSTYLE = TV_FIRST + 45;
  4272. TVM_SETAUTOSCROLLINFO = TV_FIRST + 59;
  4273. { For Windows >= Vista }
  4274. TVM_GETSELECTEDCOUNT = TV_FIRST + 70;
  4275. TVM_SHOWINFOTIP = TV_FIRST + 71;
  4276. { For IE >= 0x0500 }
  4277. function TreeView_SetLineColor(hwnd: HWND; clr: TColorRef): TColorRef; {inline;}
  4278. function TreeView_GetLineColor(hwnd: HWND): Integer; {inline;}
  4279. { For Windows >= XP }
  4280. function TreeView_MapAccIDToHTREEITEM(hwnd: HWND; id: UINT): HTreeItem; {inline;}
  4281. function TreeView_MapHTREEITEMToAccID(hwnd: HWND; hti: HTreeItem): UINT; {inline;}
  4282. function TreeView_SetExtendedStyle(hwnd: HWND; dw: DWORD; mask: UINT): UINT; {inline;}
  4283. function TreeView_GetExtendedStyle(hwnd: HWND): DWORD; {inline;}
  4284. function TreeView_SetAutoScrollInfo(hwnd: HWND; uPixPerSec, uUpdateTime: UINT): LRESULT; {inline;}
  4285. { For Windows >= Vista }
  4286. function TreeView_GetSelectedCount(hwnd: HWND): DWORD; {inline;}
  4287. function TreeView_ShowInfoTip(hwnd: HWND; hti: HTreeItem): DWORD; {inline;}
  4288. type
  4289. { For Windows >= Vista }
  4290. TVITEMPART = (TVGIPR_DUMMY, TVGIPR_BUTTON);
  4291. TTVItemPart = TVITEMPART;
  4292. type
  4293. { For Windows >= Vista }
  4294. tagTVGETITEMPARTRECTINFO = packed record
  4295. hti: HTREEITEM;
  4296. prc: PRect;
  4297. partID: TVITEMPART;
  4298. end;
  4299. PTVGetItemPartRectInfo = ^TTVGetItemPartRectInfo;
  4300. TTVGetItemPartRectInfo = tagTVGETITEMPARTRECTINFO;
  4301. const
  4302. { For Windows >= Vista }
  4303. TVM_GETITEMPARTRECT = TV_FIRST + 72;
  4304. function TreeView_GetItemPartRect(hwnd: HWND; hitem: HTreeItem; var prc: TRect;
  4305. partid: TTVItemPart): BOOL;
  4306. type
  4307. PNMTreeViewA = ^TNMTreeViewA;
  4308. PNMTreeViewW = ^TNMTreeViewW;
  4309. PNMTreeView = PNMTreeViewW;
  4310. tagNMTREEVIEWA = record
  4311. hdr: TNMHDR;
  4312. action: UINT;
  4313. itemOld: TTVItemA;
  4314. itemNew: TTVItemA;
  4315. ptDrag: TPoint;
  4316. end;
  4317. tagNMTREEVIEWW = record
  4318. hdr: TNMHDR;
  4319. action: UINT;
  4320. itemOld: TTVItemW;
  4321. itemNew: TTVItemW;
  4322. ptDrag: TPoint;
  4323. end;
  4324. tagNMTREEVIEW = tagNMTREEVIEWW;
  4325. _NM_TREEVIEWA = tagNMTREEVIEWA;
  4326. _NM_TREEVIEWW = tagNMTREEVIEWW;
  4327. _NM_TREEVIEW = _NM_TREEVIEWW;
  4328. TNMTreeViewA = tagNMTREEVIEWA;
  4329. TNMTreeViewW = tagNMTREEVIEWW;
  4330. TNMTreeView = TNMTreeViewW;
  4331. NM_TREEVIEWA = tagNMTREEVIEWA;
  4332. NM_TREEVIEWW = tagNMTREEVIEWW;
  4333. NM_TREEVIEW = NM_TREEVIEWW;
  4334. const
  4335. TVN_SELCHANGINGA = TVN_FIRST-1;
  4336. TVN_SELCHANGEDA = TVN_FIRST-2;
  4337. TVN_SELCHANGINGW = TVN_FIRST-50;
  4338. TVN_SELCHANGEDW = TVN_FIRST-51;
  4339. {$IFDEF UNICODE}
  4340. TVN_SELCHANGING = TVN_SELCHANGINGW;
  4341. TVN_SELCHANGED = TVN_SELCHANGEDW;
  4342. {$ELSE}
  4343. TVN_SELCHANGING = TVN_SELCHANGINGA;
  4344. TVN_SELCHANGED = TVN_SELCHANGEDA;
  4345. {$ENDIF}
  4346. const
  4347. TVC_UNKNOWN = $0000;
  4348. TVC_BYMOUSE = $0001;
  4349. TVC_BYKEYBOARD = $0002;
  4350. const
  4351. TVN_GETDISPINFOA = TVN_FIRST-3;
  4352. TVN_SETDISPINFOA = TVN_FIRST-4;
  4353. TVN_GETDISPINFOW = TVN_FIRST-52;
  4354. TVN_SETDISPINFOW = TVN_FIRST-53;
  4355. {$IFDEF UNICODE}
  4356. TVN_GETDISPINFO = TVN_GETDISPINFOW;
  4357. TVN_SETDISPINFO = TVN_SETDISPINFOW;
  4358. {$ELSE}
  4359. TVN_GETDISPINFO = TVN_GETDISPINFOA;
  4360. TVN_SETDISPINFO = TVN_SETDISPINFOA;
  4361. {$ENDIF}
  4362. TVIF_DI_SETITEM = $1000;
  4363. type
  4364. PTVDispInfoA = ^TTVDispInfoA;
  4365. PTVDispInfoW = ^TTVDispInfoW;
  4366. PTVDispInfo = PTVDispInfoW;
  4367. tagTVDISPINFOA = record
  4368. hdr: TNMHDR;
  4369. item: TTVItemA;
  4370. end;
  4371. tagTVDISPINFOW = record
  4372. hdr: TNMHDR;
  4373. item: TTVItemW;
  4374. end;
  4375. tagTVDISPINFO = tagTVDISPINFOW;
  4376. _TV_DISPINFOA = tagTVDISPINFOA;
  4377. _TV_DISPINFOW = tagTVDISPINFOW;
  4378. _TV_DISPINFO = _TV_DISPINFOW;
  4379. TTVDispInfoA = tagTVDISPINFOA;
  4380. TTVDispInfoW = tagTVDISPINFOW;
  4381. TTVDispInfo = TTVDispInfoW;
  4382. TV_DISPINFOA = tagTVDISPINFOA;
  4383. TV_DISPINFOW = tagTVDISPINFOW;
  4384. TV_DISPINFO = TV_DISPINFOW;
  4385. type
  4386. { For IE >= 0x0600 }
  4387. PNMTVDispInfoExA = ^TNMTVDispInfoExA;
  4388. PNMTVDispInfoExW = ^TNMTVDispInfoExW;
  4389. PNMTVDispInfoEx = PNMTVDispInfoExW;
  4390. { $EXTERNALSYM tagNMTVDISPINFOEXA}
  4391. tagNMTVDISPINFOEXA = record
  4392. hdr: NMHDR;
  4393. item: TTVItemExA;
  4394. end;
  4395. { $EXTERNALSYM tagNMTVDISPINFOEXW}
  4396. tagNMTVDISPINFOEXW = record
  4397. hdr: NMHDR;
  4398. item: TTVItemExW;
  4399. end;
  4400. tagNMTVDISPINFOEX = tagNMTVDISPINFOEXW;
  4401. TV_DISPINFOEXA = tagNMTVDISPINFOEXA;
  4402. TV_DISPINFOEXW = tagNMTVDISPINFOEXW;
  4403. TV_DISPINFOEX = TV_DISPINFOEXW;
  4404. TNMTVDispInfoExA = tagNMTVDISPINFOEXA;
  4405. TNMTVDispInfoExW = tagNMTVDISPINFOEXW;
  4406. TNMTVDispInfoEx = TNMTVDispInfoExW;
  4407. const
  4408. TVN_ITEMEXPANDINGA = TVN_FIRST-5;
  4409. TVN_ITEMEXPANDEDA = TVN_FIRST-6;
  4410. TVN_BEGINDRAGA = TVN_FIRST-7;
  4411. TVN_BEGINRDRAGA = TVN_FIRST-8;
  4412. TVN_DELETEITEMA = TVN_FIRST-9;
  4413. TVN_BEGINLABELEDITA = TVN_FIRST-10;
  4414. TVN_ENDLABELEDITA = TVN_FIRST-11;
  4415. TVN_GETINFOTIPA = TVN_FIRST-13;
  4416. TVN_ITEMEXPANDINGW = TVN_FIRST-54;
  4417. TVN_ITEMEXPANDEDW = TVN_FIRST-55;
  4418. TVN_BEGINDRAGW = TVN_FIRST-56;
  4419. TVN_BEGINRDRAGW = TVN_FIRST-57;
  4420. TVN_DELETEITEMW = TVN_FIRST-58;
  4421. TVN_BEGINLABELEDITW = TVN_FIRST-59;
  4422. TVN_ENDLABELEDITW = TVN_FIRST-60;
  4423. TVN_GETINFOTIPW = TVN_FIRST-14;
  4424. {$IFDEF UNICODE}
  4425. TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGW;
  4426. TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDW;
  4427. TVN_BEGINDRAG = TVN_BEGINDRAGW;
  4428. TVN_BEGINRDRAG = TVN_BEGINRDRAGW;
  4429. TVN_DELETEITEM = TVN_DELETEITEMW;
  4430. TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITW;
  4431. TVN_ENDLABELEDIT = TVN_ENDLABELEDITW;
  4432. TVN_GETINFOTIP = TVN_GETINFOTIPW;
  4433. {$ELSE}
  4434. TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA;
  4435. TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA;
  4436. TVN_BEGINDRAG = TVN_BEGINDRAGA;
  4437. TVN_BEGINRDRAG = TVN_BEGINRDRAGA;
  4438. TVN_DELETEITEM = TVN_DELETEITEMA;
  4439. TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA;
  4440. TVN_ENDLABELEDIT = TVN_ENDLABELEDITA;
  4441. TVN_GETINFOTIP = TVN_GETINFOTIPA;
  4442. {$ENDIF}
  4443. const
  4444. TVN_KEYDOWN = TVN_FIRST-12;
  4445. TVN_SINGLEEXPAND = TVN_FIRST-15;
  4446. TVNRET_DEFAULT = 0;
  4447. TVNRET_SKIPOLD = 1;
  4448. TVNRET_SKIPNEW = 2;
  4449. { For IE >= 0x0600 }
  4450. TVN_ITEMCHANGINGA = TVN_FIRST-16;
  4451. TVN_ITEMCHANGINGW = TVN_FIRST-17;
  4452. TVN_ITEMCHANGEDA = TVN_FIRST-18;
  4453. TVN_ITEMCHANGEDW = TVN_FIRST-19;
  4454. TVN_ASYNCDRAW = TVN_FIRST-20;
  4455. {$IFDEF UNICODE}
  4456. TVN_ITEMCHANGING = TVN_ITEMCHANGINGW;
  4457. TVN_ITEMCHANGED = TVN_ITEMCHANGEDW;
  4458. {$ELSE}
  4459. TVN_ITEMCHANGING = TVN_ITEMCHANGINGA;
  4460. TVN_ITEMCHANGED = TVN_ITEMCHANGEDA;
  4461. {$ENDIF}
  4462. type
  4463. tagTVKEYDOWN = packed record
  4464. hdr: TNMHDR;
  4465. wVKey: Word;
  4466. flags: UINT;
  4467. end;
  4468. _TV_KEYDOWN = tagTVKEYDOWN;
  4469. TTVKeyDown = tagTVKEYDOWN;
  4470. TV_KEYDOWN = tagTVKEYDOWN;
  4471. tagNMTVCUSTOMDRAW = packed record
  4472. nmcd: TNMCustomDraw;
  4473. clrText: COLORREF;
  4474. clrTextBk: COLORREF;
  4475. iLevel: Integer;
  4476. end;
  4477. PNMTVCustomDraw = ^TNMTVCustomDraw;
  4478. TNMTVCustomDraw = tagNMTVCUSTOMDRAW;
  4479. // for tooltips
  4480. tagNMTVGETINFOTIPA = record
  4481. hdr: TNMHdr;
  4482. pszText: PAnsiChar;
  4483. cchTextMax: Integer;
  4484. hItem: HTREEITEM;
  4485. lParam: LPARAM;
  4486. end;
  4487. tagNMTVGETINFOTIPW = record
  4488. hdr: TNMHdr;
  4489. pszText: PWideChar;
  4490. cchTextMax: Integer;
  4491. hItem: HTREEITEM;
  4492. lParam: LPARAM;
  4493. end;
  4494. tagNMTVGETINFOTIP = tagNMTVGETINFOTIPW;
  4495. PNMTVGetInfoTipA = ^TNMTVGetInfoTipA;
  4496. PNMTVGetInfoTipW = ^TNMTVGetInfoTipW;
  4497. PNMTVGetInfoTip = PNMTVGetInfoTipW;
  4498. TNMTVGetInfoTipA = tagNMTVGETINFOTIPA;
  4499. TNMTVGetInfoTipW = tagNMTVGETINFOTIPW;
  4500. TNMTVGetInfoTip = TNMTVGetInfoTipW;
  4501. const
  4502. // treeview's customdraw return meaning don't draw images. valid on CDRF_NOTIFYITEMPREPAINT
  4503. TVCDRF_NOIMAGES = $00010000;
  4504. type
  4505. { For IE >= 0x0600 }
  4506. { $EXTERNALSYM tagNMTVITEMCHANGE}
  4507. tagNMTVITEMCHANGE = packed record
  4508. hdr: NMHDR;
  4509. uChanged: UINT;
  4510. hItem: HTREEITEM;
  4511. uStateNew: UINT;
  4512. uStateOld: UINT;
  4513. lParam: LPARAM;
  4514. end;
  4515. PNMTVItemChange = ^TNMTVItemChange;
  4516. TNMTVItemChange = tagNMTVITEMCHANGE;
  4517. { ====== ComboBoxEx ======================== }
  4518. const
  4519. WC_COMBOBOXEX = 'ComboBoxEx32';
  4520. CBEIF_TEXT = $00000001;
  4521. CBEIF_IMAGE = $00000002;
  4522. CBEIF_SELECTEDIMAGE = $00000004;
  4523. CBEIF_OVERLAY = $00000008;
  4524. CBEIF_INDENT = $00000010;
  4525. CBEIF_LPARAM = $00000020;
  4526. CBEIF_DI_SETITEM = $10000000;
  4527. type
  4528. tagCOMBOBOXEXITEMA = record
  4529. mask: UINT;
  4530. iItem: Integer;
  4531. pszText: PAnsiChar;
  4532. cchTextMax: Integer;
  4533. iImage: Integer;
  4534. iSelectedImage: Integer;
  4535. iOverlay: Integer;
  4536. iIndent: Integer;
  4537. lParam: LPARAM;
  4538. end;
  4539. tagCOMBOBOXEXITEMW = record
  4540. mask: UINT;
  4541. iItem: Integer;
  4542. pszText: PWideChar;
  4543. cchTextMax: Integer;
  4544. iImage: Integer;
  4545. iSelectedImage: Integer;
  4546. iOverlay: Integer;
  4547. iIndent: Integer;
  4548. lParam: LPARAM;
  4549. end;
  4550. tagCOMBOBOXEXITEM = tagCOMBOBOXEXITEMW;
  4551. PComboBoxExItemA = ^TComboBoxExItemA;
  4552. PComboBoxExItemW = ^TComboBoxExItemW;
  4553. PComboBoxExItem = PComboBoxExItemW;
  4554. TComboBoxExItemA = tagCOMBOBOXEXITEMA;
  4555. TComboBoxExItemW = tagCOMBOBOXEXITEMW;
  4556. TComboBoxExItem = TComboBoxExItemW;
  4557. const
  4558. CBEM_INSERTITEMA = WM_USER + 1;
  4559. CBEM_SETIMAGELIST = WM_USER + 2;
  4560. CBEM_GETIMAGELIST = WM_USER + 3;
  4561. CBEM_GETITEMA = WM_USER + 4;
  4562. CBEM_SETITEMA = WM_USER + 5;
  4563. CBEM_DELETEITEM = CB_DELETESTRING;
  4564. CBEM_GETCOMBOCONTROL = WM_USER + 6;
  4565. CBEM_GETEDITCONTROL = WM_USER + 7;
  4566. CBEM_SETEXSTYLE = WM_USER + 8; // use SETEXTENDEDSTYLE instead
  4567. CBEM_GETEXSTYLE = WM_USER + 9; // use GETEXTENDEDSTYLE instead
  4568. CBEM_GETEXTENDEDSTYLE = WM_USER + 9;
  4569. CBEM_HASEDITCHANGED = WM_USER + 10;
  4570. CBEM_INSERTITEMW = WM_USER + 11;
  4571. CBEM_SETITEMW = WM_USER + 12;
  4572. CBEM_GETITEMW = WM_USER + 13;
  4573. CBEM_SETEXTENDEDSTYLE = WM_USER + 14; // lparam == new style, wParam (optional) == mask
  4574. CBEM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  4575. CBEM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  4576. { For Windows >= XP }
  4577. CBEM_SETWINDOWTHEME = CCM_SETWINDOWTHEME;
  4578. {$IFDEF UNICODE}
  4579. CBEM_INSERTITEM = CBEM_INSERTITEMW;
  4580. CBEM_SETITEM = CBEM_SETITEMW;
  4581. CBEM_GETITEM = CBEM_GETITEMW;
  4582. {$ELSE}
  4583. CBEM_INSERTITEM = CBEM_INSERTITEMA;
  4584. CBEM_SETITEM = CBEM_SETITEMA;
  4585. CBEM_GETITEM = CBEM_GETITEMA;
  4586. {$ENDIF}
  4587. CBES_EX_NOEDITIMAGE = $00000001;
  4588. CBES_EX_NOEDITIMAGEINDENT = $00000002;
  4589. CBES_EX_PATHWORDBREAKPROC = $00000004;
  4590. CBES_EX_NOSIZELIMIT = $00000008;
  4591. CBES_EX_CASESENSITIVE = $00000010;
  4592. { For Windows >= Vista }
  4593. CBES_EX_TEXTENDELLIPSIS = $00000020;
  4594. type
  4595. NMCOMBOBOXEXA = record
  4596. hdr: TNMHdr;
  4597. ceItem: TComboBoxExItemA;
  4598. end;
  4599. NMCOMBOBOXEXW = record
  4600. hdr: TNMHdr;
  4601. ceItem: TComboBoxExItemW;
  4602. end;
  4603. NMCOMBOBOXEX = NMCOMBOBOXEXW;
  4604. PNMComboBoxExA = ^TNMComboBoxExA;
  4605. PNMComboBoxExW = ^TNMComboBoxExW;
  4606. PNMComboBoxEx = PNMComboBoxExW;
  4607. TNMComboBoxExA = NMCOMBOBOXEXA;
  4608. TNMComboBoxExW = NMCOMBOBOXEXW;
  4609. TNMComboBoxEx = TNMComboBoxExW;
  4610. const
  4611. CBEN_GETDISPINFOA = CBEN_FIRST - 0;
  4612. CBEN_INSERTITEM = CBEN_FIRST - 1;
  4613. CBEN_DELETEITEM = CBEN_FIRST - 2;
  4614. CBEN_BEGINEDIT = CBEN_FIRST - 4;
  4615. CBEN_ENDEDITA = CBEN_FIRST - 5; // lParam specifies why the endedit is happening
  4616. CBEN_ENDEDITW = CBEN_FIRST - 6;
  4617. CBEN_GETDISPINFOW = CBEN_FIRST - 7;
  4618. CBEN_DRAGBEGINA = CBEN_FIRST - 8;
  4619. CBEN_DRAGBEGINW = CBEN_FIRST - 9;
  4620. {$IFDEF UNICODE}
  4621. CBEN_ENDEDIT = CBEN_ENDEDITW;
  4622. CBEN_GETDISPINFO = CBEN_GETDISPINFOW;
  4623. CBEN_DRAGBEGIN = CBEN_DRAGBEGINW;
  4624. {$ELSE}
  4625. CBEN_ENDEDIT = CBEN_ENDEDITA;
  4626. CBEN_GETDISPINFO = CBEN_GETDISPINFOA;
  4627. CBEN_DRAGBEGIN = CBEN_DRAGBEGINA;
  4628. {$ENDIF}
  4629. CBENF_KILLFOCUS = 1;
  4630. CBENF_RETURN = 2;
  4631. CBENF_ESCAPE = 3;
  4632. CBENF_DROPDOWN = 4;
  4633. CBEMAXSTRLEN = 260;
  4634. type
  4635. // CBEN_DRAGBEGIN sends this information ...
  4636. NMCBEDRAGBEGINA = record
  4637. hdr: TNMHdr;
  4638. iItemid: Integer;
  4639. szText: array[0..CBEMAXSTRLEN - 1] of AnsiChar;
  4640. end;
  4641. NMCBEDRAGBEGINW = record
  4642. hdr: TNMHdr;
  4643. iItemid: Integer;
  4644. szText: array[0..CBEMAXSTRLEN - 1] of WideChar;
  4645. end;
  4646. NMCBEDRAGBEGIN = NMCBEDRAGBEGINW;
  4647. PNMCBEDragBeginA = ^TNMCBEDragBeginA;
  4648. PNMCBEDragBeginW = ^TNMCBEDragBeginW;
  4649. PNMCBEDragBegin = PNMCBEDragBeginW;
  4650. TNMCBEDragBeginA = NMCBEDRAGBEGINA;
  4651. TNMCBEDragBeginW = NMCBEDRAGBEGINW;
  4652. TNMCBEDragBegin = TNMCBEDragBeginW;
  4653. // CBEN_ENDEDIT sends this information...
  4654. // fChanged if the user actually did anything
  4655. // iNewSelection gives what would be the new selection unless the notify is failed
  4656. // iNewSelection may be CB_ERR if there's no match
  4657. NMCBEENDEDITA = record
  4658. hdr: TNMHdr;
  4659. fChanged: BOOL;
  4660. iNewSelection: Integer;
  4661. szText: array[0..CBEMAXSTRLEN - 1] of AnsiChar;
  4662. iWhy: Integer;
  4663. end;
  4664. NMCBEENDEDITW = record
  4665. hdr: TNMHdr;
  4666. fChanged: BOOL;
  4667. iNewSelection: Integer;
  4668. szText: array[0..CBEMAXSTRLEN - 1] of WideChar;
  4669. iWhy: Integer;
  4670. end;
  4671. NMCBEENDEDIT = NMCBEENDEDITW;
  4672. PNMCBEEndEditA = ^TNMCBEEndEditA;
  4673. PNMCBEEndEditW = ^TNMCBEEndEditW;
  4674. PNMCBEEndEdit = PNMCBEEndEditW;
  4675. TNMCBEEndEditA = NMCBEENDEDITA;
  4676. TNMCBEEndEditW = NMCBEENDEDITW;
  4677. TNMCBEEndEdit = TNMCBEEndEditW;
  4678. { ====== TAB CONTROL ======================== }
  4679. const
  4680. WC_TABCONTROL = 'SysTabControl32';
  4681. const
  4682. TCS_SCROLLOPPOSITE = $0001; // assumes multiline tab
  4683. TCS_BOTTOM = $0002;
  4684. TCS_RIGHT = $0002;
  4685. TCS_MULTISELECT = $0004; // allow multi-select in button mode
  4686. TCS_FLATBUTTONS = $0008;
  4687. TCS_FORCEICONLEFT = $0010;
  4688. TCS_FORCELABELLEFT = $0020;
  4689. TCS_HOTTRACK = $0040;
  4690. TCS_VERTICAL = $0080;
  4691. TCS_TABS = $0000;
  4692. TCS_BUTTONS = $0100;
  4693. TCS_SINGLELINE = $0000;
  4694. TCS_MULTILINE = $0200;
  4695. TCS_RIGHTJUSTIFY = $0000;
  4696. TCS_FIXEDWIDTH = $0400;
  4697. TCS_RAGGEDRIGHT = $0800;
  4698. TCS_FOCUSONBUTTONDOWN = $1000;
  4699. TCS_OWNERDRAWFIXED = $2000;
  4700. TCS_TOOLTIPS = $4000;
  4701. TCS_FOCUSNEVER = $8000;
  4702. TCS_EX_FLATSEPARATORS = $00000001;
  4703. TCS_EX_REGISTERDROP = $00000002;
  4704. TCM_GETIMAGELIST = TCM_FIRST + 2;
  4705. TCM_SETIMAGELIST = TCM_FIRST + 3;
  4706. TCM_GETITEMCOUNT = TCM_FIRST + 4;
  4707. TCM_DELETEITEM = TCM_FIRST + 8;
  4708. TCM_DELETEALLITEMS = TCM_FIRST + 9;
  4709. TCM_GETITEMRECT = TCM_FIRST + 10;
  4710. TCM_GETCURSEL = TCM_FIRST + 11;
  4711. TCM_SETCURSEL = TCM_FIRST + 12;
  4712. TCM_HITTEST = TCM_FIRST + 13;
  4713. TCM_SETITEMEXTRA = TCM_FIRST + 14;
  4714. TCM_ADJUSTRECT = TCM_FIRST + 40;
  4715. TCM_SETITEMSIZE = TCM_FIRST + 41;
  4716. TCM_REMOVEIMAGE = TCM_FIRST + 42;
  4717. TCM_SETPADDING = TCM_FIRST + 43;
  4718. TCM_GETROWCOUNT = TCM_FIRST + 44;
  4719. TCM_GETTOOLTIPS = TCM_FIRST + 45;
  4720. TCM_SETTOOLTIPS = TCM_FIRST + 46;
  4721. TCM_GETCURFOCUS = TCM_FIRST + 47;
  4722. TCM_SETCURFOCUS = TCM_FIRST + 48;
  4723. TCM_SETMINTABWIDTH = TCM_FIRST + 49;
  4724. TCM_DESELECTALL = TCM_FIRST + 50;
  4725. TCM_HIGHLIGHTITEM = TCM_FIRST + 51;
  4726. TCM_SETEXTENDEDSTYLE = TCM_FIRST + 52; // optional wParam == mask
  4727. TCM_GETEXTENDEDSTYLE = TCM_FIRST + 53;
  4728. TCM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  4729. TCM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  4730. TCIF_TEXT = $0001;
  4731. TCIF_IMAGE = $0002;
  4732. TCIF_RTLREADING = $0004;
  4733. TCIF_PARAM = $0008;
  4734. TCIF_STATE = $0010;
  4735. TCIS_BUTTONPRESSED = $0001;
  4736. TCIS_HIGHLIGHTED = $0002;
  4737. type
  4738. PTCItemHeaderA = ^TTCItemHeaderA;
  4739. PTCItemHeaderW = ^TTCItemHeaderW;
  4740. PTCItemHeader = PTCItemHeaderW;
  4741. tagTCITEMHEADERA = record
  4742. mask: UINT;
  4743. lpReserved1: UINT;
  4744. lpReserved2: UINT;
  4745. pszText: PAnsiChar;
  4746. cchTextMax: Integer;
  4747. iImage: Integer;
  4748. end;
  4749. tagTCITEMHEADERW = record
  4750. mask: UINT;
  4751. lpReserved1: UINT;
  4752. lpReserved2: UINT;
  4753. pszText: PWideChar;
  4754. cchTextMax: Integer;
  4755. iImage: Integer;
  4756. end;
  4757. tagTCITEMHEADER = tagTCITEMHEADERW;
  4758. _TC_ITEMHEADERA = tagTCITEMHEADERA;
  4759. _TC_ITEMHEADERW = tagTCITEMHEADERW;
  4760. _TC_ITEMHEADER = _TC_ITEMHEADERW;
  4761. TTCItemHeaderA = tagTCITEMHEADERA;
  4762. TTCItemHeaderW = tagTCITEMHEADERW;
  4763. TTCItemHeader = TTCItemHeaderW;
  4764. TC_ITEMHEADERA = tagTCITEMHEADERA;
  4765. TC_ITEMHEADERW = tagTCITEMHEADERW;
  4766. TC_ITEMHEADER = TC_ITEMHEADERW;
  4767. PTCItemA = ^TTCItemA;
  4768. PTCItemW = ^TTCItemW;
  4769. PTCItem = PTCItemW;
  4770. tagTCITEMA = record
  4771. mask: UINT;
  4772. dwState: UINT;
  4773. dwStateMask: UINT;
  4774. pszText: PAnsiChar;
  4775. cchTextMax: Integer;
  4776. iImage: Integer;
  4777. lParam: LPARAM;
  4778. end;
  4779. tagTCITEMW = record
  4780. mask: UINT;
  4781. dwState: UINT;
  4782. dwStateMask: UINT;
  4783. pszText: PWideChar;
  4784. cchTextMax: Integer;
  4785. iImage: Integer;
  4786. lParam: LPARAM;
  4787. end;
  4788. tagTCITEM = tagTCITEMW;
  4789. _TC_ITEMA = tagTCITEMA;
  4790. _TC_ITEMW = tagTCITEMW;
  4791. _TC_ITEM = _TC_ITEMW;
  4792. TTCItemA = tagTCITEMA;
  4793. TTCItemW = tagTCITEMW;
  4794. TTCItem = TTCItemW;
  4795. TC_ITEMA = tagTCITEMA;
  4796. TC_ITEMW = tagTCITEMW;
  4797. TC_ITEM = TC_ITEMW;
  4798. const
  4799. TCM_GETITEMA = TCM_FIRST + 5;
  4800. TCM_SETITEMA = TCM_FIRST + 6;
  4801. TCM_INSERTITEMA = TCM_FIRST + 7;
  4802. TCM_GETITEMW = TCM_FIRST + 60;
  4803. TCM_SETITEMW = TCM_FIRST + 61;
  4804. TCM_INSERTITEMW = TCM_FIRST + 62;
  4805. {$IFDEF UNICODE}
  4806. TCM_GETITEM = TCM_GETITEMW;
  4807. TCM_SETITEM = TCM_SETITEMW;
  4808. TCM_INSERTITEM = TCM_INSERTITEMW;
  4809. {$ELSE}
  4810. TCM_GETITEM = TCM_GETITEMA;
  4811. TCM_SETITEM = TCM_SETITEMA;
  4812. TCM_INSERTITEM = TCM_INSERTITEMA;
  4813. {$ENDIF}
  4814. const
  4815. TCHT_NOWHERE = $0001;
  4816. TCHT_ONITEMICON = $0002;
  4817. TCHT_ONITEMLABEL = $0004;
  4818. TCHT_ONITEM = TCHT_ONITEMICON or TCHT_ONITEMLABEL;
  4819. type
  4820. PTCHitTestInfo = ^TTCHitTestInfo;
  4821. tagTCHITTESTINFO = packed record
  4822. pt: TPoint;
  4823. flags: UINT;
  4824. end;
  4825. _TC_HITTESTINFO = tagTCHITTESTINFO;
  4826. TTCHitTestInfo = tagTCHITTESTINFO;
  4827. TC_HITTESTINFO = tagTCHITTESTINFO;
  4828. tagTCKEYDOWN = packed record
  4829. hdr: TNMHDR;
  4830. wVKey: Word;
  4831. flags: UINT;
  4832. end;
  4833. _TC_KEYDOWN = tagTCKEYDOWN;
  4834. TTCKeyDown = tagTCKEYDOWN;
  4835. TC_KEYDOWN = tagTCKEYDOWN;
  4836. const
  4837. TCN_KEYDOWN = TCN_FIRST - 0;
  4838. TCN_SELCHANGE = TCN_FIRST - 1;
  4839. TCN_SELCHANGING = TCN_FIRST - 2;
  4840. TCN_GETOBJECT = TCN_FIRST - 3;
  4841. function TabCtrl_HitTest(hwndTC: HWND; pinfo: PTCHitTestInfo): Integer; overload; {inline;}
  4842. function TabCtrl_HitTest(hwndTC: HWND; const pinfo: TTCHitTestInfo): Integer; overload; {inline;}
  4843. function TabCtrl_SetItemExtra(hwndTC: HWND; cb: Integer): BOOL; {inline;}
  4844. function TabCtrl_AdjustRect(hwnd: HWND; bLarger: BOOL; prc: PRect): Integer; {inline;}
  4845. function TabCtrl_SetItemSize(hwnd: HWND; x, y: Integer): DWORD;
  4846. procedure TabCtrl_RemoveImage(hwnd: HWND; i: Integer);
  4847. procedure TabCtrl_SetPadding(hwnd: HWND; cx, cy: Integer);
  4848. function TabCtrl_GetRowCount(hwnd: HWND): Integer; {inline;}
  4849. function TabCtrl_GetToolTips(wnd: HWND): HWND; {inline;}
  4850. procedure TabCtrl_SetToolTips(hwnd: HWND; hwndTT: HWND);
  4851. function TabCtrl_GetCurFocus(hwnd: HWND): Integer; {inline;}
  4852. procedure TabCtrl_SetCurFocus(hwnd: HWND; i: Integer);
  4853. function TabCtrl_SetMinTabWidth(hwnd: HWND; x: Integer): Integer; {inline;}
  4854. procedure TabCtrl_DeselectAll(hwnd: HWND; fExcludeFocus: BOOL);
  4855. function TabCtrl_HighlightItem(hwnd: HWND; i: Integer; fHighlight: WordBool): BOOL;
  4856. function TabCtrl_SetExtendedStyle(hwnd: HWND; dw: DWORD): DWORD; {inline;}
  4857. function TabCtrl_GetExtendedStyle(hwnd: HWND): DWORD; {inline;}
  4858. function TabCtrl_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL; {inline;}
  4859. function TabCtrl_GetUnicodeFormat(hwnd: HWND): BOOL; {inline;}
  4860. function TabCtrl_GetItemRect(hwnd: HWND; i: Integer; var prc: TRect): BOOL; {inline;}
  4861. { ====== ANIMATE CONTROL ================= }
  4862. const
  4863. ANIMATE_CLASS = 'SysAnimate32';
  4864. const
  4865. ACS_CENTER = $0001;
  4866. ACS_TRANSPARENT = $0002;
  4867. ACS_AUTOPLAY = $0004;
  4868. ACS_TIMER = $0008; { don't use threads... use timers }
  4869. ACM_OPENA = WM_USER + 100;
  4870. ACM_OPENW = WM_USER + 103;
  4871. {$IFDEF UNICODE}
  4872. ACM_OPEN = ACM_OPENW;
  4873. {$ELSE}
  4874. ACM_OPEN = ACM_OPENA;
  4875. {$ENDIF}
  4876. ACM_PLAY = WM_USER + 101;
  4877. ACM_STOP = WM_USER + 102;
  4878. ACN_START = 1;
  4879. ACN_STOP = 2;
  4880. function Animate_Create(hwndP: HWND; id: HMENU; dwStyle: DWORD; hInstance: HINST): HWND;
  4881. function Animate_Open(hwnd: HWND; szName: PChar): BOOL; {inline;}
  4882. function Animate_OpenEx(hwnd: HWND; hInst: HINST; szName: PChar): BOOL; {inline;}
  4883. function Animate_Play(hwnd: HWND; from, _to: Word; rep: UINT): BOOL;
  4884. function Animate_Stop(hwnd: HWND): BOOL; {inline;}
  4885. function Animate_Close(hwnd: HWND): BOOL; {inline;}
  4886. function Animate_Seek(hwnd: HWND; frame: Word): BOOL; {inline;}
  4887. { ====== MONTHCAL CONTROL ========= }
  4888. const
  4889. MONTHCAL_CLASS = 'SysMonthCal32';
  4890. const
  4891. // Message constants
  4892. MCM_FIRST = $1000;
  4893. MCM_GETCURSEL = MCM_FIRST + 1;
  4894. MCM_SETCURSEL = MCM_FIRST + 2;
  4895. MCM_GETMAXSELCOUNT = MCM_FIRST + 3;
  4896. MCM_SETMAXSELCOUNT = MCM_FIRST + 4;
  4897. MCM_GETSELRANGE = MCM_FIRST + 5;
  4898. MCM_SETSELRANGE = MCM_FIRST + 6;
  4899. MCM_GETMONTHRANGE = MCM_FIRST + 7;
  4900. MCM_SETDAYSTATE = MCM_FIRST + 8;
  4901. MCM_GETMINREQRECT = MCM_FIRST + 9;
  4902. MCM_SETCOLOR = MCM_FIRST + 10;
  4903. MCM_GETCOLOR = MCM_FIRST + 11;
  4904. MCM_SETTODAY = MCM_FIRST + 12;
  4905. MCM_GETTODAY = MCM_FIRST + 13;
  4906. MCM_HITTEST = MCM_FIRST + 14;
  4907. MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15;
  4908. MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16;
  4909. MCM_GETRANGE = MCM_FIRST + 17;
  4910. MCM_SETRANGE = MCM_FIRST + 18;
  4911. MCM_GETMONTHDELTA = MCM_FIRST + 19;
  4912. MCM_SETMONTHDELTA = MCM_FIRST + 20;
  4913. MCM_GETMAXTODAYWIDTH = MCM_FIRST + 21;
  4914. MCM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;
  4915. MCM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;
  4916. // Hit test flags
  4917. MCHT_TITLE = $00010000;
  4918. MCHT_CALENDAR = $00020000;
  4919. MCHT_TODAYLINK = $00030000;
  4920. MCHT_NEXT = $01000000; // these indicate that hitting
  4921. MCHT_PREV = $02000000; // here will go to the next/prev month
  4922. MCHT_NOWHERE = $00000000;
  4923. MCHT_TITLEBK = MCHT_TITLE;
  4924. MCHT_TITLEMONTH = MCHT_TITLE or $0001;
  4925. MCHT_TITLEYEAR = MCHT_TITLE or $0002;
  4926. MCHT_TITLEBTNNEXT = MCHT_TITLE or MCHT_NEXT or $0003;
  4927. MCHT_TITLEBTNPREV = MCHT_TITLE or MCHT_PREV or $0003;
  4928. MCHT_CALENDARBK = MCHT_CALENDAR;
  4929. MCHT_CALENDARDATE = MCHT_CALENDAR or $0001;
  4930. MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT;
  4931. MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV;
  4932. MCHT_CALENDARDAY = MCHT_CALENDAR or $0002;
  4933. MCHT_CALENDARWEEKNUM = MCHT_CALENDAR or $0003;
  4934. // Color codes
  4935. MCSC_BACKGROUND = 0; // the background color (between months)
  4936. MCSC_TEXT = 1; // the dates
  4937. MCSC_TITLEBK = 2; // background of the title
  4938. MCSC_TITLETEXT = 3;
  4939. MCSC_MONTHBK = 4; // background within the month cal
  4940. MCSC_TRAILINGTEXT = 5; // the text color of header & trailing days
  4941. // Notification codes
  4942. MCN_SELCHANGE = MCN_FIRST + 1;
  4943. MCN_GETDAYSTATE = MCN_FIRST + 3;
  4944. MCN_SELECT = MCN_FIRST + 4;
  4945. // Style flags
  4946. MCS_DAYSTATE = $0001;
  4947. MCS_MULTISELECT = $0002;
  4948. MCS_WEEKNUMBERS = $0004;
  4949. MCS_NOTODAY_PRE_IE4 = $0008;
  4950. MCS_NOTODAYCIRCLE = $0008;
  4951. MCS_NOTODAY = $0010;
  4952. GMR_VISIBLE = 0; // visible portion of display
  4953. GMR_DAYSTATE = 1; // above plus the grayed out parts of
  4954. // partially displayed months
  4955. type
  4956. // bit-packed array of "bold" info for a month
  4957. // if a bit is on, that day is drawn bold
  4958. MONTHDAYSTATE = DWORD;
  4959. PMonthDayState = ^TMonthDayState;
  4960. TMonthDayState = MONTHDAYSTATE;
  4961. MCHITTESTINFO = packed record
  4962. cbSize: UINT;
  4963. pt: TPoint;
  4964. uHit: UINT; // out param
  4965. st: TSystemTime;
  4966. end;
  4967. PMCHitTestInfo = ^TMCHitTestInfo;
  4968. TMCHitTestInfo = MCHITTESTINFO;
  4969. // MCN_SELCHANGE is sent whenever the currently displayed date changes
  4970. // via month change, year change, keyboard navigation, prev/next button
  4971. tagNMSELCHANGE = packed record
  4972. nmhdr: TNmHdr; // this must be first, so we don't break WM_NOTIFY
  4973. stSelStart: TSystemTime;
  4974. stSelEnd: TSystemTime;
  4975. end;
  4976. PNMSelChange = ^TNMSelChange;
  4977. TNMSelChange = tagNMSELCHANGE;
  4978. // MCN_GETDAYSTATE is sent for MCS_DAYSTATE controls whenever new daystate
  4979. // information is needed (month or year scroll) to draw bolding information.
  4980. // The app must fill in cDayState months worth of information starting from
  4981. // stStart date. The app may fill in the array at prgDayState or change
  4982. // prgDayState to point to a different array out of which the information
  4983. // will be copied. (similar to tooltips)
  4984. tagNMDAYSTATE = packed record
  4985. nmhdr: TNmHdr; // this must be first, so we don't break WM_NOTIFY
  4986. stStart: TSystemTime;
  4987. cDayState: Integer;
  4988. prgDayState: PMonthDayState; // points to cDayState TMONTHDAYSTATEs
  4989. end;
  4990. PNMDayState = ^TNMDayState;
  4991. TNMDayState = tagNMDAYSTATE;
  4992. // MCN_SELECT is sent whenever a selection has occured (via mouse or keyboard)
  4993. NMSELECT = tagNMSELCHANGE;
  4994. PNMSelect = ^TNMSelect;
  4995. TNMSelect = NMSELECT;
  4996. TSystemTimeRangeArray = array[0..1] of TSystemTime;
  4997. // returns FALSE if MCS_MULTISELECT
  4998. // returns TRUE and sets *pst to the currently selected date otherwise
  4999. function MonthCal_GetCurSel(hmc: HWND; var pst: TSystemTime): BOOL; {inline;}
  5000. // returns FALSE if MCS_MULTISELECT
  5001. // returns TURE and sets the currently selected date to *pst otherwise
  5002. function MonthCal_SetCurSel(hmc: HWND; const pst: TSystemTime): BOOL; {inline;}
  5003. // returns the maximum number of selectable days allowed
  5004. function MonthCal_GetMaxSelCount(hmc: HWND): DWORD; {inline;}
  5005. // sets the max number days that can be selected iff MCS_MULTISELECT
  5006. function MonthCal_SetMaxSelCount(hmc: HWND; n: UINT): BOOL; {inline;}
  5007. // sets rgst[0] to the first day of the selection range
  5008. // sets rgst[1] to the last day of the selection range
  5009. function MonthCal_GetSelRange(hmc: HWND; rgst: PSystemTime): BOOL; {inline;}
  5010. // selects the range of days from rgst[0] to rgst[1]
  5011. function MonthCal_SetSelRange(hmc: HWND; rgst: PSystemTime): BOOL; {inline;}
  5012. // if rgst specified, sets rgst[0] to the starting date and
  5013. // and rgst[1] to the ending date of the the selectable (non-grayed)
  5014. // days if GMR_VISIBLE or all the displayed days (including grayed)
  5015. // if GMR_DAYSTATE.
  5016. // returns the number of months spanned by the above range.
  5017. function MonthCal_GetMonthRange(hmc: HWND; gmr: DWORD; rgst: PSystemTime): DWORD; {inline;}
  5018. // cbds is the count of DAYSTATE items in rgds and it must be equal
  5019. // to the value returned from MonthCal_GetMonthRange(hmc, GMR_DAYSTATE, NULL)
  5020. // This sets the DAYSTATE bits for each month (grayed and non-grayed
  5021. // days) displayed in the calendar. The first bit in a month's DAYSTATE
  5022. // corresponts to bolding day 1, the second bit affects day 2, etc.
  5023. function MonthCal_SetDayState(hmc: HWND; cbds: Integer; const rgds: TNMDayState): BOOL; {inline;}
  5024. // sets prc the minimal size needed to display one month
  5025. function MonthCal_GetMinReqRect(hmc: HWND; var prc: TRect): BOOL; {inline;}
  5026. // set what day is "today" send NULL to revert back to real date
  5027. function MonthCal_SetToday(hmc: HWND; const pst: TSystemTime): BOOL; {inline;}
  5028. // get what day is "today"
  5029. // returns BOOL for success/failure
  5030. function MonthCal_GetToday(hmc: HWND; var pst: TSystemTime): BOOL; {inline;}
  5031. // determine what pinfo->pt is over
  5032. function MonthCal_HitTest(hmc: HWND; var info: TMCHitTestInfo): DWORD; {inline;}
  5033. // set colors to draw control with -- see MCSC_ bits below
  5034. function MonthCal_SetColor(hmc: HWND; iColor: Integer; clr: TColorRef): TColorRef; {inline;}
  5035. function MonthCal_GetColor(hmc: HWND; iColor: Integer): TColorRef; {inline;}
  5036. // set first day of week to iDay:
  5037. // 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
  5038. // -1 for means use locale info
  5039. function MonthCal_SetFirstDayOfWeek(hmc: HWND; iDay: Integer): Integer; {inline;}
  5040. // DWORD result... low word has the day. high word is bool if this is app set
  5041. // or not (FALSE == using locale info)
  5042. function MonthCal_GetFirstDayOfWeek(hmc: HWND): Integer; {inline;}
  5043. // modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  5044. // modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  5045. // returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  5046. function MonthCal_GetRange(hmc: HWND; rgst: PSystemTime): DWORD; {inline;}
  5047. // if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  5048. // if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  5049. // returns TRUE on success, FALSE on error (such as invalid parameters)
  5050. function Monthcal_SetRange(hmc: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL; {inline;}
  5051. // returns the number of months one click on a next/prev button moves by
  5052. function MonthCal_GetMonthDelta(hmc: HWND): Integer; {inline;}
  5053. // sets the month delta to n. n = 0 reverts to moving by a page of months
  5054. // returns the previous value of n.
  5055. function MonthCal_SetMonthDelta(hmc: HWND; n: Integer): Integer; {inline;}
  5056. // sets *psz to the maximum width/height of the "Today" string displayed
  5057. // at the bottom of the calendar (as long as MCS_NOTODAY is not specified)
  5058. function MonthCal_GetMaxTodayWidth(hmc: HWND): DWORD; {inline;}
  5059. function MonthCal_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL; {inline;}
  5060. function MonthCal_GetUnicodeFormat(hwnd: HWND): BOOL; {inline;}
  5061. { ====== DATETIMEPICK CONTROL =============== }
  5062. const
  5063. DATETIMEPICK_CLASS = 'SysDateTimePick32';
  5064. // Message constants
  5065. DTM_FIRST = $1000;
  5066. DTM_GETSYSTEMTIME = DTM_FIRST + 1;
  5067. DTM_SETSYSTEMTIME = DTM_FIRST + 2;
  5068. DTM_GETRANGE = DTM_FIRST + 3;
  5069. DTM_SETRANGE = DTM_FIRST + 4;
  5070. DTM_SETFORMATA = DTM_FIRST + 5;
  5071. DTM_SETMCCOLOR = DTM_FIRST + 6;
  5072. DTM_GETMCCOLOR = DTM_FIRST + 7;
  5073. DTM_GETMONTHCAL = DTM_FIRST + 8;
  5074. DTM_SETMCFONT = DTM_FIRST + 9;
  5075. DTM_GETMCFONT = DTM_FIRST + 10;
  5076. DTM_SETFORMATW = DTM_FIRST + 50;
  5077. {$IFDEF UNICODE}
  5078. DTM_SETFORMAT = DTM_SETFORMATW;
  5079. {$ELSE}
  5080. DTM_SETFORMAT = DTM_SETFORMATA;
  5081. {$ENDIF}
  5082. // Style Flags
  5083. DTS_UPDOWN = $0001; // use UPDOWN instead of MONTHCAL
  5084. DTS_SHOWNONE = $0002; // allow a NONE selection
  5085. DTS_SHORTDATEFORMAT = $0000; // use the short date format
  5086. // (app must forward WM_WININICHANGE messages)
  5087. DTS_LONGDATEFORMAT = $0004; // use the long date format
  5088. // (app must forward WM_WININICHANGE messages)
  5089. DTS_TIMEFORMAT = $0009; // use the time format
  5090. // (app must forward WM_WININICHANGE messages)
  5091. DTS_APPCANPARSE = $0010; // allow user entered strings
  5092. // (app MUST respond to DTN_USERSTRING)
  5093. DTS_RIGHTALIGN = $0020; // right-align popup instead of left-align it
  5094. // Notification codes
  5095. DTN_DATETIMECHANGE = DTN_FIRST + 1; // the systemtime has changed
  5096. DTN_USERSTRINGA = DTN_FIRST + 2; // the user has entered a string
  5097. DTN_USERSTRINGW = DTN_FIRST + 15;
  5098. DTN_WMKEYDOWNA = DTN_FIRST + 3; // modify keydown on app format field (X)
  5099. DTN_WMKEYDOWNW = DTN_FIRST + 16;
  5100. DTN_FORMATA = DTN_FIRST + 4; // query display for app format field (X)
  5101. DTN_FORMATW = DTN_FIRST + 17;
  5102. DTN_FORMATQUERYA = DTN_FIRST + 5; // query formatting info for app format field (X)
  5103. DTN_FORMATQUERYW = DTN_FIRST + 18;
  5104. DTN_DROPDOWN = DTN_FIRST + 6; // MonthCal has dropped down
  5105. DTN_CLOSEUP = DTN_FIRST + 7; // MonthCal is popping up
  5106. {$IFDEF UNICODE}
  5107. DTN_USERSTRING = DTN_USERSTRINGW;
  5108. DTN_WMKEYDOWN = DTN_WMKEYDOWNW;
  5109. DTN_FORMAT = DTN_FORMATW;
  5110. DTN_FORMATQUERY = DTN_FORMATQUERYW;
  5111. {$ELSE}
  5112. DTN_USERSTRING = DTN_USERSTRINGA;
  5113. DTN_WMKEYDOWN = DTN_WMKEYDOWNA;
  5114. DTN_FORMAT = DTN_FORMATA;
  5115. DTN_FORMATQUERY = DTN_FORMATQUERYA;
  5116. {$ENDIF}
  5117. // Ranges
  5118. GDTR_MIN = $0001;
  5119. GDTR_MAX = $0002;
  5120. // Return Values
  5121. GDT_ERROR = -1;
  5122. GDT_VALID = 0;
  5123. GDT_NONE = 1;
  5124. type
  5125. tagNMDATETIMECHANGE = packed record
  5126. nmhdr: TNmHdr;
  5127. dwFlags: DWORD; // GDT_VALID or GDT_NONE
  5128. st: TSystemTime; // valid iff dwFlags = GDT_VALID
  5129. end;
  5130. PNMDateTimeChange = ^TNMDateTimeChange;
  5131. TNMDateTimeChange = tagNMDATETIMECHANGE;
  5132. tagNMDATETIMESTRINGA = record
  5133. nmhdr: TNmHdr;
  5134. pszUserString: PAnsiChar; // AnsiString user entered
  5135. st: TSystemTime; // app fills this in
  5136. dwFlags: DWORD; // GDT_VALID or GDT_NONE
  5137. end;
  5138. tagNMDATETIMESTRINGW = record
  5139. nmhdr: TNmHdr;
  5140. pszUserString: PWideChar; // UnicodeString user entered
  5141. st: TSystemTime; // app fills this in
  5142. dwFlags: DWORD; // GDT_VALID or GDT_NONE
  5143. end;
  5144. tagNMDATETIMESTRING = tagNMDATETIMESTRINGW;
  5145. PNMDateTimeStringA = ^TNMDateTimeStringA;
  5146. PNMDateTimeStringW = ^TNMDateTimeStringW;
  5147. PNMDateTimeString = PNMDateTimeStringW;
  5148. TNMDateTimeStringA = tagNMDATETIMESTRINGA;
  5149. TNMDateTimeStringW = tagNMDATETIMESTRINGW;
  5150. TNMDateTimeString = TNMDateTimeStringW;
  5151. tagNMDATETIMEWMKEYDOWNA = record
  5152. nmhdr: TNmHdr;
  5153. nVirtKey: Integer; // virtual key code of WM_KEYDOWN which MODIFIES an X field
  5154. pszFormat: PAnsiChar; // format substring
  5155. st: TSystemTime; // current systemtime, app should modify based on key
  5156. end;
  5157. tagNMDATETIMEWMKEYDOWNW = record
  5158. nmhdr: TNmHdr;
  5159. nVirtKey: Integer; // virtual key code of WM_KEYDOWN which MODIFIES an X field
  5160. pszFormat: PWideChar; // format substring
  5161. st: TSystemTime; // current systemtime, app should modify based on key
  5162. end;
  5163. tagNMDATETIMEWMKEYDOWN = tagNMDATETIMEWMKEYDOWNW;
  5164. PNMDateTimeWMKeyDownA = ^TNMDateTimeWMKeyDownA;
  5165. PNMDateTimeWMKeyDownW = ^TNMDateTimeWMKeyDownW;
  5166. PNMDateTimeWMKeyDown = PNMDateTimeWMKeyDownW;
  5167. TNMDateTimeWMKeyDownA = tagNMDATETIMEWMKEYDOWNA;
  5168. TNMDateTimeWMKeyDownW = tagNMDATETIMEWMKEYDOWNW;
  5169. TNMDateTimeWMKeyDown = TNMDateTimeWMKeyDownW;
  5170. tagNMDATETIMEFORMATA = record
  5171. nmhdr: TNmHdr;
  5172. pszFormat: PAnsiChar; // format substring
  5173. st: TSystemTime; // current systemtime
  5174. pszDisplay: PAnsiChar; // AnsiString to display
  5175. szDisplay: array[0..63] of AnsiChar; // buffer pszDisplay originally points at
  5176. end;
  5177. tagNMDATETIMEFORMATW = record
  5178. nmhdr: TNmHdr;
  5179. pszFormat: PWideChar; // format substring
  5180. st: TSystemTime; // current systemtime
  5181. pszDisplay: PWideChar; // UnicodeString to display
  5182. szDisplay: array[0..63] of WideChar; // buffer pszDisplay originally points at
  5183. end;
  5184. tagNMDATETIMEFORMAT = tagNMDATETIMEFORMATW;
  5185. PNMDateTimeFormatA = ^TNMDateTimeFormatA;
  5186. PNMDateTimeFormatW = ^TNMDateTimeFormatW;
  5187. PNMDateTimeFormat = PNMDateTimeFormatW;
  5188. TNMDateTimeFormatA = tagNMDATETIMEFORMATA;
  5189. TNMDateTimeFormatW = tagNMDATETIMEFORMATW;
  5190. TNMDateTimeFormat = TNMDateTimeFormatW;
  5191. tagNMDATETIMEFORMATQUERYA = record
  5192. nmhdr: TNmHdr;
  5193. pszFormat: PAnsiChar; // format substring
  5194. szMax: TSize; // max bounding rectangle app will use for this format AnsiString
  5195. end;
  5196. tagNMDATETIMEFORMATQUERYW = record
  5197. nmhdr: TNmHdr;
  5198. pszFormat: PWideChar; // format substring
  5199. szMax: TSize; // max bounding rectangle app will use for this format UnicodeString
  5200. end;
  5201. tagNMDATETIMEFORMATQUERY = tagNMDATETIMEFORMATQUERYW;
  5202. PNMDateTimeFormatQueryA = ^TNMDateTimeFormatQueryA;
  5203. PNMDateTimeFormatQueryW = ^TNMDateTimeFormatQueryW;
  5204. PNMDateTimeFormatQuery = PNMDateTimeFormatQueryW;
  5205. TNMDateTimeFormatQueryA = tagNMDATETIMEFORMATQUERYA;
  5206. TNMDateTimeFormatQueryW = tagNMDATETIMEFORMATQUERYW;
  5207. TNMDateTimeFormatQuery = TNMDateTimeFormatQueryW;
  5208. // returns GDT_NONE if "none" is selected (DTS_SHOWNONE only)
  5209. // returns GDT_VALID and modifies pst to be the currently selected value
  5210. function DateTime_GetSystemTime(hdp: HWND; var pst: TSystemTime): DWORD; {inline;}
  5211. // if gd = GDT_NONE, sets datetimepick to None (DTS_SHOWNONE only)
  5212. // if gd = GDT_VALID, sets datetimepick to pst
  5213. // returns TRUE on success, FALSE on error (such as bad params)
  5214. function DateTime_SetSystemTime(hdp: HWND; gd: DWORD; const pst: TSystemTime): BOOL; {inline;}
  5215. // modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  5216. // modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  5217. // returns GDTR_MIN or GDTR_MAX if there is a minimum or maximum limit
  5218. function DateTime_GetRange(hdp: HWND; rgst: PSystemTime): DWORD; {inline;}
  5219. // if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  5220. // if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  5221. // returns TRUE on success, FALSE on error (such as invalid parameters)
  5222. function DateTime_SetRange(hdp: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL; {inline;}
  5223. // sets the display formatting string to sz (see GetDateFormat and GetTimeFormat for valid formatting chars)
  5224. // NOTE: 'X' is a valid formatting character which indicates that the application
  5225. // will determine how to display information. Such apps must support DTN_WMKEYDOWN,
  5226. // DTN_FORMAT, and DTN_FORMATQUERY.
  5227. function DateTime_SetFormat(hdp: HWND; sz: PWideChar): BOOL; overload; {inline;}
  5228. function DateTime_SetFormatA(hdp: HWND; sz: PAnsiChar): BOOL; overload; {inline;}
  5229. function DateTime_SetFormatW(hdp: HWND; sz: PWideChar): BOOL; overload; {inline;}
  5230. function DateTime_SetFormat(hdp: HWND; const sz: UnicodeString): BOOL; overload; {inline;}
  5231. function DateTime_SetFormatA(hdp: HWND; const sz: AnsiString): BOOL; overload; {inline;}
  5232. function DateTime_SetFormatW(hdp: HWND; const sz: UnicodeString): BOOL; overload; {inline;}
  5233. function DateTime_SetMonthCalColor(hdp: HWND; iColor: DWORD; clr: TColorRef): TColorRef; {inline;}
  5234. function DateTime_GetMonthCalColor(hdp: HWND; iColor: DWORD): TColorRef; {inline;}
  5235. // returns the HWND of the MonthCal popup window. Only valid
  5236. // between DTN_DROPDOWN and DTN_CLOSEUP notifications.
  5237. function DateTime_GetMonthCal(hdp: HWND): HWND; {inline;}
  5238. procedure DateTime_SetMonthCalFont(hdp: HWND; hfont: HFONT; fRedraw: BOOL); {inline;}
  5239. function DateTime_GetMonthCalFont(hdp: HWND): HFONT; {inline;}
  5240. { ====================== IP Address edit control ============================= }
  5241. const
  5242. WC_IPADDRESS = 'SysIPAddress32';
  5243. // Messages sent to IPAddress controls
  5244. IPM_CLEARADDRESS = WM_USER+100; { no parameters }
  5245. IPM_SETADDRESS = WM_USER+101; { lparam = TCP/IP address }
  5246. IPM_GETADDRESS = WM_USER+102; { lresult = # of non black fields. lparam = LPDWORD for TCP/IP address }
  5247. IPM_SETRANGE = WM_USER+103; { wparam = field, lparam = range }
  5248. IPM_SETFOCUS = WM_USER+104; { wparam = field }
  5249. IPM_ISBLANK = WM_USER+105; { no parameters }
  5250. IPN_FIELDCHANGED = IPN_FIRST - 0;
  5251. type
  5252. tagNMIPADDRESS = packed record
  5253. hdr: NMHDR;
  5254. iField: Integer;
  5255. iValue: Integer;
  5256. end;
  5257. PNMIPAddress = ^TNMIPAddress;
  5258. TNMIPAddress = tagNMIPADDRESS;
  5259. { The following is a useful macro for passing the range values in the }
  5260. { IPM_SETRANGE message. }
  5261. function MAKEIPRANGE(low, high: Byte): LPARAM; {inline;}
  5262. { And this is a useful macro for making the IP Address to be passed }
  5263. { as a LPARAM. }
  5264. function MAKEIPADDRESS(b1, b2, b3, b4: DWORD): LPARAM;
  5265. { Get individual number }
  5266. function FIRST_IPADDRESS(x: DWORD): DWORD; {inline;}
  5267. function SECOND_IPADDRESS(x: DWORD): DWORD; {inline;}
  5268. function THIRD_IPADDRESS(x: DWORD): DWORD; {inline;}
  5269. function FOURTH_IPADDRESS(x: DWORD): DWORD; {inline;}
  5270. { ====================== Pager Control ============================= }
  5271. const
  5272. { Pager Class Name }
  5273. WC_PAGESCROLLER = 'SysPager';
  5274. { Pager Control Styles }
  5275. PGS_VERT = $00000000;
  5276. PGS_HORZ = $00000001;
  5277. PGS_AUTOSCROLL = $00000002;
  5278. PGS_DRAGNDROP = $00000004;
  5279. { Pager Button State }
  5280. { The scroll can be in one of the following control State }
  5281. PGF_INVISIBLE = 0; { Scroll button is not visible }
  5282. PGF_NORMAL = 1; { Scroll button is in normal state }
  5283. PGF_GRAYED = 2; { Scroll button is in grayed state }
  5284. PGF_DEPRESSED = 4; { Scroll button is in depressed state }
  5285. PGF_HOT = 8; { Scroll button is in hot state }
  5286. { The following identifiers specifies the button control }
  5287. PGB_TOPORLEFT = 0;
  5288. PGB_BOTTOMORRIGHT = 1;
  5289. { Pager Control Messages }
  5290. PGM_SETCHILD = PGM_FIRST + 1; { lParam == hwnd }
  5291. PGM_RECALCSIZE = PGM_FIRST + 2;
  5292. PGM_FORWARDMOUSE = PGM_FIRST + 3;
  5293. PGM_SETBKCOLOR = PGM_FIRST + 4;
  5294. PGM_GETBKCOLOR = PGM_FIRST + 5;
  5295. PGM_SETBORDER = PGM_FIRST + 6;
  5296. PGM_GETBORDER = PGM_FIRST + 7;
  5297. PGM_SETPOS = PGM_FIRST + 8;
  5298. PGM_GETPOS = PGM_FIRST + 9;
  5299. PGM_SETBUTTONSIZE = PGM_FIRST + 10;
  5300. PGM_GETBUTTONSIZE = PGM_FIRST + 11;
  5301. PGM_GETBUTTONSTATE = PGM_FIRST + 12;
  5302. PGM_GETDROPTARGET = CCM_GETDROPTARGET;
  5303. procedure Pager_SetChild(hwnd: HWND; hwndChild: HWND); {inline;}
  5304. procedure Pager_RecalcSize(hwnd: HWND); {inline;}
  5305. procedure Pager_ForwardMouse(hwnd: HWND; bForward: BOOL); {inline;}
  5306. function Pager_SetBkColor(hwnd: HWND; clr: COLORREF): COLORREF; {inline;}
  5307. function Pager_GetBkColor(hwnd: HWND): COLORREF; {inline;}
  5308. function Pager_SetBorder(hwnd: HWND; iBorder: Integer): Integer; {inline;}
  5309. function Pager_GetBorder(hwnd: HWND): Integer; {inline;}
  5310. function Pager_SetPos(hwnd: HWND; iPos: Integer): Integer; {inline;}
  5311. function Pager_GetPos(hwnd: HWND): Integer; {inline;}
  5312. function Pager_SetButtonSize(hwnd: HWND; iSize: Integer): Integer; {inline;}
  5313. function Pager_GetButtonSize(hwnd: HWND): Integer; {inline;}
  5314. function Pager_GetButtonState(hwnd: HWND; iButton: Integer): DWORD; {inline;}
  5315. procedure Pager_GetDropTarget(hwnd: HWND; ppdt: Pointer{!!}); {inline;}
  5316. const
  5317. { Pager Control Notification Messages }
  5318. { PGN_SCROLL Notification Message }
  5319. PGN_SCROLL = PGN_FIRST-1;
  5320. PGF_SCROLLUP = 1;
  5321. PGF_SCROLLDOWN = 2;
  5322. PGF_SCROLLLEFT = 4;
  5323. PGF_SCROLLRIGHT = 8;
  5324. { Keys down }
  5325. PGK_SHIFT = 1;
  5326. PGK_CONTROL = 2;
  5327. PGK_MENU = 4;
  5328. type
  5329. { This structure is sent along with PGN_SCROLL notifications }
  5330. NMPGSCROLL = packed record
  5331. hdr: NMHDR;
  5332. fwKeys: Word; { Specifies which keys are down when this notification is send }
  5333. rcParent: TRect; { Contains Parent Window Rect }
  5334. iDir: Integer; { Scrolling Direction }
  5335. iXpos: Integer; { Horizontal scroll position }
  5336. iYpos: Integer; { Vertical scroll position }
  5337. iScroll: Integer; { [in/out] Amount to scroll }
  5338. end;
  5339. PNMPGScroll = ^TNMPGScroll;
  5340. TNMPGScroll = NMPGSCROLL;
  5341. const
  5342. { PGN_CALCSIZE Notification Message }
  5343. PGN_CALCSIZE = PGN_FIRST-2;
  5344. PGF_CALCWIDTH = 1;
  5345. PGF_CALCHEIGHT = 2;
  5346. type
  5347. NMPGCALCSIZE = packed record
  5348. hdr: NMHDR;
  5349. dwFlag: DWORD;
  5350. iWidth: Integer;
  5351. iHeight: Integer;
  5352. end;
  5353. PNMPGCalcSize = ^TNMPGCalcSize;
  5354. TNMPGCalcSize = NMPGCALCSIZE;
  5355. { ====================== Native Font Control ============================== }
  5356. const
  5357. WC_NATIVEFONTCTL = 'NativeFontCtl';
  5358. { style definition }
  5359. NFS_EDIT = $0001;
  5360. NFS_STATIC = $0002;
  5361. NFS_LISTCOMBO = $0004;
  5362. NFS_BUTTON = $0008;
  5363. NFS_ALL = $0010;
  5364. // ====================== Button Control =============================
  5365. // Button Class Name
  5366. const
  5367. WC_BUTTON = 'Button';
  5368. // *** The following Button control declarations require Windows >= XP ***
  5369. BUTTON_IMAGELIST_ALIGN_LEFT = 0;
  5370. BUTTON_IMAGELIST_ALIGN_RIGHT = 1;
  5371. BUTTON_IMAGELIST_ALIGN_TOP = 2;
  5372. BUTTON_IMAGELIST_ALIGN_BOTTOM = 3;
  5373. BUTTON_IMAGELIST_ALIGN_CENTER = 4; // Doesn't draw text
  5374. type
  5375. { $EXTERNALSYM BUTTON_IMAGELIST}
  5376. BUTTON_IMAGELIST = packed record
  5377. himl: HIMAGELIST; // Images: Normal, Hot, Pushed, Disabled. If count is less than 4, we use index 1
  5378. margin: TRect; // Margin around icon.
  5379. uAlign: UINT;
  5380. end;
  5381. PButtonImageList = ^TButtonImageList;
  5382. TButtonImageList = BUTTON_IMAGELIST;
  5383. const
  5384. BCM_GETIDEALSIZE = BCM_FIRST + $0001;
  5385. BCM_SETIMAGELIST = BCM_FIRST + $0002;
  5386. BCM_GETIMAGELIST = BCM_FIRST + $0003;
  5387. BCM_SETTEXTMARGIN = BCM_FIRST + $0004;
  5388. BCM_GETTEXTMARGIN = BCM_FIRST + $0005;
  5389. function Button_GetIdealSize(hwnd: HWND; var psize: TSize): BOOL; {inline;}
  5390. function Button_SetImageList(hwnd: HWND; const pbuttonImagelist: TButtonImageList): BOOL; {inline;}
  5391. function Button_GetImageList(hwnd: HWND; var pbuttonImagelist: TButtonImageList): BOOL; {inline;}
  5392. function Button_SetTextMargin(hwnd: HWND; const pmargin: TRect): BOOL; {inline;}
  5393. function Button_GetTextMargin(hwnd: HWND; var pmargin: TRect): BOOL; {inline;}
  5394. type
  5395. { $EXTERNALSYM tagNMBCHOTITEM}
  5396. tagNMBCHOTITEM = packed record
  5397. hdr: NMHDR;
  5398. dwFlags: DWORD; // HICF_*
  5399. end;
  5400. PNMBCHotItem = ^TNMBCHotItem;
  5401. TNMBCHotItem = tagNMBCHOTITEM;
  5402. const
  5403. BCN_HOTITEMCHANGE = BCN_FIRST + $0001;
  5404. BST_HOT = $0200;
  5405. // *** The following Button control declarations require Windows >= Vista ***
  5406. // BUTTON STATE FLAGS
  5407. BST_DROPDOWNPUSHED = $0400;
  5408. // BUTTON STYLES
  5409. BS_SPLITBUTTON = $0000000C;
  5410. BS_DEFSPLITBUTTON = $0000000D;
  5411. BS_COMMANDLINK = $0000000E;
  5412. BS_DEFCOMMANDLINK = $0000000F;
  5413. // SPLIT BUTTON INFO mask flags
  5414. BCSIF_GLYPH = $0001;
  5415. BCSIF_IMAGE = $0002;
  5416. BCSIF_STYLE = $0004;
  5417. BCSIF_SIZE = $0008;
  5418. // SPLIT BUTTON STYLE flags
  5419. BCSS_NOSPLIT = $0001;
  5420. BCSS_STRETCH = $0002;
  5421. BCSS_ALIGNLEFT = $0004;
  5422. BCSS_IMAGE = $0008;
  5423. // BUTTON STRUCTURES
  5424. type
  5425. { $EXTERNALSYM tagBUTTON_SPLITINFO}
  5426. tagBUTTON_SPLITINFO = packed record
  5427. mask: UINT;
  5428. himlGlyph: HIMAGELIST; // interpreted as WCHAR if BCSIF_GLYPH is set
  5429. uSplitStyle: UINT;
  5430. size: SIZE;
  5431. end;
  5432. PButtonSplitinfo = ^TButtonSplitinfo;
  5433. TButtonSplitinfo = tagBUTTON_SPLITINFO;
  5434. // BUTTON MESSAGES
  5435. const
  5436. BCM_SETDROPDOWNSTATE = BCM_FIRST + $0006;
  5437. BCM_SETSPLITINFO = BCM_FIRST + $0007;
  5438. BCM_GETSPLITINFO = BCM_FIRST + $0008;
  5439. BCM_SETNOTE = BCM_FIRST + $0009;
  5440. BCM_GETNOTE = BCM_FIRST + $000A;
  5441. BCM_GETNOTELENGTH = BCM_FIRST + $000B;
  5442. BCM_SETSHIELD = BCM_FIRST + $000C;
  5443. function Button_SetDropDownState(hwnd: HWND; fDropDown: BOOL): BOOL; {inline;}
  5444. function Button_SetSplitInfo(hwnd: HWND; const pInfo: TButtonSplitinfo): BOOL; {inline;}
  5445. function Button_GetSplitInfo(hwnd: HWND; var pInfo: TButtonSplitinfo): BOOL; {inline;}
  5446. function Button_SetNote(hwnd: HWND; psz: LPCWSTR): BOOL; {inline;} overload;
  5447. function Button_SetNote(hwnd: HWND; const psz: UnicodeString): BOOL; {inline;} overload;
  5448. function Button_GetNote(hwnd: HWND; psz: LPCWSTR; var pcc: Integer): BOOL; {inline;}
  5449. function Button_GetNoteLength(hwnd: HWND): LRESULT; {inline;}
  5450. // Macro to use on a button or command link to display an elevated icon
  5451. function Button_SetElevationRequiredState(hwnd: HWND; fRequired: BOOL): LRESULT; {inline;}
  5452. // Value to pass to BCM_SETIMAGELIST to indicate that no glyph should be
  5453. // displayed
  5454. const
  5455. BCCL_NOGLYPH = HIMAGELIST(-1);
  5456. // NOTIFICATION MESSAGES
  5457. type
  5458. { $EXTERNALSYM tagNMBCDROPDOWN}
  5459. tagNMBCDROPDOWN = packed record
  5460. hdr: NMHDR;
  5461. rcButton: TRect;
  5462. end;
  5463. PNMBCDropDown = ^TNMBCDropDown;
  5464. TNMBCDropDown = tagNMBCDROPDOWN;
  5465. const
  5466. BCN_DROPDOWN = BCN_FIRST + $0002;
  5467. /// ====================== Edit Control =============================
  5468. // Edit Class Name
  5469. const
  5470. WC_EDIT = 'Edit';
  5471. // *** The following Edit control declarations require Windows >= XP ***
  5472. const
  5473. EM_SETCUEBANNER = ECM_FIRST + 1; // Set the cue banner with the lParm = LPCWSTR
  5474. EM_GETCUEBANNER = ECM_FIRST + 2; // Set the cue banner with the lParm = LPCWSTR
  5475. function Edit_SetCueBannerText(hwnd: HWND; lpwText: LPCWSTR): BOOL; {inline;}
  5476. function Edit_GetCueBannerText(hwnd: HWND; lpwText: LPCWSTR; cchText: Longint): BOOL; {inline;}
  5477. type
  5478. { $EXTERNALSYM _tagEDITBALLOONTIP}
  5479. _tagEDITBALLOONTIP = record
  5480. cbStruct: DWORD;
  5481. pszTitle: LPCWSTR;
  5482. pszText: LPCWSTR;
  5483. ttiIcon: Integer; // From TTI_*
  5484. end;
  5485. PEditBalloonTip = ^TEditBalloonTip;
  5486. TEditBalloonTip = _tagEDITBALLOONTIP;
  5487. const
  5488. EM_SHOWBALLOONTIP = ECM_FIRST + 3; // Show a balloon tip associated to the edit control
  5489. EM_HIDEBALLOONTIP = ECM_FIRST + 4; // Hide any balloon tip associated with the edit control
  5490. function Edit_ShowBalloonTip(hwnd: HWND; const peditballoontip: TEditBalloonTip): BOOL; {inline;}
  5491. function Edit_HideBalloonTip(hwnd: HWND): BOOL; {inline;}
  5492. // *** The following Edit control declarations require Windows >= Vista ***
  5493. const
  5494. EM_SETHILITE = ECM_FIRST + 5;
  5495. EM_GETHILITE = ECM_FIRST + 6;
  5496. procedure Edit_SetHilite(hwndCtl: HWND; ichStart, ichEnd: Integer); {inline;}
  5497. function Edit_GetHilite(hwndCtl: HWND): LRESULT; {inline;}
  5498. // ====================== Combobox Control =============================
  5499. // Combobox Class Name
  5500. const
  5501. WC_COMBOBOX = 'ComboBox';
  5502. // *** The following Combobox control declarations require Windows >= Vista ***
  5503. // custom combobox control messages
  5504. const
  5505. CB_SETMINVISIBLE = CBM_FIRST + 1;
  5506. CB_GETMINVISIBLE = CBM_FIRST + 2;
  5507. CB_SETCUEBANNER = CBM_FIRST + 3;
  5508. CB_GETCUEBANNER = CBM_FIRST + 4;
  5509. function ComboBox_SetMinVisible(hwnd: HWND; iMinVisible: Integer): BOOL; {inline;}
  5510. function ComboBox_GetMinVisible(hwnd: HWND): Integer; {inline;}
  5511. function ComboBox_SetCueBannerText(hwnd: HWND; lpcwText: LPCWSTR): BOOL; {inline;}
  5512. function ComboBox_GetCueBannerText(hwnd: HWND; lpwText: LPCWSTR; cchText: Integer): BOOL; {inline;}
  5513. // ===================== Task Dialog =========================
  5514. // *** The Task Dialog declarations require Windows >= Vista ***
  5515. type
  5516. { $EXTERNALSYM PFTASKDIALOGCALLBACK}
  5517. PFTASKDIALOGCALLBACK = function(hwnd: HWND; msg: UINT; wParam: WPARAM;
  5518. lParam: LPARAM; lpRefData: LONG_PTR): HResult; stdcall;
  5519. TFTaskDialogCallback = PFTASKDIALOGCALLBACK;
  5520. const
  5521. { Task Dialog Flags }
  5522. TDF_ENABLE_HYPERLINKS = $0001;
  5523. TDF_USE_HICON_MAIN = $0002;
  5524. TDF_USE_HICON_FOOTER = $0004;
  5525. TDF_ALLOW_DIALOG_CANCELLATION = $0008;
  5526. TDF_USE_COMMAND_LINKS = $0010;
  5527. TDF_USE_COMMAND_LINKS_NO_ICON = $0020;
  5528. TDF_EXPAND_FOOTER_AREA = $0040;
  5529. TDF_EXPANDED_BY_DEFAULT = $0080;
  5530. TDF_VERIFICATION_FLAG_CHECKED = $0100;
  5531. TDF_SHOW_PROGRESS_BAR = $0200;
  5532. TDF_SHOW_MARQUEE_PROGRESS_BAR = $0400;
  5533. TDF_CALLBACK_TIMER = $0800;
  5534. TDF_POSITION_RELATIVE_TO_WINDOW = $1000;
  5535. TDF_RTL_LAYOUT = $2000;
  5536. TDF_NO_DEFAULT_RADIO_BUTTON = $4000;
  5537. TDF_CAN_BE_MINIMIZED = $8000;
  5538. { Task Dialog Messages }
  5539. TDM_NAVIGATE_PAGE = WM_USER+101;
  5540. TDM_CLICK_BUTTON = WM_USER+102; // wParam = Button ID
  5541. TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER+103; // wParam = 0 (nonMarque) wParam != 0 (Marquee)
  5542. TDM_SET_PROGRESS_BAR_STATE = WM_USER+104; // wParam = new progress state
  5543. TDM_SET_PROGRESS_BAR_RANGE = WM_USER+105; // lParam = MAKELPARAM(nMinRange, nMaxRange)
  5544. TDM_SET_PROGRESS_BAR_POS = WM_USER+106; // wParam = new position
  5545. TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER+107; // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints)
  5546. TDM_SET_ELEMENT_TEXT = WM_USER+108; // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
  5547. TDM_CLICK_RADIO_BUTTON = WM_USER+110; // wParam = Radio Button ID
  5548. TDM_ENABLE_BUTTON = WM_USER+111; // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
  5549. TDM_ENABLE_RADIO_BUTTON = WM_USER+112; // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
  5550. TDM_CLICK_VERIFICATION = WM_USER+113; // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
  5551. TDM_UPDATE_ELEMENT_TEXT = WM_USER+114; // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
  5552. TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER+115; // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
  5553. TDM_UPDATE_ICON = WM_USER+116; // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise)
  5554. { Task Dialog Notifications }
  5555. TDN_CREATED = 0;
  5556. TDN_NAVIGATED = 1;
  5557. TDN_BUTTON_CLICKED = 2; // wParam = Button ID
  5558. TDN_HYPERLINK_CLICKED = 3; // lParam = (LPCWSTR)pszHREF
  5559. TDN_TIMER = 4; // wParam = Milliseconds since dialog created or timer reset
  5560. TDN_DESTROYED = 5;
  5561. TDN_RADIO_BUTTON_CLICKED = 6; // wParam = Radio Button ID
  5562. TDN_DIALOG_CONSTRUCTED = 7;
  5563. TDN_VERIFICATION_CLICKED = 8; // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
  5564. TDN_HELP = 9;
  5565. TDN_EXPANDO_BUTTON_CLICKED = 10; // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
  5566. type
  5567. { $EXTERNALSYM TASKDIALOG_BUTTON}
  5568. TASKDIALOG_BUTTON = packed record
  5569. nButtonID: Integer;
  5570. pszButtonText: LPCWSTR;
  5571. end;
  5572. { $EXTERNALSYM _TASKDIALOG_BUTTON}
  5573. _TASKDIALOG_BUTTON = TASKDIALOG_BUTTON;
  5574. PTaskDialogButton = ^TTaskDialogButton;
  5575. TTaskDialogButton = TASKDIALOG_BUTTON;
  5576. const
  5577. { Task Dialog Elements }
  5578. TDE_CONTENT = 0;
  5579. TDE_EXPANDED_INFORMATION = 1;
  5580. TDE_FOOTER = 2;
  5581. TDE_MAIN_INSTRUCTION = 3;
  5582. { Task Dialog Icon Elements }
  5583. TDIE_ICON_MAIN = 0;
  5584. TDIE_ICON_FOOTER = 1;
  5585. { Task Dialog Common Icons }
  5586. TD_WARNING_ICON = MAKEINTRESOURCEW(Word(-1));
  5587. TD_ERROR_ICON = MAKEINTRESOURCEW(Word(-2));
  5588. TD_INFORMATION_ICON = MAKEINTRESOURCEW(Word(-3));
  5589. TD_SHIELD_ICON = MAKEINTRESOURCEW(Word(-4));
  5590. { Task Dialog Button Flags }
  5591. TDCBF_OK_BUTTON = $0001; // selected control return value IDOK
  5592. TDCBF_YES_BUTTON = $0002; // selected control return value IDYES
  5593. TDCBF_NO_BUTTON = $0004; // selected control return value IDNO
  5594. TDCBF_CANCEL_BUTTON = $0008; // selected control return value IDCANCEL
  5595. TDCBF_RETRY_BUTTON = $0010; // selected control return value IDRETRY
  5596. TDCBF_CLOSE_BUTTON = $0020; // selected control return value IDCLOSE
  5597. type
  5598. { $EXTERNALSYM TASKDIALOGCONFIG}
  5599. TASKDIALOGCONFIG = packed record
  5600. cbSize: UINT;
  5601. hwndParent: HWND;
  5602. hInstance: HINST; // used for MAKEINTRESOURCE() strings
  5603. dwFlags: DWORD; // TASKDIALOG_FLAGS (TDF_XXX) flags
  5604. dwCommonButtons: DWORD; // TASKDIALOG_COMMON_BUTTON (TDCBF_XXX) flags
  5605. pszWindowTitle: LPCWSTR; // string or MAKEINTRESOURCE()
  5606. case Integer of
  5607. 0: (hMainIcon: HICON);
  5608. 1: (pszMainIcon: LPCWSTR;
  5609. pszMainInstruction: LPCWSTR;
  5610. pszContent: LPCWSTR;
  5611. cButtons: UINT;
  5612. pButtons: PTaskDialogButton;
  5613. nDefaultButton: Integer;
  5614. cRadioButtons: UINT;
  5615. pRadioButtons: PTaskDialogButton;
  5616. nDefaultRadioButton: Integer;
  5617. pszVerificationText: LPCWSTR;
  5618. pszExpandedInformation: LPCWSTR;
  5619. pszExpandedControlText: LPCWSTR;
  5620. pszCollapsedControlText: LPCWSTR;
  5621. case Integer of
  5622. 0: (hFooterIcon: HICON);
  5623. 1: (pszFooterIcon: LPCWSTR;
  5624. pszFooter: LPCWSTR;
  5625. pfCallback: TFTaskDialogCallback;
  5626. lpCallbackData: LONG_PTR;
  5627. cxWidth: UINT // width of the Task Dialog's client area in DLU's.
  5628. // If 0, Task Dialog will calculate the ideal width.
  5629. );
  5630. );
  5631. end;
  5632. _TASKDIALOGCONFIG = TASKDIALOGCONFIG;
  5633. PTaskDialogConfig = ^TTaskDialogConfig;
  5634. TTaskDialogConfig = TASKDIALOGCONFIG;
  5635. function TaskDialogIndirect(const pTaskConfig: TTaskDialogConfig;
  5636. pnButton: PInteger; pnRadioButton: PInteger; pfVerificationFlagChecked: PBOOL): HRESULT;
  5637. function TaskDialog(hwndParent: HWND; hInstance: HINST; pszWindowTitle,
  5638. pszMainInstruction, pszContent: LPCWSTR; dwCommonButtons: DWORD;
  5639. pszIcon: LPCWSTR; pnButton: PInteger): HRESULT;
  5640. { ====== TrackMouseEvent ================================================== }
  5641. const
  5642. WM_MOUSEHOVER = $02A1;
  5643. WM_MOUSELEAVE = $02A3;
  5644. TME_HOVER = $00000001;
  5645. TME_LEAVE = $00000002;
  5646. TME_NONCLIENT = $00000010;
  5647. TME_QUERY = $40000000;
  5648. TME_CANCEL = $80000000;
  5649. HOVER_DEFAULT = $FFFFFFFF;
  5650. type
  5651. tagTRACKMOUSEEVENT = packed record
  5652. cbSize: DWORD;
  5653. dwFlags: DWORD;
  5654. hwndTrack: HWND;
  5655. dwHoverTime: DWORD;
  5656. end;
  5657. PTrackMouseEvent = ^TTrackMouseEvent;
  5658. TTrackMouseEvent = tagTRACKMOUSEEVENT;
  5659. { Declare _TrackMouseEvent. This API tries to use the window manager's }
  5660. { implementation of TrackMouseEvent if it is present, otherwise it emulates. }
  5661. function _TrackMouseEvent(lpEventTrack: PTrackMouseEvent): BOOL; stdcall;
  5662. { ====== Flat Scrollbar APIs========================================= }
  5663. const
  5664. WSB_PROP_CYVSCROLL = $00000001;
  5665. WSB_PROP_CXHSCROLL = $00000002;
  5666. WSB_PROP_CYHSCROLL = $00000004;
  5667. WSB_PROP_CXVSCROLL = $00000008;
  5668. WSB_PROP_CXHTHUMB = $00000010;
  5669. WSB_PROP_CYVTHUMB = $00000020;
  5670. WSB_PROP_VBKGCOLOR = $00000040;
  5671. WSB_PROP_HBKGCOLOR = $00000080;
  5672. WSB_PROP_VSTYLE = $00000100;
  5673. WSB_PROP_HSTYLE = $00000200;
  5674. WSB_PROP_WINSTYLE = $00000400;
  5675. WSB_PROP_PALETTE = $00000800;
  5676. WSB_PROP_MASK = $00000FFF;
  5677. FSB_FLAT_MODE = 2;
  5678. FSB_ENCARTA_MODE = 1;
  5679. FSB_REGULAR_MODE = 0;
  5680. function FlatSB_EnableScrollBar(hWnd: HWND; wSBflags, wArrows: UINT): BOOL; stdcall;
  5681. function FlatSB_ShowScrollBar(hWnd: HWND; wBar: Integer; bShow: BOOL): BOOL; stdcall;
  5682. function FlatSB_GetScrollRange(hWnd: HWND; nBar: Integer; var lpMinPos,
  5683. lpMaxPos: Integer): BOOL; stdcall;
  5684. function FlatSB_GetScrollInfo(hWnd: HWND; BarFlag: Integer;
  5685. var ScrollInfo: TScrollInfo): BOOL; stdcall;
  5686. function FlatSB_GetScrollPos(hWnd: HWND; nBar: Integer): Integer; stdcall;
  5687. function FlatSB_GetScrollProp(p1: HWND; propIndex: Integer;
  5688. p3: PInteger): Bool; stdcall;
  5689. function FlatSB_SetScrollPos(hWnd: HWND; nBar, nPos: Integer;
  5690. bRedraw: BOOL): Integer; stdcall;
  5691. function FlatSB_SetScrollInfo(hWnd: HWND; BarFlag: Integer;
  5692. const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall;
  5693. function FlatSB_SetScrollRange(hWnd: HWND; nBar, nMinPos, nMaxPos: Integer;
  5694. bRedraw: BOOL): BOOL; stdcall;
  5695. function FlatSB_SetScrollProp(p1: HWND; index: Integer; newValue: Integer;
  5696. p4: Bool): Bool; stdcall;
  5697. function InitializeFlatSB(hWnd: HWND): Bool; stdcall;
  5698. procedure UninitializeFlatSB(hWnd: HWND); stdcall;
  5699. //
  5700. // subclassing stuff
  5701. //
  5702. type
  5703. { For Windows >= XP }
  5704. { $EXTERNALSYM SUBCLASSPROC}
  5705. SUBCLASSPROC = function(hWnd: HWND; uMsg: UINT; wParam: WPARAM;
  5706. lParam: LPARAM; uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;
  5707. TSubClassProc = SUBCLASSPROC;
  5708. { For Windows >= XP }
  5709. function SetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  5710. uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): BOOL;
  5711. function GetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  5712. uIdSubclass: UINT_PTR; var pdwRefData: DWORD_PTR): BOOL;
  5713. function RemoveWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  5714. uIdSubclass: UINT_PTR): BOOL;
  5715. function DefSubclassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM;
  5716. lParam: LPARAM): LRESULT;
  5717. { For NTDDI_VERSION >= NTDDI_LONGHORN }
  5718. const
  5719. LIM_SMALL = 0; // corresponds to SM_CXSMICON/SM_CYSMICON
  5720. LIM_LARGE = 1; // corresponds to SM_CXICON/SM_CYICON
  5721. { For NTDDI_VERSION >= NTDDI_LONGHORN }
  5722. function LoadIconMetric(hinst: HINST; pszName: LPCWSTR; lims: Integer;
  5723. var phico: HICON): HResult;
  5724. function LoadIconWithScaleDown(hinst: HINST; pszName: LPCWSTR; cx: Integer;
  5725. cy: Integer; var phico: HICON): HResult;
  5726. { For Windows >= XP }
  5727. function DrawShadowText(hdc: HDC; pszText: LPCWSTR; cch: UINT; const prc: TRect;
  5728. dwFlags: DWORD; crText, crShadow: COLORREF; ixOffset, iyOffset: Integer): Integer;
  5729. const
  5730. { For Windows >= Vista }
  5731. DCHF_TOPALIGN = $00000002; // default is center-align
  5732. DCHF_HORIZONTAL = $00000004; // default is vertical
  5733. DCHF_HOT = $00000008; // default is flat
  5734. DCHF_PUSHED = $00000010; // default is flat
  5735. DCHF_FLIPPED = $00000020; // if horiz, default is pointing right
  5736. // if vert, default is pointing up
  5737. { For Windows >= Vista }
  5738. DCHF_TRANSPARENT = $00000040;
  5739. DCHF_INACTIVE = $00000080;
  5740. DCHF_NOBORDER = $00000100;
  5741. { For Windows >= Vista }
  5742. procedure DrawScrollArrow(hdc: HDC; lprc: PRect; wControlState: UINT;
  5743. rgbOveride: COLORREF);
  5744. // Utilities to simplify .NET/Win32 single code base
  5745. type
  5746. TWMNotifyHC = packed record { TWMNotify }
  5747. Msg: Cardinal;
  5748. IDCtrl: Longint;
  5749. case Integer of
  5750. 0: (NMHdr: PNMHdr);
  5751. 1: (HDNotify: PHDNotify;
  5752. Result: LRESULT);
  5753. end;
  5754. TWMNotifyTV = packed record { TWMNotify }
  5755. Msg: Cardinal;
  5756. IDCtrl: Longint;
  5757. case Integer of
  5758. 0: (NMHdr: PNMHdr);
  5759. 1: (NMCustomDraw: PNMCustomDraw);
  5760. 2: (NMTreeView: PNMTreeView);
  5761. 3: (NMTVCustomDraw: PNMTVCustomDraw);
  5762. 4: (ToolTipTextW: PToolTipTextW);
  5763. 5: (TVDispInfo: PTVDispInfo;
  5764. Result: LRESULT);
  5765. end;
  5766. TWMNotifyTRB = packed record { TWMNotify }
  5767. Msg: Cardinal;
  5768. IDCtrl: Longint;
  5769. case Integer of
  5770. 0: (NMHdr: PNMHdr);
  5771. 1: (NMCustomDraw: PNMCustomDraw;
  5772. Result: LRESULT);
  5773. end;
  5774. TWMNotifyUD = packed record { TWMNotify }
  5775. Msg: Cardinal;
  5776. IDCtrl: Longint;
  5777. case Integer of
  5778. 0: (NMHdr: PNMHdr);
  5779. 1: (NMUpDown: PNMUpDown;
  5780. Result: LRESULT);
  5781. end;
  5782. TWMNotifyLV = packed record { TWMNotify }
  5783. Msg: Cardinal;
  5784. IDCtrl: Longint;
  5785. case Integer of
  5786. 0: (NMHdr: PNMHdr);
  5787. 1: (HDNotify: PHDNotify);
  5788. 2: (LVDispInfo: PLVDispInfo);
  5789. 3: (NMCustomDraw: PNMCustomDraw);
  5790. 4: (NMListView: PNMListView);
  5791. 5: (NMLVCacheHint: PNMLVCacheHint);
  5792. 6: (NMLVCustomDraw: PNMLVCustomDraw);
  5793. 7: (NMLVFindItem: PNMLVFindItem);
  5794. 8: (NMLVODStateChange: PNMLVODStateChange;
  5795. Result: LRESULT);
  5796. end;
  5797. TWMNotifyTLB = packed record { TWMNotify }
  5798. Msg: Cardinal;
  5799. IDCtrl: Longint;
  5800. case Integer of
  5801. 0: (NMHdr: PNMHdr);
  5802. 1: (NMTBCustomDraw: PNMTBCustomDraw);
  5803. 2: (NMToolBar: PNMToolBar;
  5804. Result: LRESULT);
  5805. end;
  5806. TWMNotifyMC = packed record { TWMNotify }
  5807. Msg: Cardinal;
  5808. IDCtrl: Longint;
  5809. case Integer of
  5810. 0: (NMHdr: PNMHdr);
  5811. 1: (NMDayState: PNMDayState);
  5812. 2: (NMSelChange: PNMSelChange;
  5813. Result: LRESULT);
  5814. end;
  5815. TWMNotifyDT = packed record { TWMNotify }
  5816. Msg: Cardinal;
  5817. IDCtrl: Longint;
  5818. case Integer of
  5819. 0: (NMHdr: PNMHdr);
  5820. 1: (NMDateTimeChange: PNMDateTimeChange);
  5821. 2: (NMDateTimeString: PNMDateTimeString;
  5822. Result: LRESULT);
  5823. end;
  5824. TWMNotifyPS = packed record { TWMNotify }
  5825. Msg: Cardinal;
  5826. IDCtrl: Longint;
  5827. case Integer of
  5828. 0: (NMHdr: PNMHdr);
  5829. 1: (NMPGCalcSize: PNMPGCalcSize);
  5830. 2: (NMPGScroll: PNMPGScroll;
  5831. Result: LRESULT);
  5832. end;
  5833. TTCMAdjustRect = packed record
  5834. Msg: Cardinal;
  5835. Larger: LongBool;
  5836. case Integer of
  5837. 0: (lpPrc: PRect);
  5838. 1: (Prc: PRect;
  5839. Result: LRESULT);
  5840. end;
  5841. implementation
  5842. const
  5843. cctrl = comctl32; { From Windows.pas }
  5844. var
  5845. ComCtl32DLL: THandle;
  5846. _InitCommonControlsEx: function(var ICC: TInitCommonControlsEx): Bool stdcall;
  5847. procedure InitCommonControls; external cctrl name 'InitCommonControls';
  5848. procedure InitComCtl;
  5849. begin
  5850. if ComCtl32DLL = 0 then
  5851. begin
  5852. ComCtl32DLL := GetModuleHandle(cctrl);
  5853. if ComCtl32DLL <> 0 then
  5854. @_InitCommonControlsEx := GetProcAddress(ComCtl32DLL, PAnsiChar('InitCommonControlsEx'));
  5855. end;
  5856. end;
  5857. function InitCommonControlsEx(var ICC: TInitCommonControlsEx): Bool;
  5858. begin
  5859. if ComCtl32DLL = 0 then InitComCtl;
  5860. Result := Assigned(_InitCommonControlsEx) and _InitCommonControlsEx(ICC);
  5861. end;
  5862. { Property Sheets }
  5863. function CreatePropertySheetPage; external cctrl name 'CreatePropertySheetPageW';
  5864. function CreatePropertySheetPageA; external cctrl name 'CreatePropertySheetPageA';
  5865. function CreatePropertySheetPageW; external cctrl name 'CreatePropertySheetPageW';
  5866. function DestroyPropertySheetPage; external cctrl name 'DestroyPropertySheetPage';
  5867. function PropertySheet; external cctrl name 'PropertySheetW';
  5868. function PropertySheetA; external cctrl name 'PropertySheetA';
  5869. function PropertySheetW; external cctrl name 'PropertySheetW';
  5870. { Image List }
  5871. function ImageList_Create; external cctrl name 'ImageList_Create';
  5872. function ImageList_Destroy; external cctrl name 'ImageList_Destroy';
  5873. function ImageList_GetImageCount; external cctrl name 'ImageList_GetImageCount';
  5874. function ImageList_SetImageCount; external cctrl name 'ImageList_SetImageCount';
  5875. function ImageList_Add; external cctrl name 'ImageList_Add';
  5876. function ImageList_ReplaceIcon; external cctrl name 'ImageList_ReplaceIcon';
  5877. function ImageList_SetBkColor; external cctrl name 'ImageList_SetBkColor';
  5878. function ImageList_GetBkColor; external cctrl name 'ImageList_GetBkColor';
  5879. function ImageList_SetOverlayImage; external cctrl name 'ImageList_SetOverlayImage';
  5880. function ImageList_AddIcon(ImageList: HIMAGELIST; Icon: HIcon): Integer;
  5881. begin
  5882. Result := ImageList_ReplaceIcon(ImageList, -1, Icon);
  5883. end;
  5884. function IndexToOverlayMask(Index: Integer): Integer;
  5885. begin
  5886. Result := Index shl 8;
  5887. end;
  5888. function ImageList_Draw; external cctrl name 'ImageList_Draw';
  5889. function ImageList_Replace; external cctrl name 'ImageList_Replace';
  5890. function ImageList_AddMasked; external cctrl name 'ImageList_AddMasked';
  5891. function ImageList_DrawEx; external cctrl name 'ImageList_DrawEx';
  5892. function ImageList_DrawIndirect; external cctrl name 'ImageList_DrawIndirect';
  5893. function ImageList_Remove; external cctrl name 'ImageList_Remove';
  5894. function ImageList_GetIcon; external cctrl name 'ImageList_GetIcon';
  5895. function ImageList_LoadImage; external cctrl name 'ImageList_LoadImageW';
  5896. function ImageList_LoadImageA; external cctrl name 'ImageList_LoadImageA';
  5897. function ImageList_LoadImageW; external cctrl name 'ImageList_LoadImageW';
  5898. function ImageList_Copy; external cctrl name 'ImageList_Copy';
  5899. function ImageList_BeginDrag; external cctrl name 'ImageList_BeginDrag';
  5900. function ImageList_EndDrag; external cctrl name 'ImageList_EndDrag';
  5901. function ImageList_DragEnter; external cctrl name 'ImageList_DragEnter';
  5902. function ImageList_DragLeave; external cctrl name 'ImageList_DragLeave';
  5903. function ImageList_DragMove; external cctrl name 'ImageList_DragMove';
  5904. function ImageList_SetDragCursorImage; external cctrl name 'ImageList_SetDragCursorImage';
  5905. function ImageList_DragShowNolock; external cctrl name 'ImageList_DragShowNolock';
  5906. function ImageList_GetDragImage(Point, HotSpot: PPoint): HIMAGELIST; external cctrl name 'ImageList_GetDragImage';
  5907. function ImageList_GetDragImage(Point: PPoint; out HotSpot: TPoint): HIMAGELIST; external cctrl name 'ImageList_GetDragImage';
  5908. { macros }
  5909. procedure ImageList_RemoveAll(ImageList: HIMAGELIST);
  5910. begin
  5911. ImageList_Remove(ImageList, -1);
  5912. end;
  5913. function ImageList_ExtractIcon(Instance: THandle; ImageList: HIMAGELIST;
  5914. Image: Integer): HIcon;
  5915. begin
  5916. Result := ImageList_GetIcon(ImageList, Image, 0);
  5917. end;
  5918. function ImageList_LoadBitmap(Instance: THandle; Bmp: PWideChar;
  5919. CX, Grow: Integer; Mask: TColorRef): HIMAGELIST;
  5920. begin
  5921. Result := ImageList_LoadImage(Instance, Bmp, CX, Grow, Mask,
  5922. IMAGE_BITMAP, 0);
  5923. end;
  5924. function ImageList_LoadBitmapA(Instance: THandle; Bmp: PAnsiChar;
  5925. CX, Grow: Integer; Mask: TColorRef): HIMAGELIST;
  5926. begin
  5927. Result := ImageList_LoadImageA(Instance, Bmp, CX, Grow, Mask,
  5928. IMAGE_BITMAP, 0);
  5929. end;
  5930. function ImageList_LoadBitmapW(Instance: THandle; Bmp: PWideChar;
  5931. CX, Grow: Integer; Mask: TColorRef): HIMAGELIST;
  5932. begin
  5933. Result := ImageList_LoadImageW(Instance, Bmp, CX, Grow, Mask,
  5934. IMAGE_BITMAP, 0);
  5935. end;
  5936. function ImageList_Read; external cctrl name 'ImageList_Read';
  5937. function ImageList_Write; external cctrl name 'ImageList_Write';
  5938. var
  5939. _ImageList_ReadEx: function(dwFlags: DWORD; pstm: IStream; const riid: TIID;
  5940. var ppv: Pointer): HResult; stdcall;
  5941. function ImageList_ReadEx(dwFlags: DWORD; pstm: IStream; const riid: TIID;
  5942. var ppv: Pointer): HResult;
  5943. begin
  5944. if Assigned(_ImageList_ReadEx) then
  5945. Result := _ImageList_ReadEx(dwFlags, pstm, riid, ppv)
  5946. else
  5947. begin
  5948. Result := E_NOTIMPL;
  5949. if ComCtl32DLL > 0 then
  5950. begin
  5951. _ImageList_ReadEx := GetProcAddress(ComCtl32DLL, PAnsiChar('ImageList_ReadEx')); // Do not localize
  5952. if Assigned(_ImageList_ReadEx) then
  5953. Result := _ImageList_ReadEx(dwFlags, pstm, riid, ppv);
  5954. end;
  5955. end;
  5956. end;
  5957. var
  5958. _ImageList_WriteEx: function(himl: HIMAGELIST; dwFlags: DWORD;
  5959. pstm: IStream): HResult; stdcall;
  5960. function ImageList_WriteEx(himl: HIMAGELIST; dwFlags: DWORD; pstm: IStream): HResult;
  5961. begin
  5962. if Assigned(_ImageList_WriteEx) then
  5963. Result := _ImageList_WriteEx(himl, dwFlags, pstm)
  5964. else
  5965. begin
  5966. Result := E_NOTIMPL;
  5967. if ComCtl32DLL > 0 then
  5968. begin
  5969. _ImageList_WriteEx := GetProcAddress(ComCtl32DLL, PAnsiChar('ImageList_WriteEx')); // Do not localize
  5970. if Assigned(_ImageList_WriteEx) then
  5971. Result := _ImageList_WriteEx(himl, dwFlags, pstm);
  5972. end;
  5973. end;
  5974. end;
  5975. function ImageList_GetIconSize; external cctrl name 'ImageList_GetIconSize';
  5976. function ImageList_SetIconSize; external cctrl name 'ImageList_SetIconSize';
  5977. function ImageList_GetImageInfo; external cctrl name 'ImageList_GetImageInfo';
  5978. function ImageList_Merge; external cctrl name 'ImageList_Merge';
  5979. function ImageList_Duplicate(himl: HIMAGELIST): HIMAGELIST; stdcall; external cctrl name 'ImageList_Duplicate';
  5980. var
  5981. _HIMAGELIST_QueryInterface: function(himl: HIMAGELIST; const riid: TIID;
  5982. var ppv: Pointer): HResult; stdcall;
  5983. function HIMAGELIST_QueryInterface(himl: HIMAGELIST; const riid: TIID;
  5984. var ppv: Pointer): HResult;
  5985. begin
  5986. if Assigned(_HIMAGELIST_QueryInterface) then
  5987. Result := _HIMAGELIST_QueryInterface(himl, riid, ppv)
  5988. else
  5989. begin
  5990. Result := E_NOTIMPL;
  5991. if ComCtl32DLL > 0 then
  5992. begin
  5993. _HIMAGELIST_QueryInterface := GetProcAddress(ComCtl32DLL,
  5994. PAnsiChar('HIMAGELIST_QueryInterface')); // Do not localize
  5995. if Assigned(_HIMAGELIST_QueryInterface) then
  5996. Result := _HIMAGELIST_QueryInterface(himl, riid, ppv);
  5997. end;
  5998. end;
  5999. end;
  6000. { Headers }
  6001. function Header_GetItemCount(Header: HWnd): Integer;
  6002. begin
  6003. Result := SendMessage(Header, HDM_GETITEMCOUNT, 0, 0);
  6004. end;
  6005. function Header_InsertItem(Header: HWnd; Index: Integer;
  6006. const Item: THDItem): Integer;
  6007. begin
  6008. Result := SendMessage(Header, HDM_INSERTITEM, Index, Longint(@Item));
  6009. end;
  6010. function Header_InsertItemA(Header: HWnd; Index: Integer;
  6011. const Item: THDItemA): Integer;
  6012. begin
  6013. Result := SendMessageA(Header, HDM_INSERTITEM, Index, Longint(@Item));
  6014. end;
  6015. function Header_InsertItemW(Header: HWnd; Index: Integer;
  6016. const Item: THDItemW): Integer;
  6017. begin
  6018. Result := SendMessageW(Header, HDM_INSERTITEM, Index, Longint(@Item));
  6019. end;
  6020. function Header_DeleteItem(Header: HWnd; Index: Integer): Bool;
  6021. begin
  6022. Result := Bool( SendMessage(Header, HDM_DELETEITEM, Index, 0) );
  6023. end;
  6024. function Header_GetItem(Header: HWnd; Index: Integer; var Item: THDItem): Bool;
  6025. begin
  6026. Result := Bool( SendMessage(Header, HDM_GETITEM, Index, Longint(@Item)) );
  6027. end;
  6028. function Header_GetItemA(Header: HWnd; Index: Integer; var Item: THDItemA): Bool;
  6029. begin
  6030. Result := Bool( SendMessageA(Header, HDM_GETITEM, Index, Longint(@Item)) );
  6031. end;
  6032. function Header_GetItemW(Header: HWnd; Index: Integer; var Item: THDItemW): Bool;
  6033. begin
  6034. Result := Bool( SendMessageW(Header, HDM_GETITEM, Index, Longint(@Item)) );
  6035. end;
  6036. function Header_SetItem(Header: HWnd; Index: Integer; const Item: THDItem): Bool;
  6037. begin
  6038. Result := Bool( SendMessage(Header, HDM_SETITEM, Index, Longint(@Item)) );
  6039. end;
  6040. function Header_SetItemA(Header: HWnd; Index: Integer; const Item: THDItemA): Bool;
  6041. begin
  6042. Result := Bool( SendMessageA(Header, HDM_SETITEM, Index, Longint(@Item)) );
  6043. end;
  6044. function Header_SetItemW(Header: HWnd; Index: Integer; const Item: THDItemW): Bool;
  6045. begin
  6046. Result := Bool( SendMessageW(Header, HDM_SETITEM, Index, Longint(@Item)) );
  6047. end;
  6048. function Header_Layout(Header: HWnd; Layout: PHDLayout): Bool;
  6049. begin
  6050. Result := Bool( SendMessage(Header, HDM_LAYOUT, 0, Longint(Layout)) );
  6051. end;
  6052. function Header_GetItemRect(hwnd: HWND; iItem: Integer; lprc: PRect): Integer;
  6053. begin
  6054. Result := SendMessage(hwnd, HDM_GETITEMRECT, iItem, LPARAM(lprc));
  6055. end;
  6056. function Header_SetImageList(hwnd: HWND; himl: HIMAGELIST): HIMAGELIST;
  6057. begin
  6058. Result := SendMessage(hwnd, HDM_SETIMAGELIST, 0, LPARAM(himl));
  6059. end;
  6060. function Header_GetImageList(hwnd: HWND): HIMAGELIST;
  6061. begin
  6062. Result := SendMessage(hwnd, HDM_GETIMAGELIST, 0, 0);
  6063. end;
  6064. function Header_OrderToIndex(hwnd: HWND; i: Integer): Integer;
  6065. begin
  6066. Result := SendMessage(hwnd, HDM_ORDERTOINDEX, i, 0);
  6067. end;
  6068. function Header_CreateDragImage(hwnd: HWND; i: Integer): HIMAGELIST;
  6069. begin
  6070. Result := SendMessage(hwnd, HDM_CREATEDRAGIMAGE, i, 0);
  6071. end;
  6072. function Header_GetOrderArray(hwnd: HWND; iCount: Integer; lpi: PInteger): Integer;
  6073. begin
  6074. Result := SendMessage(hwnd, HDM_GETORDERARRAY, iCount, LPARAM(lpi));
  6075. end;
  6076. function Header_SetOrderArray(hwnd: HWND; iCount: Integer; lpi: PInteger): Integer;
  6077. begin
  6078. Result := SendMessage(hwnd, HDM_SETORDERARRAY, iCount, LPARAM(lpi));
  6079. end;
  6080. function Header_SetHotDivider(hwnd: HWND; fPos: BOOL; dw: DWORD): Integer;
  6081. begin
  6082. Result := SendMessage(hwnd, HDM_SETHOTDIVIDER, Integer(fPos), dw);
  6083. end;
  6084. function Header_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): Integer;
  6085. begin
  6086. Result := SendMessage(hwnd, HDM_SETUNICODEFORMAT, Integer(fUnicode), 0);
  6087. end;
  6088. function Header_GetUnicodeFormat(hwnd: HWND): Integer;
  6089. begin
  6090. Result := SendMessage(hwnd, HDM_GETUNICODEFORMAT, 0, 0);
  6091. end;
  6092. function Header_SetBitmapMargin(hwnd: HWND; iWidth: Integer): Integer;
  6093. begin
  6094. Result := SendMessage(hwnd, HDM_SETBITMAPMARGIN, WPARAM(iWidth), 0);
  6095. end;
  6096. function Header_GetBitmapMargin(hwnd: HWND): Integer;
  6097. begin
  6098. Result := SendMessage(hwnd, HDM_GETBITMAPMARGIN, 0, 0);
  6099. end;
  6100. function Header_SetFilterChangeTimeout(hwnd: HWND; i: Integer): Integer;
  6101. begin
  6102. Result := SendMessage(hwnd, HDM_SETFILTERCHANGETIMEOUT, 0, LPARAM(i));
  6103. end;
  6104. function Header_EditFilter(hwnd: HWND; i: Integer; fDiscardChanges: BOOL): Integer;
  6105. begin
  6106. Result := SendMessage(hwnd, HDM_EDITFILTER, WPARAM(i), MAKELPARAM(Word(fDiscardChanges), 0));
  6107. end;
  6108. function Header_ClearFilter(hwnd: HWND; i: Integer): Integer;
  6109. begin
  6110. Result := SendMessage(hwnd, HDM_CLEARFILTER, WPARAM(i), 0);
  6111. end;
  6112. function Header_ClearAllFilters(hwnd: HWND): Integer;
  6113. begin
  6114. Result := SendMessage(hwnd, HDM_CLEARFILTER, WPARAM(-1), 0);
  6115. end;
  6116. function Header_GetItemDropDownRect(hwnd: HWND; iItem: Integer; var lprc: TRect): BOOL;
  6117. begin
  6118. Result := BOOL(SendMessage(hwnd, HDM_GETITEMDROPDOWNRECT, WPARAM(iItem), LPARAM(@lprc)));
  6119. end;
  6120. function Header_GetOverflowRect(hwnd: HWND; var lprc: TRect): BOOL;
  6121. begin
  6122. Result := BOOL(SendMessage(hwnd, HDM_GETOVERFLOWRECT, 0, LPARAM(@lprc)));
  6123. end;
  6124. function Header_GetFocusedItem(hwnd: HWND): Integer;
  6125. begin
  6126. Result := SendMessage(hwnd, HDM_GETFOCUSEDITEM, 0, 0);
  6127. end;
  6128. function Header_SetFocusedItem(hwnd: HWND; iItem: Integer): BOOL;
  6129. begin
  6130. Result := BOOL(SendMessage(hwnd, HDM_SETFOCUSEDITEM, 0, LPARAM(iItem)));
  6131. end;
  6132. { Toolbar }
  6133. function CreateToolBarEx; external cctrl name 'CreateToolbarEx';
  6134. function CreateMappedBitmap; external cctrl name 'CreateMappedBitmap';
  6135. { Status bar }
  6136. procedure DrawStatusText; external cctrl name 'DrawStatusTextW';
  6137. procedure DrawStatusTextA; external cctrl name 'DrawStatusTextA';
  6138. procedure DrawStatusTextW; external cctrl name 'DrawStatusTextW';
  6139. function CreateStatusWindow; external cctrl name 'CreateStatusWindowW';
  6140. function CreateStatusWindowA; external cctrl name 'CreateStatusWindowA';
  6141. function CreateStatusWindowW; external cctrl name 'CreateStatusWindowW';
  6142. { Menu Help }
  6143. procedure MenuHelp; external cctrl name 'MenuHelp';
  6144. function ShowHideMenuCtl; external cctrl name 'ShowHideMenuCtl';
  6145. procedure GetEffectiveClientRect; external cctrl name 'GetEffectiveClientRect';
  6146. { Drag List Box }
  6147. procedure MakeDragList; external cctrl name 'MakeDragList';
  6148. procedure DrawInsert; external cctrl name 'DrawInsert';
  6149. function LBItemFromPt; external cctrl name 'LBItemFromPt';
  6150. { UpDown control }
  6151. function CreateUpDownControl; external cctrl name 'CreateUpDownControl';
  6152. { List View }
  6153. function ListView_GetUnicodeFormat(hwnd: HWND): BOOL;
  6154. begin
  6155. Result := BOOL(SendMessage(hwnd, LVM_GETUNICODEFORMAT, 0, 0));
  6156. end;
  6157. function ListView_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL;
  6158. begin
  6159. Result := BOOL(SendMessage(hwnd, LVM_SETUNICODEFORMAT, Integer(fUnicode), 0));
  6160. end;
  6161. function ListView_GetBkColor(hWnd: HWND): TColorRef;
  6162. begin
  6163. Result := SendMessage(hWnd, LVM_GETBKCOLOR, 0, 0);
  6164. end;
  6165. function ListView_SetBkColor(hWnd: HWND; clrBk: TColorRef): Bool;
  6166. begin
  6167. Result := Bool( SendMessage(hWnd, LVM_SETBKCOLOR, 0, clrBk) );
  6168. end;
  6169. function ListView_GetImageList(hWnd: HWND; iImageList: Integer): HIMAGELIST;
  6170. begin
  6171. Result := HIMAGELIST( SendMessage(hWnd, LVM_GETIMAGELIST, iImageList, 0) );
  6172. end;
  6173. function ListView_SetImageList(hWnd: HWND; himl: HIMAGELIST; iImageList: Integer): HIMAGELIST;
  6174. begin
  6175. Result := HIMAGELIST( SendMessage(hWnd, LVM_SETIMAGELIST, iImageList, Longint(himl)) );
  6176. end;
  6177. function ListView_GetItemCount(hWnd: HWND): Integer;
  6178. begin
  6179. Result := SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);
  6180. end;
  6181. function IndexToStateImageMask(I: Longint): Longint;
  6182. begin
  6183. Result := I shl 12;
  6184. end;
  6185. function ListView_GetItem(hWnd: HWND; var pItem: TLVItem): Bool;
  6186. begin
  6187. Result := Bool( SendMessage(hWnd, LVM_GETITEM, 0, Longint(@pItem)) );
  6188. end;
  6189. function ListView_GetItemA(hWnd: HWND; var pItem: TLVItemA): Bool;
  6190. begin
  6191. Result := Bool( SendMessageA(hWnd, LVM_GETITEMA, 0, Longint(@pItem)) );
  6192. end;
  6193. function ListView_GetItemW(hWnd: HWND; var pItem: TLVItemW): Bool;
  6194. begin
  6195. Result := Bool( SendMessageW(hWnd, LVM_GETITEMW, 0, Longint(@pItem)) );
  6196. end;
  6197. function ListView_SetItem(hWnd: HWND; const pItem: TLVItem): Bool;
  6198. begin
  6199. Result := Bool( SendMessage(hWnd, LVM_SETITEM, 0, Longint(@pItem)) );
  6200. end;
  6201. function ListView_SetItemA(hWnd: HWND; const pItem: TLVItemA): Bool;
  6202. begin
  6203. Result := Bool( SendMessageA(hWnd, LVM_SETITEMA, 0, Longint(@pItem)) );
  6204. end;
  6205. function ListView_SetItemW(hWnd: HWND; const pItem: TLVItemW): Bool;
  6206. begin
  6207. Result := Bool( SendMessageW(hWnd, LVM_SETITEMW, 0, Longint(@pItem)) );
  6208. end;
  6209. function ListView_InsertItem(hWnd: HWND; const pItem: TLVItem): Integer;
  6210. begin
  6211. Result := Integer( SendMessage(hWnd, LVM_INSERTITEM, 0, Longint(@pItem)) );
  6212. end;
  6213. function ListView_InsertItemA(hWnd: HWND; const pItem: TLVItemA): Integer;
  6214. begin
  6215. Result := Integer( SendMessageA(hWnd, LVM_INSERTITEMA, 0, Longint(@pItem)) );
  6216. end;
  6217. function ListView_InsertItemW(hWnd: HWND; const pItem: TLVItemW): Integer;
  6218. begin
  6219. Result := Integer( SendMessageW(hWnd, LVM_INSERTITEMW, 0, Longint(@pItem)) );
  6220. end;
  6221. function ListView_DeleteItem(hWnd: HWND; i: Integer): Bool;
  6222. begin
  6223. Result := Bool( SendMessage(hWnd, LVM_DELETEITEM, i, 0) );
  6224. end;
  6225. function ListView_DeleteAllItems(hWnd: HWND): Bool;
  6226. begin
  6227. Result := Bool( SendMessage(hWnd, LVM_DELETEALLITEMS, 0, 0) );
  6228. end;
  6229. function ListView_GetCallbackMask(hWnd: HWND): UINT;
  6230. begin
  6231. Result := SendMessage(hWnd, LVM_GETCALLBACKMASK, 0, 0);
  6232. end;
  6233. function ListView_SetCallbackMask(hWnd: HWND; mask: UINT): Bool;
  6234. begin
  6235. Result := Bool( SendMessage(hWnd, LVM_SETCALLBACKMASK, mask, 0) );
  6236. end;
  6237. function ListView_GetNextItem(hWnd: HWND; iStart: Integer; Flags: UINT): Integer;
  6238. begin
  6239. Result := SendMessage(hWnd, LVM_GETNEXTITEM, iStart, MakeLong(Word(Flags), 0));
  6240. end;
  6241. function ListView_FindItem(hWnd: HWND; iStart: Integer;
  6242. const plvfi: TLVFindInfo): Integer;
  6243. begin
  6244. Result := SendMessage(hWnd, LVM_FINDITEM, iStart, Longint(@plvfi));
  6245. end;
  6246. function ListView_FindItemA(hWnd: HWND; iStart: Integer;
  6247. const plvfi: TLVFindInfoA): Integer;
  6248. begin
  6249. Result := SendMessageA(hWnd, LVM_FINDITEMA, iStart, Longint(@plvfi));
  6250. end;
  6251. function ListView_FindItemW(hWnd: HWND; iStart: Integer;
  6252. const plvfi: TLVFindInfoW): Integer;
  6253. begin
  6254. Result := SendMessageW(hWnd, LVM_FINDITEMW, iStart, Longint(@plvfi));
  6255. end;
  6256. function ListView_GetItemRect(hWnd: HWND; i: Integer; var prc: TRect;
  6257. Code: Integer): Bool;
  6258. begin
  6259. if @prc <> nil then
  6260. begin
  6261. prc.left := Code;
  6262. Result := Bool( SendMessage(hWnd, LVM_GETITEMRECT, i, Longint(@prc)) );
  6263. end
  6264. else
  6265. Result := Bool( SendMessage(hWnd, LVM_GETITEMRECT, i, 0) );
  6266. end;
  6267. function ListView_SetItemPosition(hWnd: HWND; i, x, y: Integer): Bool;
  6268. begin
  6269. Result := Bool( SendMessage(hWnd, LVM_SETITEMPOSITION, i, MakeLong(Word(x), Word(y))) );
  6270. end;
  6271. function ListView_GetItemPosition(hwndLV: HWND; i: Integer;
  6272. var ppt: TPoint): Bool;
  6273. begin
  6274. Result := Bool( SendMessage(hWndLV, LVM_GETITEMPOSITION, i, Longint(@ppt)) );
  6275. end;
  6276. function ListView_GetStringWidth(hwndLV: HWND; psz: PWideChar): Integer;
  6277. begin
  6278. Result := SendMessage(hwndLV, LVM_GETSTRINGWIDTH, 0, Longint(psz));
  6279. end;
  6280. function ListView_GetStringWidthA(hwndLV: HWND; psz: PAnsiChar): Integer;
  6281. begin
  6282. Result := SendMessageA(hwndLV, LVM_GETSTRINGWIDTHA, 0, Longint(psz));
  6283. end;
  6284. function ListView_GetStringWidthW(hwndLV: HWND; psz: PWideChar): Integer;
  6285. begin
  6286. Result := SendMessageW(hwndLV, LVM_GETSTRINGWIDTHW, 0, Longint(psz));
  6287. end;
  6288. function ListView_HitTest(hwndLV: HWND; var pinfo: TLVHitTestInfo): Integer;
  6289. begin
  6290. Result := SendMessage(hwndLV, LVM_HITTEST, 0, Longint(@pinfo));
  6291. end;
  6292. function ListView_EnsureVisible(hwndLV: HWND; i: Integer; fPartialOK: Bool): Bool;
  6293. begin
  6294. Result := SendMessage(hwndLV, LVM_ENSUREVISIBLE, i,
  6295. MakeLong(Word(fPartialOK), 0)) <> 0;
  6296. end;
  6297. function ListView_Scroll(hwndLV: HWnd; DX, DY: Integer): Bool;
  6298. begin
  6299. Result := Bool( SendMessage(hwndLV, LVM_SCROLL, DX, DY) );
  6300. end;
  6301. function ListView_RedrawItems(hwndLV: HWND; iFirst, iLast: Integer): Bool;
  6302. begin
  6303. Result := Bool( SendMessage(hwndLV, LVM_REDRAWITEMS, iFirst, iLast) );
  6304. end;
  6305. function ListView_Arrange(hwndLV: HWND; Code: UINT): Bool;
  6306. begin
  6307. Result := Bool( SendMessage(hwndLV, LVM_ARRANGE, Code, 0) );
  6308. end;
  6309. function ListView_EditLabel(hwndLV: HWND; i: Integer): HWND;
  6310. begin
  6311. Result := HWND( SendMessage(hwndLV, LVM_EDITLABEL, i, 0) );
  6312. end;
  6313. function ListView_EditLabelA(hwndLV: HWND; i: Integer): HWND;
  6314. begin
  6315. Result := HWND( SendMessageA(hwndLV, LVM_EDITLABELA, i, 0) );
  6316. end;
  6317. function ListView_EditLabelW(hwndLV: HWND; i: Integer): HWND;
  6318. begin
  6319. Result := HWND( SendMessageW(hwndLV, LVM_EDITLABELW, i, 0) );
  6320. end;
  6321. function ListView_GetEditControl(hwndLV: HWND): HWND;
  6322. begin
  6323. Result := HWND( SendMessage(hwndLV, LVM_GETEDITCONTROL, 0, 0) );
  6324. end;
  6325. function ListView_GetColumn(hwnd: HWND; iCol: Integer; var pcol: TLVColumn): Bool;
  6326. begin
  6327. Result := Bool( SendMessage(hwnd, LVM_GETCOLUMN, iCol, Longint(@pcol)) );
  6328. end;
  6329. function ListView_GetColumnA(hwnd: HWND; iCol: Integer; var pcol: TLVColumnA): Bool;
  6330. begin
  6331. Result := Bool( SendMessageA(hwnd, LVM_GETCOLUMNA, iCol, Longint(@pcol)) );
  6332. end;
  6333. function ListView_GetColumnW(hwnd: HWND; iCol: Integer; var pcol: TLVColumnW): Bool;
  6334. begin
  6335. Result := Bool( SendMessageW(hwnd, LVM_GETCOLUMNW, iCol, Longint(@pcol)) );
  6336. end;
  6337. function ListView_SetColumn(hwnd: HWND; iCol: Integer; const pcol: TLVColumn): Bool;
  6338. begin
  6339. Result := Bool( SendMessage(hwnd, LVM_SETCOLUMN, iCol, Longint(@pcol)) );
  6340. end;
  6341. function ListView_SetColumnA(hwnd: HWND; iCol: Integer; const pcol: TLVColumnA): Bool;
  6342. begin
  6343. Result := Bool( SendMessageA(hwnd, LVM_SETCOLUMNA, iCol, Longint(@pcol)) );
  6344. end;
  6345. function ListView_SetColumnW(hwnd: HWND; iCol: Integer; const pcol: TLVColumnW): Bool;
  6346. begin
  6347. Result := Bool( SendMessageW(hwnd, LVM_SETCOLUMNW, iCol, Longint(@pcol)) );
  6348. end;
  6349. function ListView_InsertColumn(hwnd: HWND; iCol: Integer; const pcol: TLVColumn): Integer;
  6350. begin
  6351. Result := SendMessage(hWnd, LVM_INSERTCOLUMN, iCol, Longint(@pcol));
  6352. end;
  6353. function ListView_InsertColumnA(hwnd: HWND; iCol: Integer; const pcol: TLVColumnA): Integer;
  6354. begin
  6355. Result := SendMessageA(hWnd, LVM_INSERTCOLUMNA, iCol, Longint(@pcol));
  6356. end;
  6357. function ListView_InsertColumnW(hwnd: HWND; iCol: Integer; const pcol: TLVColumnW): Integer;
  6358. begin
  6359. Result := SendMessageW(hWnd, LVM_INSERTCOLUMNW, iCol, Longint(@pcol));
  6360. end;
  6361. function ListView_DeleteColumn(hwnd: HWND; iCol: Integer): Bool;
  6362. begin
  6363. Result := Bool( SendMessage(hWnd, LVM_DELETECOLUMN, iCol, 0) );
  6364. end;
  6365. function ListView_GetColumnWidth(hwnd: HWND; iCol: Integer): Integer;
  6366. begin
  6367. Result := Integer( SendMessage(hwnd, LVM_GETCOLUMNWIDTH, iCol, 0) );
  6368. end;
  6369. function ListView_SetColumnWidth(hwnd: HWnd; iCol: Integer; cx: Integer): Bool;
  6370. begin
  6371. Result := Bool( SendMessage(hwnd, LVM_SETCOLUMNWIDTH, iCol,
  6372. MakeLong(Word(cx), 0)) );
  6373. end;
  6374. function ListView_GetHeader(hwnd: HWND): HWND;
  6375. begin
  6376. Result := SendMessage(hwnd, LVM_GETHEADER, 0, 0);
  6377. end;
  6378. function ListView_CreateDragImage(hwnd: HWND; i: Integer;
  6379. const lpptUpLeft: TPoint): HIMAGELIST;
  6380. begin
  6381. Result := HIMAGELIST( SendMessage(hwnd, LVM_CREATEDRAGIMAGE, i,
  6382. Longint(@lpptUpLeft)));
  6383. end;
  6384. function ListView_GetViewRect(hwnd: HWND; var prc: TRect): Bool;
  6385. begin
  6386. Result := Bool( SendMessage(hwnd, LVM_GETVIEWRECT, 0, Longint(@prc)) );
  6387. end;
  6388. function ListView_GetTextColor(hwnd: HWND): TColorRef;
  6389. begin
  6390. Result := SendMessage(hwnd, LVM_GETTEXTCOLOR, 0, 0);
  6391. end;
  6392. function ListView_SetTextColor(hwnd: HWND; clrText: TColorRef): Bool;
  6393. begin
  6394. Result := Bool( SendMessage(hwnd, LVM_SETTEXTCOLOR, 0, clrText) );
  6395. end;
  6396. function ListView_GetTextBkColor(hwnd: HWND): TColorRef;
  6397. begin
  6398. Result := SendMessage(hwnd, LVM_GETTEXTBKCOLOR, 0, 0);
  6399. end;
  6400. function ListView_SetTextBkColor(hwnd: HWND; clrTextBk: TColorRef): Bool;
  6401. begin
  6402. Result := Bool( SendMessage(hwnd, LVM_SETTEXTBKCOLOR, 0, clrTextBk) );
  6403. end;
  6404. function ListView_GetTopIndex(hwndLV: HWND): Integer;
  6405. begin
  6406. Result := SendMessage(hwndLV, LVM_GETTOPINDEX, 0, 0);
  6407. end;
  6408. function ListView_GetCountPerPage(hwndLV: HWND): Integer;
  6409. begin
  6410. Result := SendMessage(hwndLV, LVM_GETCOUNTPERPAGE, 0, 0);
  6411. end;
  6412. function ListView_GetOrigin(hwndLV: HWND; var ppt: TPoint): Bool;
  6413. begin
  6414. Result := Bool( SendMessage(hwndLV, LVM_GETORIGIN, 0, Longint(@ppt)) );
  6415. end;
  6416. function ListView_Update(hwndLV: HWND; i: Integer): Bool;
  6417. begin
  6418. Result := SendMessage(hwndLV, LVM_UPDATE, i, 0) <> 0;
  6419. end;
  6420. function ListView_SetItemState(hwndLV: HWND; i: Integer; data, mask: UINT): Bool;
  6421. var
  6422. Item: TLVItem;
  6423. begin
  6424. Item.stateMask := mask;
  6425. Item.state := data;
  6426. Result := Bool( SendMessage(hwndLV, LVM_SETITEMSTATE, i, Longint(@Item)) );
  6427. end;
  6428. function ListView_GetItemState(hwndLV: HWND; i, mask: Integer): Integer;
  6429. begin
  6430. Result := SendMessage(hwndLV, LVM_GETITEMSTATE, i, mask);
  6431. end;
  6432. function ListView_GetCheckState(hwndLV: HWND; i: Integer): UINT;
  6433. begin
  6434. Result := (SendMessage(hwndLV, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK) shr 12) - 1 ;
  6435. end;
  6436. procedure ListView_SetCheckState(hwndLV: HWND; i: Integer; Checked: Boolean);
  6437. var
  6438. Item: TLVItem;
  6439. begin
  6440. Item.statemask := LVIS_STATEIMAGEMASK;
  6441. Item.State := ((Integer(Checked) and 1) + 1) shl 12;
  6442. SendMessage(hwndLV, LVM_SETITEMSTATE, i, Integer(@Item));
  6443. end;
  6444. function ListView_GetItemText(hwndLV: HWND; i, iSubItem: Integer;
  6445. pszText: PWideChar; cchTextMax: Integer): Integer;
  6446. var
  6447. Item: TLVItem;
  6448. begin
  6449. Item.iSubItem := iSubItem;
  6450. Item.cchTextMax := cchTextMax;
  6451. Item.pszText := pszText;
  6452. Result := SendMessage(hwndLV, LVM_GETITEMTEXT, i, Longint(@Item));
  6453. end;
  6454. function ListView_GetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  6455. pszText: PAnsiChar; cchTextMax: Integer): Integer;
  6456. var
  6457. Item: TLVItemA;
  6458. begin
  6459. Item.iSubItem := iSubItem;
  6460. Item.cchTextMax := cchTextMax;
  6461. Item.pszText := pszText;
  6462. Result := SendMessageA(hwndLV, LVM_GETITEMTEXTA, i, Longint(@Item));
  6463. end;
  6464. function ListView_GetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  6465. pszText: PWideChar; cchTextMax: Integer): Integer;
  6466. var
  6467. Item: TLVItemW;
  6468. begin
  6469. Item.iSubItem := iSubItem;
  6470. Item.cchTextMax := cchTextMax;
  6471. Item.pszText := pszText;
  6472. Result := SendMessageW(hwndLV, LVM_GETITEMTEXTW, i, Longint(@Item));
  6473. end;
  6474. function ListView_SetItemText(hwndLV: HWND; i, iSubItem: Integer;
  6475. pszText: PWideChar): Bool;
  6476. var
  6477. Item: TLVItem;
  6478. begin
  6479. Item.iSubItem := iSubItem;
  6480. Item.pszText := pszText;
  6481. Result := Bool( SendMessage(hwndLV, LVM_SETITEMTEXT, i, Longint(@Item)) );
  6482. end;
  6483. function ListView_SetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  6484. pszText: PAnsiChar): Bool;
  6485. var
  6486. Item: TLVItemA;
  6487. begin
  6488. Item.iSubItem := iSubItem;
  6489. Item.pszText := pszText;
  6490. Result := Bool( SendMessageA(hwndLV, LVM_SETITEMTEXTA, i, Longint(@Item)) );
  6491. end;
  6492. function ListView_SetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  6493. pszText: PWideChar): Bool;
  6494. var
  6495. Item: TLVItemW;
  6496. begin
  6497. Item.iSubItem := iSubItem;
  6498. Item.pszText := pszText;
  6499. Result := Bool( SendMessageW(hwndLV, LVM_SETITEMTEXTW, i, Longint(@Item)) );
  6500. end;
  6501. procedure ListView_SetItemCount(hwndLV: HWND; cItems: Integer);
  6502. begin
  6503. SendMessage(hwndLV, LVM_SETITEMCOUNT, cItems, 0);
  6504. end;
  6505. procedure ListView_SetItemCountEx(hwndLV: HWND; cItems: Integer; dwFlags: DWORD);
  6506. begin
  6507. SendMessage(hwndLV, LVM_SETITEMCOUNT, cItems, dwFlags);
  6508. end;
  6509. function ListView_SortItems(hwndLV: HWND; pfnCompare: TLVCompare;
  6510. lPrm: Longint): Bool;
  6511. begin
  6512. Result := Bool( SendMessage(hwndLV, LVM_SORTITEMS, lPrm,
  6513. Longint(@pfnCompare)) );
  6514. end;
  6515. procedure ListView_SetItemPosition32(hwndLV: HWND; i, x, y: Integer);
  6516. var
  6517. ptNewPos: TPoint;
  6518. begin
  6519. ptNewPos.x := x;
  6520. ptNewPos.y := y;
  6521. SendMessage(hwndLV, LVM_SETITEMPOSITION32, i, Longint(@ptNewPos));
  6522. end;
  6523. function ListView_GetSelectedCount(hwndLV: HWND): UINT;
  6524. begin
  6525. Result := SendMessage(hwndLV, LVM_GETSELECTEDCOUNT, 0, 0);
  6526. end;
  6527. function ListView_GetItemSpacing(hwndLV: HWND; fSmall: Integer): Longint;
  6528. begin
  6529. Result := SendMessage(hwndLV, LVM_GETITEMSPACING, fSmall, 0);
  6530. end;
  6531. function ListView_GetISearchString(hwndLV: HWND; lpsz: PWideChar): Bool;
  6532. begin
  6533. Result := Bool( SendMessage(hwndLV, LVM_GETISEARCHSTRING, 0,
  6534. Longint(lpsz)) );
  6535. end;
  6536. function ListView_GetISearchStringA(hwndLV: HWND; lpsz: PAnsiChar): Bool;
  6537. begin
  6538. Result := Bool( SendMessageA(hwndLV, LVM_GETISEARCHSTRINGA, 0,
  6539. Longint(lpsz)) );
  6540. end;
  6541. function ListView_GetISearchStringW(hwndLV: HWND; lpsz: PWideChar): Bool;
  6542. begin
  6543. Result := Bool( SendMessageW(hwndLV, LVM_GETISEARCHSTRINGW, 0,
  6544. Longint(lpsz)) );
  6545. end;
  6546. function ListView_SetIconSpacing(hwndLV: HWND; cx, cy: Word): DWORD;
  6547. begin
  6548. Result := SendMessage(hwndLV, LVM_SETICONSPACING, 0, MakeLong(cx, cy));
  6549. end;
  6550. function ListView_SetExtendedListViewStyle(hwndLV: HWND; dw: DWORD): BOOL;
  6551. begin
  6552. Result := BOOL(SendMessage(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dw));
  6553. end;
  6554. function ListView_GetExtendedListViewStyle(hwndLV: HWND): DWORD;
  6555. begin
  6556. Result := SendMessage(hwndLV, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
  6557. end;
  6558. function ListView_GetSubItemRect(hwndLV: HWND; iItem, iSubItem: Integer;
  6559. code: DWORD; prc: PRect): BOOL;
  6560. begin
  6561. if prc <> nil then
  6562. begin
  6563. prc^.Top := iSubItem;
  6564. prc^.Left := code;
  6565. end;
  6566. Result := BOOL(SendMessage(hwndLV, LVM_GETSUBITEMRECT, iItem, Longint(prc)));
  6567. end;
  6568. function ListView_SubItemHitTest(hwndLV: HWND; plvhti: PLVHitTestInfo): Integer;
  6569. begin
  6570. Result := SendMessage(hwndLV, LVM_SUBITEMHITTEST, 0, Longint(plvhti));
  6571. end;
  6572. function ListView_SetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  6573. pi: PInteger): BOOL;
  6574. begin
  6575. Result := BOOL(SendMessage(hwndLV, LVM_SETCOLUMNORDERARRAY, iCount,
  6576. Longint(pi)));
  6577. end;
  6578. function ListView_GetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  6579. pi: PInteger): BOOL;
  6580. begin
  6581. Result := BOOL(SendMessage(hwndLV, LVM_GETCOLUMNORDERARRAY, iCount,
  6582. Longint(pi)));
  6583. end;
  6584. function ListView_SetHotItem(hwndLV: HWND; i: Integer): Integer;
  6585. begin
  6586. Result := SendMessage(hwndLV, LVM_SETHOTITEM, i, 0);
  6587. end;
  6588. function ListView_GetHotItem(hwndLV: HWND): Integer;
  6589. begin
  6590. Result := SendMessage(hwndLV, LVM_GETHOTITEM, 0, 0);
  6591. end;
  6592. function ListView_SetHotCursor(hwndLV: HWND; hcur: HCURSOR): HCURSOR;
  6593. begin
  6594. Result := SendMessage(hwndLV, LVM_SETHOTCURSOR, 0, hcur);
  6595. end;
  6596. function ListView_GetHotCursor(hwndLV: HWND): HCURSOR;
  6597. begin
  6598. Result := SendMessage(hwndLV, LVM_GETHOTCURSOR, 0, 0);
  6599. end;
  6600. function ListView_ApproximateViewRect(hwndLV: HWND; iWidth, iHeight: Word;
  6601. iCount: Integer): DWORD;
  6602. begin
  6603. Result := SendMessage(hwndLV, LVM_APPROXIMATEVIEWRECT, iCount,
  6604. MakeLParam(iWidth, iHeight));
  6605. end;
  6606. function ListView_SetWorkAreas(hwndLV: HWND; nWorkAreas: Integer; prc: PRect): BOOL;
  6607. begin
  6608. Result := BOOL(SendMessage(hwndLV, LVM_SETWORKAREA, nWorkAreas, Longint(prc)));
  6609. end;
  6610. function ListView_GetSelectionMark(hwnd: HWND): Integer;
  6611. begin
  6612. Result := SendMessage(hwnd, LVM_GETSELECTIONMARK, 0, 0);
  6613. end;
  6614. function ListView_SetSelectionMark(hwnd: HWND; i: Integer): Integer;
  6615. begin
  6616. Result := SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, i);
  6617. end;
  6618. function ListView_GetWorkAreas(hwnd: HWND; nWorkAreas: Integer; prc: PRect): BOOL;
  6619. begin
  6620. Result := BOOL(SendMessage(hwnd, LVM_GETWORKAREAS, nWorkAreas, Integer(prc)));
  6621. end;
  6622. function ListView_SetHoverTime(hwndLV: HWND; dwHoverTimeMs: DWORD): DWORD;
  6623. begin
  6624. Result := SendMessage(hwndLV, LVM_SETHOVERTIME, 0, dwHoverTimeMs);
  6625. end;
  6626. function ListView_GetHoverTime(hwndLV: HWND): Integer;
  6627. begin
  6628. Result := SendMessage(hwndLV, LVM_GETHOVERTIME, 0, 0);
  6629. end;
  6630. function ListView_GetNumberOfWorkAreas(hwnd: HWND; pnWorkAreas: PInteger): Integer;
  6631. begin
  6632. Result := SendMessage(hwnd, LVM_GETNUMBEROFWORKAREAS, 0, Integer(pnWorkAreas));
  6633. end;
  6634. function ListView_SetToolTips(hwndLV: HWND; hwndNewHwnd: HWND): HWND;
  6635. begin
  6636. Result := HWND(SendMessage(hwndLV, LVM_SETTOOLTIPS, WPARAM(hwndNewHwnd), 0));
  6637. end;
  6638. function ListView_GetToolTips(hwndLV: HWND): HWND;
  6639. begin
  6640. Result := HWND(SendMessage(hwndLV, LVM_GETTOOLTIPS, 0, 0));
  6641. end;
  6642. function ListView_SetSelectedColumn(hwnd: HWND; iCol: Integer): Integer;
  6643. begin
  6644. Result := SendMessage(hwnd, LVM_SETSELECTEDCOLUMN, WPARAM(iCol), 0);
  6645. end;
  6646. function ListView_SetView(hwnd: HWND; iView: Integer): Integer;
  6647. begin
  6648. Result := SendMessage(hwnd, LVM_SETVIEW, WPARAM(DWORD(iView)), 0);
  6649. end;
  6650. function ListView_GetView(hwnd: HWND): Integer;
  6651. begin
  6652. Result := DWORD(SendMessage(hwnd, LVM_GETVIEW, 0, 0));
  6653. end;
  6654. function ListView_InsertGroup(hwnd: HWND; index: Integer; const pgrp: TLVGroup): Integer;
  6655. begin
  6656. Result := SendMessage(hwnd, LVM_INSERTGROUP, WPARAM(index), LPARAM(@pgrp));
  6657. end;
  6658. function ListView_SetGroupInfo(hwnd: HWND; iGroupId: Integer; const pgrp: TLVGroup): Integer;
  6659. begin
  6660. Result := SendMessage(hwnd, LVM_SETGROUPINFO, WPARAM(iGroupId), LPARAM(@pgrp));
  6661. end;
  6662. function ListView_GetGroupInfo(hwnd: HWND; iGroupId: Integer; var pgrp: TLVGroup): Integer;
  6663. begin
  6664. Result := SendMessage(hwnd, LVM_GETGROUPINFO, WPARAM(iGroupId), LPARAM(@pgrp));
  6665. end;
  6666. function ListView_RemoveGroup(hwnd: HWND; iGroupId: Integer): Integer;
  6667. begin
  6668. Result := SendMessage(hwnd, LVM_REMOVEGROUP, WPARAM(iGroupId), 0);
  6669. end;
  6670. function ListView_MoveGroup(hwnd: HWND; iGroupId, toIndex: Integer): Integer;
  6671. begin
  6672. Result := SendMessage(hwnd, LVM_MOVEGROUP, WPARAM(iGroupId), LPARAM(toIndex));
  6673. end;
  6674. function ListView_GetGroupCount(hwnd: HWND): Integer;
  6675. begin
  6676. Result := SendMessage(hwnd, LVM_GETGROUPCOUNT, 0, 0);
  6677. end;
  6678. function ListView_GetGroupInfoByIndex(hwnd: HWND; iIndex: Integer; var pgrp: TLVGroup): Integer;
  6679. begin
  6680. Result := SendMessage(hwnd, LVM_GETGROUPINFOBYINDEX, WPARAM(iIndex), LPARAM(@pgrp));
  6681. end;
  6682. function ListView_MoveItemToGroup(hwnd: HWND; idItemFrom, idGroupTo: Integer): Integer;
  6683. begin
  6684. Result := SendMessage(hwnd, LVM_MOVEITEMTOGROUP, WPARAM(idItemFrom), LPARAM(idGroupTo));
  6685. end;
  6686. function ListView_GetGroupRect(hwnd: HWND; iGroupId, iType: Integer; var prc: TRect): Integer;
  6687. begin
  6688. prc.Top := iType;
  6689. Result := SendMessage(hwnd, LVM_GETGROUPRECT, WPARAM(iGroupId), LPARAM(@prc));
  6690. end;
  6691. function ListView_SetGroupMetrics(hwnd: HWND; const pGroupMetrics: TLVGroupMetrics): Integer;
  6692. begin
  6693. Result := SendMessage(hwnd, LVM_SETGROUPMETRICS, 0, LPARAM(@pGroupMetrics));
  6694. end;
  6695. function ListView_GetGroupMetrics(hwnd: HWND; var pGroupMetrics: TLVGroupMetrics): Integer;
  6696. begin
  6697. Result := SendMessage(hwnd, LVM_GETGROUPMETRICS, 0, LPARAM(@pGroupMetrics));
  6698. end;
  6699. function ListView_EnableGroupView(hwnd: HWND; fEnable: BOOL): Integer;
  6700. begin
  6701. Result := SendMessage(hwnd, LVM_ENABLEGROUPVIEW, WPARAM(fEnable), 0);
  6702. end;
  6703. function ListView_SortGroups(hwnd: HWND; pfnGroupCompare: TFNLVGroupCompare; plv: Pointer): Integer;
  6704. begin
  6705. Result := SendMessage(hwnd, LVM_SORTGROUPS, WPARAM(@pfnGroupCompare), LPARAM(plv));
  6706. end;
  6707. function ListView_InsertGroupSorted(hwnd: HWND; const structInsert: TLVInsertGroupSorted): Integer;
  6708. begin
  6709. Result := SendMessage(hwnd, LVM_INSERTGROUPSORTED, WPARAM(@structInsert), 0);
  6710. end;
  6711. function ListView_RemoveAllGroups(hwnd: HWND): Integer;
  6712. begin
  6713. Result := SendMessage(hwnd, LVM_REMOVEALLGROUPS, 0, 0);
  6714. end;
  6715. function ListView_HasGroup(hwnd: HWND; dwGroupId: Integer): Integer;
  6716. begin
  6717. Result := SendMessage(hwnd, LVM_HASGROUP, dwGroupId, 0);
  6718. end;
  6719. function ListView_SetGroupState(hwnd: HWND; dwGroupId, dwMask, dwState: UINT): Integer;
  6720. var
  6721. LGroup: TLVGroup;
  6722. begin
  6723. LGroup.cbSize := SizeOf(LGroup);
  6724. LGroup.mask := LVGF_STATE;
  6725. LGroup.stateMask := dwMask;
  6726. LGroup.state := dwState;
  6727. Result := SendMessage(hwnd, LVM_SETGROUPINFO, WPARAM(dwGroupId), LPARAM(@LGroup));
  6728. end;
  6729. function ListView_GetGroupState(hwnd: HWND; dwGroupId, dwMask: UINT): Integer;
  6730. begin
  6731. Result := SendMessage(hwnd, LVM_GETGROUPSTATE, WPARAM(dwGroupId), LPARAM(dwMask));
  6732. end;
  6733. function ListView_GetFocusedGroup(hwnd: HWND): Integer;
  6734. begin
  6735. Result := SendMessage(hwnd, LVM_GETFOCUSEDGROUP, 0, 0);
  6736. end;
  6737. function ListView_SetTileViewInfo(hwnd: HWND; const ptvi: TLVTileViewInfo): Integer;
  6738. begin
  6739. Result := SendMessage(hwnd, LVM_SETTILEVIEWINFO, 0, LPARAM(@ptvi));
  6740. end;
  6741. function ListView_GetTileViewInfo(hwnd: HWND; var ptvi: TLVTileViewInfo): Integer;
  6742. begin
  6743. Result := SendMessage(hwnd, LVM_GETTILEVIEWINFO, 0, LPARAM(@ptvi));
  6744. end;
  6745. function ListView_SetTileInfo(hwnd: HWND; const pti: TLVTileInfo): Integer;
  6746. begin
  6747. Result := SendMessage(hwnd, LVM_SETTILEINFO, 0, LPARAM(@pti));
  6748. end;
  6749. function ListView_GetTileInfo(hwnd: HWND; var pti: TLVTileInfo): Integer;
  6750. begin
  6751. Result := SendMessage(hwnd, LVM_GETTILEINFO, 0, LPARAM(@pti));
  6752. end;
  6753. function ListView_SetInsertMark(hwnd: HWND; const lvim: TLVInsertMark): BOOL;
  6754. begin
  6755. Result := BOOL(SendMessage(hwnd, LVM_SETINSERTMARK, 0, LPARAM(@lvim)));
  6756. end;
  6757. function ListView_GetInsertMark(hwnd: HWND; var lvim: TLVInsertMark): BOOL;
  6758. begin
  6759. Result := BOOL(SendMessage(hwnd, LVM_GETINSERTMARK, 0, LPARAM(@lvim)));
  6760. end;
  6761. function ListView_InsertMarkHitTest(hwnd: HWND; const point: TPoint;
  6762. const lvim: TLVInsertMark): Integer;
  6763. begin
  6764. Result := SendMessage(hwnd, LVM_INSERTMARKHITTEST, WPARAM(@point), LPARAM(@lvim));
  6765. end;
  6766. function ListView_GetInsertMarkRect(hwnd: HWND; var rc: TRect): Integer;
  6767. begin
  6768. Result := SendMessage(hwnd, LVM_GETINSERTMARKRECT, 0, LPARAM(@rc));
  6769. end;
  6770. function ListView_SetInsertMarkColor(hwnd: HWND; color: TColorRef): TColorRef;
  6771. begin
  6772. Result := TColorRef(SendMessage(hwnd, LVM_SETINSERTMARKCOLOR, 0, LPARAM(color)));
  6773. end;
  6774. function ListView_GetInsertMarkColor(hwnd: HWND): TColorRef;
  6775. begin
  6776. Result := TColorRef(SendMessage(hwnd, LVM_GETINSERTMARKCOLOR, 0, 0));
  6777. end;
  6778. function ListView_SetInfoTip(hwndLV: HWND; const plvInfoTip: TLVSetInfoTip): BOOL;
  6779. begin
  6780. Result := BOOL(SendMessage(hwndLV, LVM_SETINFOTIP, 0, LPARAM(@plvInfoTip)));
  6781. end;
  6782. function ListView_GetSelectedColumn(hwnd: HWND): UINT;
  6783. begin
  6784. Result := UINT(SendMessage(hwnd, LVM_GETSELECTEDCOLUMN, 0, 0));
  6785. end;
  6786. function ListView_IsGroupViewEnabled(hwnd: HWND): BOOL;
  6787. begin
  6788. Result := BOOL(SendMessage(hwnd, LVM_ISGROUPVIEWENABLED, 0, 0));
  6789. end;
  6790. function ListView_GetOutlineColor(hwnd: HWND): TColorRef;
  6791. begin
  6792. Result := TColorRef(SendMessage(hwnd, LVM_GETOUTLINECOLOR, 0, 0));
  6793. end;
  6794. function ListView_SetOutlineColor(hwnd: HWND; color: TColorRef): TColorRef;
  6795. begin
  6796. Result := TColorRef(SendMessage(hwnd, LVM_SETOUTLINECOLOR, 0, LPARAM(color)));
  6797. end;
  6798. function ListView_CancelEditLabel(hwnd: HWND): Integer;
  6799. begin
  6800. Result := SendMessage(hwnd, LVM_CANCELEDITLABEL, 0, 0);
  6801. end;
  6802. function ListView_MapIndexToID(hwnd: HWND; index: UINT): UINT;
  6803. begin
  6804. Result := UINT(SendMessage(hwnd, LVM_MAPINDEXTOID, WPARAM(index), 0));
  6805. end;
  6806. function ListView_MapIDToIndex(hwnd: HWND; id: UINT): UINT;
  6807. begin
  6808. Result := UINT(SendMessage(hwnd, LVM_MAPIDTOINDEX, WPARAM(id), 0));
  6809. end;
  6810. function ListView_IsItemVisible(hwnd: HWND; index: UINT): UINT;
  6811. begin
  6812. Result := UINT(SendMessage(hwnd, LVM_ISITEMVISIBLE, WPARAM(index), 0));
  6813. end;
  6814. function ListView_SetGroupHeaderImageList(hwnd: HWND; himl: HIMAGELIST): HIMAGELIST;
  6815. begin
  6816. Result := HIMAGELIST(SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_GROUPHEADER, LPARAM(himl)));
  6817. end;
  6818. function ListView_GetGroupHeaderImageList(hwnd: HWND): HIMAGELIST;
  6819. begin
  6820. Result := HIMAGELIST(SendMessage(hwnd, LVM_GETIMAGELIST, LVSIL_GROUPHEADER, 0));
  6821. end;
  6822. function ListView_GetEmptyText(hwnd: HWND; pszText: LPWSTR; cchText: UINT): BOOL;
  6823. begin
  6824. Result := BOOL(SendMessage(hwnd, LVM_GETEMPTYTEXT, WPARAM(cchText), LPARAM(pszText)));
  6825. end;
  6826. function ListView_GetFooterRect(hwnd: HWND; var prc: TRect): BOOL;
  6827. begin
  6828. Result := BOOL(SendMessage(hwnd, LVM_GETFOOTERRECT, 0, LPARAM(@prc)));
  6829. end;
  6830. function ListView_GetFooterInfo(hwnd: HWND; var plvfi: TLVFooterInfo): BOOL;
  6831. begin
  6832. Result := BOOL(SendMessage(hwnd, LVM_GETFOOTERINFO, 0, LPARAM(@plvfi)));
  6833. end;
  6834. function ListView_GetFooterItemRect(hwnd: HWND; iItem: UINT; var prc: TRect): BOOL;
  6835. begin
  6836. Result := BOOL(SendMessage(hwnd, LVM_GETFOOTERITEMRECT, iItem, LPARAM(@prc)));
  6837. end;
  6838. function ListView_GetFooterItem(hwnd: HWND; iItem: UINT; var pfi: TLVFooterItem): BOOL;
  6839. begin
  6840. Result := BOOL(SendMessage(hwnd, LVM_GETFOOTERITEM, iItem, LPARAM(@pfi)));
  6841. end;
  6842. function ListView_GetItemIndexRect(hwnd: HWND; const plvii: TLVItemIndex;
  6843. iSubItem, code: Integer; var prc: TRect): BOOL;
  6844. begin
  6845. prc.Top := iSubItem;
  6846. prc.Left := Code;
  6847. Result := BOOL(SendMessage(hwnd, LVM_GETITEMINDEXRECT, WPARAM(@plvii), LPARAM(@prc)));
  6848. end;
  6849. function ListView_SetItemIndexState(hwnd: HWND; const plvii: TLVItemIndex;
  6850. data, mask: UINT): HRESULT;
  6851. var
  6852. LItem: TLVItem;
  6853. begin
  6854. LItem.stateMask := mask;
  6855. LItem.state := data;
  6856. Result := HRESULT(SendMessage(hwnd, LVM_SETITEMSTATE, WPARAM(@plvii), LPARAM(@LItem)));
  6857. end;
  6858. function ListView_GetNextItemIndex(hwnd: HWND; var plvii: TLVItemIndex;
  6859. flags: LPARAM): BOOL;
  6860. begin
  6861. Result := BOOL(SendMessage(hwnd, LVM_GETNEXTITEMINDEX, WPARAM(@plvii),
  6862. MakeLParam(flags, 0)));
  6863. end;
  6864. function ListView_SetBkImage(hwnd: HWND; plvbki: PLVBKImage): BOOL;
  6865. begin
  6866. Result := BOOL(SendMessage(hwnd, LVM_SETBKIMAGE, 0, LPARAM(plvbki)));
  6867. end;
  6868. function ListView_SetBkImageA(hwnd: HWND; plvbki: PLVBKImageA): BOOL;
  6869. begin
  6870. Result := BOOL(SendMessageA(hwnd, LVM_SETBKIMAGEA, 0, LPARAM(plvbki)));
  6871. end;
  6872. function ListView_SetBkImageW(hwnd: HWND; plvbki: PLVBKImageW): BOOL;
  6873. begin
  6874. Result := BOOL(SendMessageW(hwnd, LVM_SETBKIMAGEW, 0, LPARAM(plvbki)));
  6875. end;
  6876. function ListView_GetBkImage(hwnd: HWND; plvbki: PLVBKImage): BOOL;
  6877. begin
  6878. Result := BOOL(SendMessage(hwnd, LVM_GETBKIMAGE, 0, LPARAM(plvbki)));
  6879. end;
  6880. function ListView_GetBkImageA(hwnd: HWND; plvbki: PLVBKImageA): BOOL;
  6881. begin
  6882. Result := BOOL(SendMessageA(hwnd, LVM_GETBKIMAGEA, 0, LPARAM(plvbki)));
  6883. end;
  6884. function ListView_GetBkImageW(hwnd: HWND; plvbki: PLVBKImageW): BOOL;
  6885. begin
  6886. Result := BOOL(SendMessageW(hwnd, LVM_GETBKIMAGEW, 0, LPARAM(plvbki)));
  6887. end;
  6888. { Tree View }
  6889. function TreeView_InsertItem(hwnd: HWND; const lpis: TTVInsertStruct): HTreeItem;
  6890. begin
  6891. Result := HTreeItem( SendMessage(hwnd, TVM_INSERTITEM, 0, Longint(@lpis)) );
  6892. end;
  6893. function TreeView_InsertItemA(hwnd: HWND; const lpis: TTVInsertStructA): HTreeItem;
  6894. begin
  6895. Result := HTreeItem( SendMessageA(hwnd, TVM_INSERTITEMA, 0, Longint(@lpis)) );
  6896. end;
  6897. function TreeView_InsertItemW(hwnd: HWND; const lpis: TTVInsertStructW): HTreeItem;
  6898. begin
  6899. Result := HTreeItem( SendMessageW(hwnd, TVM_INSERTITEMW, 0, Longint(@lpis)) );
  6900. end;
  6901. function TreeView_DeleteItem(hwnd: HWND; hitem: HTreeItem): Bool;
  6902. begin
  6903. Result := Bool( SendMessage(hwnd, TVM_DELETEITEM, 0, Longint(hitem)) );
  6904. end;
  6905. function TreeView_DeleteAllItems(hwnd: HWND): Bool;
  6906. begin
  6907. Result := Bool( SendMessage(hwnd, TVM_DELETEITEM, 0, Longint(TVI_ROOT)) );
  6908. end;
  6909. function TreeView_Expand(hwnd: HWND; hitem: HTreeItem; code: Integer): Bool;
  6910. begin
  6911. Result := Bool( SendMessage(hwnd, TVM_EXPAND, code, Longint(hitem)) );
  6912. end;
  6913. function TreeView_GetItemRect(hwnd: HWND; hitem: HTreeItem;
  6914. var prc: TRect; code: Bool): Bool;
  6915. begin
  6916. HTreeItem(Pointer(@prc)^) := hitem;
  6917. Result := Bool( SendMessage(hwnd, TVM_GETITEMRECT, Integer(code), Longint(@prc)) );
  6918. end;
  6919. function TreeView_GetCount(hwnd: HWND): UINT;
  6920. begin
  6921. Result := SendMessage(hwnd, TVM_GETCOUNT, 0, 0);
  6922. end;
  6923. function TreeView_GetIndent(hwnd: HWND): UINT;
  6924. begin
  6925. Result := SendMessage(hwnd, TVM_GETINDENT, 0, 0);
  6926. end;
  6927. function TreeView_SetIndent(hwnd: HWND; indent: Integer): Bool;
  6928. begin
  6929. Result := Bool( SendMessage(hwnd, TVM_SETINDENT, indent, 0) );
  6930. end;
  6931. function TreeView_GetImageList(hwnd: HWND; iImage: Integer): HIMAGELIST;
  6932. begin
  6933. Result := HIMAGELIST( SendMessage(hwnd, TVM_GETIMAGELIST, iImage, 0) );
  6934. end;
  6935. function TreeView_SetImageList(hwnd: HWND; himl: HIMAGELIST;
  6936. iImage: Integer): HIMAGELIST;
  6937. begin
  6938. Result := HIMAGELIST( SendMessage(hwnd, TVM_SETIMAGELIST, iImage,
  6939. Longint(himl)) );
  6940. end;
  6941. function TreeView_GetNextItem(hwnd: HWND; hitem: HTreeItem;
  6942. code: Integer): HTreeItem;
  6943. begin
  6944. Result := HTreeItem( SendMessage(hwnd, TVM_GETNEXTITEM, code,
  6945. Longint(hitem)) );
  6946. end;
  6947. function TreeView_GetChild(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6948. begin
  6949. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD);
  6950. end;
  6951. function TreeView_GetNextSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6952. begin
  6953. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT);
  6954. end;
  6955. function TreeView_GetPrevSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6956. begin
  6957. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS);
  6958. end;
  6959. function TreeView_GetParent(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6960. begin
  6961. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT);
  6962. end;
  6963. function TreeView_GetFirstVisible(hwnd: HWND): HTreeItem;
  6964. begin
  6965. Result := TreeView_GetNextItem(hwnd, nil, TVGN_FIRSTVISIBLE);
  6966. end;
  6967. function TreeView_GetNextVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6968. begin
  6969. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE);
  6970. end;
  6971. function TreeView_GetPrevVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6972. begin
  6973. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE);
  6974. end;
  6975. function TreeView_GetSelection(hwnd: HWND): HTreeItem;
  6976. begin
  6977. Result := TreeView_GetNextItem(hwnd, nil, TVGN_CARET);
  6978. end;
  6979. function TreeView_GetDropHilite(hwnd: HWND): HTreeItem;
  6980. begin
  6981. Result := TreeView_GetNextItem(hwnd, nil, TVGN_DROPHILITE);
  6982. end;
  6983. function TreeView_GetRoot(hwnd: HWND): HTreeItem;
  6984. begin
  6985. Result := TreeView_GetNextItem(hwnd, nil, TVGN_ROOT);
  6986. end;
  6987. function TreeView_GetLastVisible(hwnd: HWND): HTreeItem;
  6988. begin
  6989. Result := TreeView_GetNextItem(hwnd, nil, TVGN_LASTVISIBLE);
  6990. end;
  6991. function TreeView_GetNextSelected(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  6992. begin
  6993. Result := TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTSELECTED);
  6994. end;
  6995. function TreeView_Select(hwnd: HWND; hitem: HTreeItem;
  6996. code: Integer): HTreeItem;
  6997. begin
  6998. Result := HTreeItem( SendMessage(hwnd, TVM_SELECTITEM, code,
  6999. Longint(hitem)) );
  7000. end;
  7001. function TreeView_SelectItem(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  7002. begin
  7003. Result := TreeView_Select(hwnd, hitem, TVGN_CARET);
  7004. end;
  7005. function TreeView_SelectDropTarget(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  7006. begin
  7007. Result := TreeView_Select(hwnd, hitem, TVGN_DROPHILITE);
  7008. end;
  7009. function TreeView_SelectSetFirstVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  7010. begin
  7011. Result := TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE);
  7012. end;
  7013. function TreeView_GetItem(hwnd: HWND; var pitem: TTVItem): Bool;
  7014. begin
  7015. Result := Bool( SendMessage(hwnd, TVM_GETITEM, 0, Longint(@pitem)) );
  7016. end;
  7017. function TreeView_GetItemA(hwnd: HWND; var pitem: TTVItemA): Bool;
  7018. begin
  7019. Result := Bool( SendMessageA(hwnd, TVM_GETITEMA, 0, Longint(@pitem)) );
  7020. end;
  7021. function TreeView_GetItemW(hwnd: HWND; var pitem: TTVItemW): Bool;
  7022. begin
  7023. Result := Bool( SendMessageW(hwnd, TVM_GETITEMW, 0, Longint(@pitem)) );
  7024. end;
  7025. function TreeView_SetItem(hwnd: HWND; const pitem: TTVItem): Bool;
  7026. begin
  7027. Result := Bool( SendMessage(hwnd, TVM_SETITEM, 0, Longint(@pitem)) );
  7028. end;
  7029. function TreeView_SetItem(hwnd: HWND; const pitem: TTVItemEx): Bool;
  7030. begin
  7031. Result := Bool( SendMessage(hwnd, TVM_SETITEM, 0, Longint(@pitem)) );
  7032. end;
  7033. function TreeView_SetItemA(hwnd: HWND; const pitem: TTVItemA): Bool;
  7034. begin
  7035. Result := Bool( SendMessageA(hwnd, TVM_SETITEMA, 0, Longint(@pitem)) );
  7036. end;
  7037. function TreeView_SetItemA(hwnd: HWND; const pitem: TTVItemExA): Bool;
  7038. begin
  7039. Result := Bool( SendMessageA(hwnd, TVM_SETITEMA, 0, Longint(@pitem)) );
  7040. end;
  7041. function TreeView_SetItemW(hwnd: HWND; const pitem: TTVItemW): Bool;
  7042. begin
  7043. Result := Bool( SendMessageW(hwnd, TVM_SETITEMW, 0, Longint(@pitem)) );
  7044. end;
  7045. function TreeView_SetItemW(hwnd: HWND; const pitem: TTVItemExW): Bool;
  7046. begin
  7047. Result := Bool( SendMessageW(hwnd, TVM_SETITEMW, 0, Longint(@pitem)) );
  7048. end;
  7049. function TreeView_EditLabel(hwnd: HWND; hitem: HTreeItem): HWND;
  7050. begin
  7051. Result := Windows.HWND( SendMessage(hwnd, TVM_EDITLABEL, 0, Longint(hitem)) );
  7052. end;
  7053. function TreeView_EditLabelA(hwnd: HWND; hitem: HTreeItem): HWND;
  7054. begin
  7055. Result := Windows.HWND( SendMessageA(hwnd, TVM_EDITLABELA, 0, Longint(hitem)) );
  7056. end;
  7057. function TreeView_EditLabelW(hwnd: HWND; hitem: HTreeItem): HWND;
  7058. begin
  7059. Result := Windows.HWND( SendMessageW(hwnd, TVM_EDITLABELW, 0, Longint(hitem)) );
  7060. end;
  7061. function TreeView_GetEditControl(hwnd: HWND): HWND;
  7062. begin
  7063. Result := Windows.HWND( SendMessage(hwnd, TVM_GETEDITCONTROL, 0, 0) );
  7064. end;
  7065. function TreeView_GetVisibleCount(hwnd: HWND): UINT;
  7066. begin
  7067. Result := SendMessage(hwnd, TVM_GETVISIBLECOUNT, 0, 0);
  7068. end;
  7069. function TreeView_HitTest(hwnd: HWND; var lpht: TTVHitTestInfo): HTreeItem;
  7070. begin
  7071. Result := HTreeItem( SendMessage(hwnd, TVM_HITTEST, 0, Longint(@lpht)) );
  7072. end;
  7073. function TreeView_CreateDragImage(hwnd: HWND; hitem: HTreeItem): HIMAGELIST;
  7074. begin
  7075. Result := HIMAGELIST( SendMessage(hwnd, TVM_CREATEDRAGIMAGE, 0,
  7076. Longint(hitem)) );
  7077. end;
  7078. function TreeView_SortChildren(hwnd: HWND; hitem: HTreeItem;
  7079. recurse: Integer): Bool;
  7080. begin
  7081. Result := Bool( SendMessage(hwnd, TVM_SORTCHILDREN, recurse,
  7082. Longint(hitem)) );
  7083. end;
  7084. function TreeView_EnsureVisible(hwnd: HWND; hitem: HTreeItem): Bool;
  7085. begin
  7086. Result := Bool( SendMessage(hwnd, TVM_ENSUREVISIBLE, 0, Longint(hitem)) );
  7087. end;
  7088. function TreeView_SortChildrenCB(hwnd: HWND; const psort: TTVSortCB;
  7089. recurse: Integer): Bool;
  7090. begin
  7091. Result := Bool( SendMessage(hwnd, TVM_SORTCHILDRENCB, recurse,
  7092. Longint(@psort)) );
  7093. end;
  7094. function TreeView_EndEditLabelNow(hwnd: HWND; fCancel: Bool): Bool;
  7095. begin
  7096. Result := Bool( SendMessage(hwnd, TVM_ENDEDITLABELNOW, Integer(fCancel),
  7097. 0) );
  7098. end;
  7099. function TreeView_GetISearchString(hwndTV: HWND; lpsz: PWideChar): Bool;
  7100. begin
  7101. Result := Bool( SendMessage(hwndTV, TVM_GETISEARCHSTRING, 0,
  7102. Longint(lpsz)) );
  7103. end;
  7104. function TreeView_GetISearchStringA(hwndTV: HWND; lpsz: PAnsiChar): Bool;
  7105. begin
  7106. Result := Bool( SendMessageA(hwndTV, TVM_GETISEARCHSTRINGA, 0,
  7107. Longint(lpsz)) );
  7108. end;
  7109. function TreeView_GetISearchStringW(hwndTV: HWND; lpsz: PWideChar): Bool;
  7110. begin
  7111. Result := Bool( SendMessageW(hwndTV, TVM_GETISEARCHSTRINGW, 0,
  7112. Longint(lpsz)) );
  7113. end;
  7114. function TreeView_SetToolTips(wnd: HWND; hwndTT: HWND): HWND;
  7115. begin
  7116. Result := HWND(SendMessage(wnd, TVM_SETTOOLTIPS, WPARAM(hwndTT), 0));
  7117. end;
  7118. function TreeView_GetToolTips(wnd: HWND): HWND;
  7119. begin
  7120. Result := HWND(SendMessage(wnd, TVM_GETTOOLTIPS, 0, 0));
  7121. end;
  7122. function TreeView_SetInsertMark(hwnd: HWND; hItem: Integer; fAfter: BOOL): BOOL;
  7123. begin
  7124. Result := BOOL(SendMessage(hwnd, TVM_SETINSERTMARK, WPARAM(fAfter), LPARAM(hItem)));
  7125. end;
  7126. function TreeView_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL;
  7127. begin
  7128. Result := BOOL(SendMessage(hwnd, TVM_SETUNICODEFORMAT, WPARAM(fUnicode), 0));
  7129. end;
  7130. function TreeView_GetUnicodeFormat(hwnd: HWND): BOOL;
  7131. begin
  7132. Result := BOOL(SendMessage(hwnd, TVM_GETUNICODEFORMAT, 0, 0));
  7133. end;
  7134. function TreeView_SetItemHeight(hwnd: HWND; iHeight: Integer): Integer;
  7135. begin
  7136. Result := SendMessage(hwnd, TVM_SETITEMHEIGHT, iHeight, 0);
  7137. end;
  7138. function TreeView_GetItemHeight(hwnd: HWND): Integer;
  7139. begin
  7140. Result := SendMessage(hwnd, TVM_GETITEMHEIGHT, 0, 0);
  7141. end;
  7142. function TreeView_SetBkColor(hwnd: HWND; clr: COLORREF): COLORREF;
  7143. begin
  7144. Result := COLORREF(SendMessage(hwnd, TVM_SETBKCOLOR, 0, LPARAM(clr)));
  7145. end;
  7146. function TreeView_SetTextColor(hwnd: HWND; clr: COLORREF): COLORREF;
  7147. begin
  7148. Result := COLORREF(SendMessage(hwnd, TVM_SETTEXTCOLOR, 0, LPARAM(clr)));
  7149. end;
  7150. function TreeView_GetBkColor(hwnd: HWND): COLORREF;
  7151. begin
  7152. Result := COLORREF(SendMessage(hwnd, TVM_GETBKCOLOR, 0, 0));
  7153. end;
  7154. function TreeView_GetTextColor(hwnd: HWND): COLORREF;
  7155. begin
  7156. Result := COLORREF(SendMessage(hwnd, TVM_GETTEXTCOLOR, 0, 0));
  7157. end;
  7158. function TreeView_SetScrollTime(hwnd: HWND; uTime: UINT): UINT;
  7159. begin
  7160. Result := SendMessage(hwnd, TVM_SETSCROLLTIME, uTime, 0);
  7161. end;
  7162. function TreeView_GetScrollTime(hwnd: HWND): UINT;
  7163. begin
  7164. Result := SendMessage(hwnd, TVM_GETSCROLLTIME, 0, 0);
  7165. end;
  7166. function TreeView_SetInsertMarkColor(hwnd: HWND; clr: COLORREF): COLORREF;
  7167. begin
  7168. Result := COLORREF(SendMessage(hwnd, TVM_SETINSERTMARKCOLOR, 0, LPARAM(clr)));
  7169. end;
  7170. function TreeView_GetInsertMarkColor(hwnd: HWND): COLORREF;
  7171. begin
  7172. Result := COLORREF(SendMessage(hwnd, TVM_GETINSERTMARKCOLOR, 0, 0));
  7173. end;
  7174. function TreeView_SetItemState(hwndTV: HWND; hti: HTreeItem; State, Mask: UINT): UINT;
  7175. var
  7176. LItem: TTVItem;
  7177. begin
  7178. LItem.mask := TVIF_STATE;
  7179. LItem.hItem := hti;
  7180. LItem.stateMask := Mask;
  7181. LItem.state := State;
  7182. Result := SendMessage(hwndTV, TVM_SETITEM, 0, LPARAM(@LItem));
  7183. end;
  7184. function TreeView_SetCheckState(hwndTV: HWND; hti: HTreeItem; fCheck: BOOL): UINT;
  7185. var
  7186. LState: UINT;
  7187. begin
  7188. if IndexToStateImageMask(Integer(fCheck)) = 0 then
  7189. LState := 1
  7190. else
  7191. LState := 2;
  7192. Result := TreeView_SetItemState(hwndTV, hti, LState, TVIS_STATEIMAGEMASK);
  7193. end;
  7194. function TreeView_GetItemState(hwndTV: HWND; hti: HTreeItem; mask: UINT): UINT;
  7195. begin
  7196. Result := UINT(SendMessage(hwndTV, TVM_GETITEMSTATE, WPARAM(hti), LPARAM(mask)));
  7197. end;
  7198. function TreeView_GetCheckState(hwndTV: HWND; hti: HTreeItem): UINT;
  7199. begin
  7200. Result := (UINT(SendMessage(hwndTV, TVM_GETITEMSTATE, WPARAM(hti), TVIS_STATEIMAGEMASK)) shr 12) - 1;
  7201. end;
  7202. function TreeView_SetLineColor(hwnd: HWND; clr: TColorRef): TColorRef;
  7203. begin
  7204. Result := TColorRef(SendMessage(hwnd, TVM_SETLINECOLOR, 0, LPARAM(clr)));
  7205. end;
  7206. function TreeView_GetLineColor(hwnd: HWND): Integer;
  7207. begin
  7208. Result := TColorRef(SendMessage(hwnd, TVM_GETLINECOLOR, 0, 0));
  7209. end;
  7210. function TreeView_MapAccIDToHTREEITEM(hwnd: HWND; id: UINT): HTreeItem;
  7211. begin
  7212. Result := HTreeItem(SendMessage(hwnd, TVM_MAPACCIDTOHTREEITEM, id, 0));
  7213. end;
  7214. function TreeView_MapHTREEITEMToAccID(hwnd: HWND; hti: HTreeItem): UINT;
  7215. begin
  7216. Result := UINT(SendMessage(hwnd, TVM_MAPHTREEITEMTOACCID, WPARAM(hti), 0));
  7217. end;
  7218. function TreeView_SetExtendedStyle(hwnd: HWND; dw: DWORD; mask: UINT): UINT;
  7219. begin
  7220. Result := DWORD(SendMessage(hwnd, TVM_SETEXTENDEDSTYLE, mask, dw));
  7221. end;
  7222. function TreeView_GetExtendedStyle(hwnd: HWND): DWORD;
  7223. begin
  7224. Result := DWORD(SendMessage(hwnd, TVM_GETEXTENDEDSTYLE, 0, 0));
  7225. end;
  7226. function TreeView_SetAutoScrollInfo(hwnd: HWND; uPixPerSec, uUpdateTime: UINT): LRESULT;
  7227. begin
  7228. Result := SendMessage(hwnd, TVM_SETAUTOSCROLLINFO, WPARAM(uPixPerSec), LPARAM(uUpdateTime));
  7229. end;
  7230. function TreeView_GetSelectedCount(hwnd: HWND): DWORD;
  7231. begin
  7232. Result := DWORD(SendMessage(hwnd, TVM_GETSELECTEDCOUNT, 0, 0));
  7233. end;
  7234. function TreeView_ShowInfoTip(hwnd: HWND; hti: HTreeItem): DWORD;
  7235. begin
  7236. Result := DWORD(SendMessage(hwnd, TVM_SHOWINFOTIP, 0, LPARAM(hti)));
  7237. end;
  7238. function TreeView_GetItemPartRect(hwnd: HWND; hitem: HTreeItem; var prc: TRect;
  7239. partid: TTVItemPart): BOOL;
  7240. var
  7241. Info: TTVGetItemPartRectInfo;
  7242. begin
  7243. Info.hti := hitem;
  7244. Info.prc := @prc;
  7245. Info.partID := partid;
  7246. Result := BOOL(SendMessage(hwnd, TVM_GETITEMPARTRECT, 0, LPARAM(@Info)));
  7247. end;
  7248. { Tab control }
  7249. function TabCtrl_HitTest(hwndTC: HWND; pinfo: PTCHitTestInfo): Integer;
  7250. begin
  7251. Result := SendMessage(hwndTC, TCM_HITTEST, 0, LPARAM(pinfo));
  7252. end;
  7253. function TabCtrl_HitTest(hwndTC: HWND; const pinfo: TTCHitTestInfo): Integer;
  7254. begin
  7255. Result := SendMessage(hwndTC, TCM_HITTEST, 0, LPARAM(@pinfo));
  7256. end;
  7257. function TabCtrl_SetItemExtra(hwndTC: HWND; cb: Integer): BOOL;
  7258. begin
  7259. Result := BOOL(SendMessage(hwndTC, TCM_SETITEMEXTRA, cb, 0));
  7260. end;
  7261. function TabCtrl_AdjustRect(hwnd: HWND; bLarger: BOOL; prc: PRect): Integer;
  7262. begin
  7263. Result := SendMessage(hwnd, TCM_ADJUSTRECT, WPARAM(bLarger), LPARAM(prc));
  7264. end;
  7265. function TabCtrl_SetItemSize(hwnd: HWND; x, y: Integer): DWORD;
  7266. begin
  7267. Result := SendMessage(hwnd, TCM_SETITEMSIZE, 0, MAKELPARAM(x, y));
  7268. end;
  7269. procedure TabCtrl_RemoveImage(hwnd: HWND; i: Integer);
  7270. begin
  7271. SendMessage(hwnd, TCM_REMOVEIMAGE, i, 0);
  7272. end;
  7273. procedure TabCtrl_SetPadding(hwnd: HWND; cx, cy: Integer);
  7274. begin
  7275. SendMessage(hwnd, TCM_SETPADDING, 0, MAKELPARAM(cx, cy));
  7276. end;
  7277. function TabCtrl_GetRowCount(hwnd: HWND): Integer;
  7278. begin
  7279. Result := SendMessage(hwnd, TCM_GETROWCOUNT, 0, 0);
  7280. end;
  7281. function TabCtrl_GetToolTips(wnd: HWND): HWND;
  7282. begin
  7283. Result := HWND(SendMessage(wnd, TCM_GETTOOLTIPS, 0, 0));
  7284. end;
  7285. procedure TabCtrl_SetToolTips(hwnd: HWND; hwndTT: HWND);
  7286. begin
  7287. SendMessage(hwnd, TCM_SETTOOLTIPS, WPARAM(hwndTT), 0);
  7288. end;
  7289. function TabCtrl_GetCurFocus(hwnd: HWND): Integer;
  7290. begin
  7291. Result := SendMessage(hwnd, TCM_GETCURFOCUS, 0, 0);
  7292. end;
  7293. procedure TabCtrl_SetCurFocus(hwnd: HWND; i: Integer);
  7294. begin
  7295. SendMessage(hwnd,TCM_SETCURFOCUS, i, 0);
  7296. end;
  7297. function TabCtrl_SetMinTabWidth(hwnd: HWND; x: Integer): Integer;
  7298. begin
  7299. Result := SendMessage(hwnd, TCM_SETMINTABWIDTH, 0, x);
  7300. end;
  7301. procedure TabCtrl_DeselectAll(hwnd: HWND; fExcludeFocus: BOOL);
  7302. begin
  7303. SendMessage(hwnd, TCM_DESELECTALL, WPARAM(fExcludeFocus), 0)
  7304. end;
  7305. function TabCtrl_HighlightItem(hwnd: HWND; i: Integer; fHighlight: WordBool): BOOL;
  7306. begin
  7307. Result := BOOL(SendMessage(hwnd, TCM_HIGHLIGHTITEM, i, MAKELONG(Word(fHighlight), 0)));
  7308. end;
  7309. function TabCtrl_SetExtendedStyle(hwnd: HWND; dw: DWORD): DWORD;
  7310. begin
  7311. Result := SendMessage(hwnd, TCM_SETEXTENDEDSTYLE, 0, dw);
  7312. end;
  7313. function TabCtrl_GetExtendedStyle(hwnd: HWND): DWORD;
  7314. begin
  7315. Result := SendMessage(hwnd, TCM_GETEXTENDEDSTYLE, 0, 0);
  7316. end;
  7317. function TabCtrl_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL;
  7318. begin
  7319. Result := BOOL(SendMessage(hwnd, TCM_SETUNICODEFORMAT, WPARAM(fUnicode), 0));
  7320. end;
  7321. function TabCtrl_GetUnicodeFormat(hwnd: HWND): BOOL;
  7322. begin
  7323. Result := BOOL(SendMessage(hwnd, TCM_GETUNICODEFORMAT, 0, 0));
  7324. end;
  7325. function TabCtrl_GetItemRect(hwnd: HWND; i: Integer; var prc: TRect): BOOL;
  7326. begin
  7327. Result := BOOL(SendMessage(hwnd, TCM_GETITEMRECT, i, LPARAM(@prc)));
  7328. end;
  7329. { Animate control }
  7330. function Animate_Create(hwndP: HWND; id: HMENU; dwStyle: DWORD; hInstance: HINST): HWND;
  7331. begin
  7332. Result := CreateWindow(ANIMATE_CLASS, nil, dwStyle, 0, 0, 0, 0, hwndP, id,
  7333. hInstance, nil);
  7334. end;
  7335. function Animate_Open(hwnd: HWND; szName: PChar): BOOL;
  7336. begin
  7337. Result := BOOL(SendMessage(hwnd, ACM_OPENA, 0, LPARAM(szName)));
  7338. end;
  7339. function Animate_OpenEx(hwnd: HWND; hInst: HINST; szName: PChar): BOOL;
  7340. begin
  7341. Result := BOOL(SendMessage(hwnd, ACM_OPENA, WPARAM(hInst), LPARAM(szName)));
  7342. end;
  7343. function Animate_Play(hwnd: HWND; from, _to: Word; rep: UINT): BOOL;
  7344. begin
  7345. Result := BOOL(SendMessage(hwnd, ACM_PLAY, rep, MAKELONG(from, _to)));
  7346. end;
  7347. function Animate_Stop(hwnd: HWND): BOOL;
  7348. begin
  7349. Result := BOOL(SendMessage(hwnd, ACM_STOP, 0, 0));
  7350. end;
  7351. function Animate_Close(hwnd: HWND): BOOL;
  7352. begin
  7353. Result := Animate_Open(hwnd, nil);
  7354. end;
  7355. function Animate_Seek(hwnd: HWND; frame: Word): BOOL;
  7356. begin
  7357. Result := Animate_Play(hwnd, frame, frame, 1);
  7358. end;
  7359. { MonthCal control }
  7360. function MonthCal_GetCurSel(hmc: HWND; var pst: TSystemTime): BOOL;
  7361. begin
  7362. Result := BOOL(SendMessage(hmc, MCM_GETCURSEL, 0, Longint(@pst)));
  7363. end;
  7364. function MonthCal_SetCurSel(hmc: HWND; const pst: TSystemTime): BOOL;
  7365. begin
  7366. Result := BOOL(SendMessage(hmc, MCM_SETCURSEL, 0, Longint(@pst)));
  7367. end;
  7368. function MonthCal_GetMaxSelCount(hmc: HWND): DWORD;
  7369. begin
  7370. Result := SendMessage(hmc, MCM_GETMAXSELCOUNT, 0, 0);
  7371. end;
  7372. function MonthCal_SetMaxSelCount(hmc: HWND; n: UINT): BOOL;
  7373. begin
  7374. Result := BOOL(SendMessage(hmc, MCM_SETMAXSELCOUNT, n, 0));
  7375. end;
  7376. function MonthCal_GetSelRange(hmc: HWND; rgst: PSystemTime): BOOL;
  7377. begin
  7378. Result := BOOL(SendMessage(hmc, MCM_GETSELRANGE, 0, Longint(rgst)));
  7379. end;
  7380. function MonthCal_SetSelRange(hmc: HWND; rgst: PSystemTime): BOOL;
  7381. begin
  7382. Result := BOOL(SendMessage(hmc, MCM_SETSELRANGE, 0, Longint(rgst)));
  7383. end;
  7384. function MonthCal_GetMonthRange(hmc: HWND; gmr: DWORD; rgst: PSystemTime): DWORD;
  7385. begin
  7386. Result := SendMessage(hmc, MCM_GETMONTHRANGE, gmr, Longint(rgst));
  7387. end;
  7388. function MonthCal_SetDayState(hmc: HWND; cbds: Integer; const rgds: TNMDayState): BOOL;
  7389. begin
  7390. Result := BOOL(SendMessage(hmc, MCM_SETDAYSTATE, cbds, Longint(@rgds)));
  7391. end;
  7392. function MonthCal_GetMinReqRect(hmc: HWND; var prc: TRect): BOOL;
  7393. begin
  7394. Result := BOOL(SendMessage(hmc, MCM_GETMINREQRECT, 0, Longint(@prc)));
  7395. end;
  7396. function MonthCal_SetToday(hmc: HWND; const pst: TSystemTime): BOOL;
  7397. begin
  7398. Result := BOOL(SendMessage(hmc, MCM_SETTODAY, 0, Longint(@pst)));
  7399. end;
  7400. function MonthCal_GetToday(hmc: HWND; var pst: TSystemTime): BOOL;
  7401. begin
  7402. Result := BOOL(SendMessage(hmc, MCM_GETTODAY, 0, Longint(@pst)));
  7403. end;
  7404. function MonthCal_HitTest(hmc: HWND; var info: TMCHitTestInfo): DWORD;
  7405. begin
  7406. Result := SendMessage(hmc, MCM_HITTEST, 0, Longint(@info));
  7407. end;
  7408. function MonthCal_SetColor(hmc: HWND; iColor: Integer; clr: TColorRef): TColorRef;
  7409. begin
  7410. Result := TColorRef(SendMessage(hmc, MCM_SETCOLOR, iColor, clr));
  7411. end;
  7412. function MonthCal_GetColor(hmc: HWND; iColor: Integer): TColorRef;
  7413. begin
  7414. Result := TColorRef(SendMessage(hmc, MCM_SETCOLOR, iColor, 0));
  7415. end;
  7416. function MonthCal_SetFirstDayOfWeek(hmc: HWND; iDay: Integer): Integer;
  7417. begin
  7418. Result := SendMessage(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay);
  7419. end;
  7420. function MonthCal_GetFirstDayOfWeek(hmc: HWND): Integer;
  7421. begin
  7422. Result := SendMessage(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0);
  7423. end;
  7424. function MonthCal_GetRange(hmc: HWND; rgst: PSystemTime): DWORD;
  7425. begin
  7426. Result := SendMessage(hmc, MCM_GETRANGE, 0, Longint(rgst));
  7427. end;
  7428. function Monthcal_SetRange(hmc: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL;
  7429. begin
  7430. Result := BOOL(SendMessage(hmc, MCM_SETRANGE, gdtr, Longint(rgst)));
  7431. end;
  7432. function MonthCal_GetMonthDelta(hmc: HWND): Integer;
  7433. begin
  7434. Result := SendMessage(hmc, MCM_GETMONTHDELTA, 0, 0);
  7435. end;
  7436. function MonthCal_SetMonthDelta(hmc: HWND; n: Integer): Integer;
  7437. begin
  7438. Result := SendMessage(hmc, MCM_SETMONTHDELTA, n, 0);
  7439. end;
  7440. function MonthCal_GetMaxTodayWidth(hmc: HWND): DWORD;
  7441. begin
  7442. Result := SendMessage(hmc, MCM_GETMAXTODAYWIDTH, 0, 0);
  7443. end;
  7444. function MonthCal_SetUnicodeFormat(hwnd: HWND; fUnicode: BOOL): BOOL;
  7445. begin
  7446. Result := BOOL(SendMessage(hwnd, MCM_SETUNICODEFORMAT, WPARAM(fUnicode), 0));
  7447. end;
  7448. function MonthCal_GetUnicodeFormat(hwnd: HWND): BOOL;
  7449. begin
  7450. Result := BOOL(SendMessage(hwnd, MCM_GETUNICODEFORMAT, 0, 0));
  7451. end;
  7452. { Date/Time Picker }
  7453. function DateTime_GetSystemTime(hdp: HWND; var pst: TSystemTime): DWORD;
  7454. begin
  7455. Result := SendMessage(hdp, DTM_GETSYSTEMTIME, 0, Longint(@pst));
  7456. end;
  7457. function DateTime_SetSystemTime(hdp: HWND; gd: DWORD; const pst: TSystemTime): BOOL;
  7458. begin
  7459. Result := BOOL(SendMessage(hdp, DTM_SETSYSTEMTIME, gd, Longint(@pst)));
  7460. end;
  7461. function DateTime_GetRange(hdp: HWND; rgst: PSystemTime): DWORD;
  7462. begin
  7463. Result := SendMessage(hdp, DTM_GETRANGE, 0, Longint(rgst));
  7464. end;
  7465. function DateTime_SetRange(hdp: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL;
  7466. begin
  7467. Result := BOOL(SendMessage(hdp, DTM_SETRANGE, gdtr, Longint(rgst)));
  7468. end;
  7469. function DateTime_SetFormat(hdp: HWND; sz: PWideChar): BOOL;
  7470. begin
  7471. Result := BOOL(SendMessage(hdp, DTM_SETFORMAT, 0, Longint(sz)));
  7472. end;
  7473. function DateTime_SetFormatA(hdp: HWND; sz: PAnsiChar): BOOL;
  7474. begin
  7475. Result := BOOL(SendMessageA(hdp, DTM_SETFORMATA, 0, Longint(sz)));
  7476. end;
  7477. function DateTime_SetFormatW(hdp: HWND; sz: PWideChar): BOOL;
  7478. begin
  7479. Result := BOOL(SendMessageW(hdp, DTM_SETFORMATW, 0, Longint(sz)));
  7480. end;
  7481. function DateTime_SetFormat(hdp: HWND; const sz: UnicodeString): BOOL;
  7482. begin
  7483. Result := BOOL(SendMessage(hdp, DTM_SETFORMAT, 0, LPARAM(PWideChar(sz))));
  7484. end;
  7485. function DateTime_SetFormatA(hdp: HWND; const sz: AnsiString): BOOL;
  7486. begin
  7487. Result := BOOL(SendMessageA(hdp, DTM_SETFORMATA, 0, LPARAM(PAnsiChar(sz))));
  7488. end;
  7489. function DateTime_SetFormatW(hdp: HWND; const sz: UnicodeString): BOOL;
  7490. begin
  7491. Result := BOOL(SendMessageW(hdp, DTM_SETFORMATW, 0, LPARAM(PWideChar(sz))));
  7492. end;
  7493. function DateTime_SetMonthCalColor(hdp: HWND; iColor: DWORD; clr: TColorRef): TColorRef;
  7494. begin
  7495. Result := TColorRef(SendMessage(hdp, DTM_SETMCCOLOR, iColor, clr));
  7496. end;
  7497. function DateTime_GetMonthCalColor(hdp: HWND; iColor: DWORD): TColorRef;
  7498. begin
  7499. Result := SendMessage(hdp, DTM_GETMCCOLOR, iColor, 0);
  7500. end;
  7501. function DateTime_GetMonthCal(hdp: HWND): HWND;
  7502. begin
  7503. Result := SendMessage(hdp, DTM_GETMONTHCAL, 0, 0);
  7504. end;
  7505. procedure DateTime_SetMonthCalFont(hdp: HWND; hfont: HFONT; fRedraw: BOOL);
  7506. begin
  7507. SendMessage(hdp, DTM_SETMCFONT, WPARAM(hfont), LPARAM(fRedraw));
  7508. end;
  7509. function DateTime_GetMonthCalFont(hdp: HWND): HFONT;
  7510. begin
  7511. Result := HFONT(SendMessage(hdp, DTM_GETMCFONT, 0, 0));
  7512. end;
  7513. { IP Address edit control }
  7514. function MAKEIPRANGE(low, high: Byte): LPARAM;
  7515. begin
  7516. Result := high;
  7517. Result := (Result shl 8) + low;
  7518. end;
  7519. function MAKEIPADDRESS(b1, b2, b3, b4: DWORD): LPARAM;
  7520. begin
  7521. Result := (b1 shl 24) + (b2 shl 16) + (b3 shl 8) + b4;
  7522. end;
  7523. function FIRST_IPADDRESS(x: DWORD): DWORD;
  7524. begin
  7525. Result := (x shr 24) and $FF;
  7526. end;
  7527. function SECOND_IPADDRESS(x: DWORD): DWORD;
  7528. begin
  7529. Result := (x shr 16) and $FF;
  7530. end;
  7531. function THIRD_IPADDRESS(x: DWORD): DWORD;
  7532. begin
  7533. Result := (x shr 8) and $FF;
  7534. end;
  7535. function FOURTH_IPADDRESS(x: DWORD): DWORD;
  7536. begin
  7537. Result := x and $FF;
  7538. end;
  7539. { Pager control }
  7540. procedure Pager_SetChild(hwnd: HWND; hwndChild: HWND);
  7541. begin
  7542. SendMessage(hwnd, PGM_SETCHILD, 0, LPARAM(hwndChild));
  7543. end;
  7544. procedure Pager_RecalcSize(hwnd: HWND);
  7545. begin
  7546. SendMessage(hwnd, PGM_RECALCSIZE, 0, 0);
  7547. end;
  7548. procedure Pager_ForwardMouse(hwnd: HWND; bForward: BOOL);
  7549. begin
  7550. SendMessage(hwnd, PGM_FORWARDMOUSE, WPARAM(bForward), 0);
  7551. end;
  7552. function Pager_SetBkColor(hwnd: HWND; clr: COLORREF): COLORREF;
  7553. begin
  7554. Result := COLORREF(SendMessage(hwnd, PGM_SETBKCOLOR, 0, LPARAM(clr)));
  7555. end;
  7556. function Pager_GetBkColor(hwnd: HWND): COLORREF;
  7557. begin
  7558. Result := COLORREF(SendMessage(hwnd, PGM_GETBKCOLOR, 0, 0));
  7559. end;
  7560. function Pager_SetBorder(hwnd: HWND; iBorder: Integer): Integer;
  7561. begin
  7562. Result := SendMessage(hwnd, PGM_SETBORDER, 0, iBorder);
  7563. end;
  7564. function Pager_GetBorder(hwnd: HWND): Integer;
  7565. begin
  7566. Result := SendMessage(hwnd, PGM_GETBORDER, 0, 0);
  7567. end;
  7568. function Pager_SetPos(hwnd: HWND; iPos: Integer): Integer;
  7569. begin
  7570. Result := SendMessage(hwnd, PGM_SETPOS, 0, iPos);
  7571. end;
  7572. function Pager_GetPos(hwnd: HWND): Integer;
  7573. begin
  7574. Result := SendMessage(hwnd, PGM_GETPOS, 0, 0);
  7575. end;
  7576. function Pager_SetButtonSize(hwnd: HWND; iSize: Integer): Integer;
  7577. begin
  7578. Result := SendMessage(hwnd, PGM_SETBUTTONSIZE, 0, iSize);
  7579. end;
  7580. function Pager_GetButtonSize(hwnd: HWND): Integer;
  7581. begin
  7582. Result := SendMessage(hwnd, PGM_GETBUTTONSIZE, 0,0);
  7583. end;
  7584. function Pager_GetButtonState(hwnd: HWND; iButton: Integer): DWORD;
  7585. begin
  7586. Result := SendMessage(hwnd, PGM_GETBUTTONSTATE, 0, iButton);
  7587. end;
  7588. procedure Pager_GetDropTarget(hwnd: HWND; ppdt: Pointer{!!});
  7589. begin
  7590. SendMessage(hwnd, PGM_GETDROPTARGET, 0, LPARAM(ppdt));
  7591. end;
  7592. { Button Control Functions }
  7593. function Button_GetIdealSize(hwnd: HWND; var psize: TSize): BOOL;
  7594. begin
  7595. Result := BOOL(SendMessage(hwnd, BCM_GETIDEALSIZE, 0, LPARAM(@psize)));
  7596. end;
  7597. function Button_SetImageList(hwnd: HWND; const pbuttonImagelist: TButtonImagelist): BOOL;
  7598. begin
  7599. Result := BOOL(SendMessage(hwnd, BCM_SETIMAGELIST, 0, LPARAM(@pbuttonImagelist)));
  7600. end;
  7601. function Button_GetImageList(hwnd: HWND; var pbuttonImagelist: TButtonImageList): BOOL;
  7602. begin
  7603. Result := BOOL(SendMessage(hwnd, BCM_GETIMAGELIST, 0, LPARAM(@pbuttonImagelist)));
  7604. end;
  7605. function Button_SetTextMargin(hwnd: HWND; const pmargin: TRect): BOOL;
  7606. begin
  7607. Result := BOOL(SendMessage(hwnd, BCM_SETTEXTMARGIN, 0, LPARAM(@pmargin)));
  7608. end;
  7609. function Button_GetTextMargin(hwnd: HWND; var pmargin: TRect): BOOL;
  7610. begin
  7611. Result := BOOL(SendMessage(hwnd, BCM_GETTEXTMARGIN, 0, LPARAM(@pmargin)));
  7612. end;
  7613. function Button_SetDropDownState(hwnd: HWND; fDropDown: BOOL): BOOL;
  7614. begin
  7615. Result := BOOL(SendMessage(hwnd, BCM_SETDROPDOWNSTATE, WPARAM(fDropDown), 0));
  7616. end;
  7617. function Button_SetSplitInfo(hwnd: HWND; const pInfo: TButtonSplitinfo): BOOL;
  7618. begin
  7619. Result := BOOL(SendMessage(hwnd, BCM_SETSPLITINFO, 0, LPARAM(@pInfo)));
  7620. end;
  7621. function Button_GetSplitInfo(hwnd: HWND; var pInfo: TButtonSplitinfo): BOOL;
  7622. begin
  7623. Result := BOOL(SendMessage(hwnd, BCM_GETSPLITINFO, 0, LPARAM(@pInfo)));
  7624. end;
  7625. function Button_SetNote(hwnd: HWND; psz: LPCWSTR): BOOL;
  7626. begin
  7627. Result := BOOL(SendMessage(hwnd, BCM_SETNOTE, 0, LPARAM(psz)));
  7628. end;
  7629. function Button_SetNote(hwnd: HWND; const psz: UnicodeString): BOOL; overload;
  7630. begin
  7631. Result := BOOL(SendMessage(hwnd, BCM_SETNOTE, 0, LPARAM(PWideChar(psz))));
  7632. end;
  7633. function Button_GetNote(hwnd: HWND; psz: LPCWSTR; var pcc: Integer): BOOL;
  7634. begin
  7635. Result := BOOL(SendMessage(hwnd, BCM_GETNOTE, WPARAM(@pcc), LPARAM(psz)));
  7636. end;
  7637. function Button_GetNoteLength(hwnd: HWND): LRESULT;
  7638. begin
  7639. Result := SendMessage(hwnd, BCM_GETNOTELENGTH, 0, 0);
  7640. end;
  7641. function Button_SetElevationRequiredState(hwnd: HWND; fRequired: BOOL): LRESULT;
  7642. begin
  7643. Result := SendMessage(hwnd, BCM_SETSHIELD, 0, LPARAM(fRequired));
  7644. end;
  7645. { Edit Control Functions }
  7646. function Edit_SetCueBannerText(hwnd: HWND; lpwText: LPCWSTR): BOOL; {inline;}
  7647. begin
  7648. Result := BOOL(SendMessage(hwnd, EM_SETCUEBANNER, 0, lParam(lpwText)));
  7649. end;
  7650. function Edit_GetCueBannerText(hwnd: HWND; lpwText: LPCWSTR; cchText: Longint): BOOL; {inline;}
  7651. begin
  7652. Result := BOOL(SendMessage(hwnd, EM_GETCUEBANNER, wParam(lpwText), lParam(cchText)));
  7653. end;
  7654. function Edit_ShowBalloonTip(hwnd: HWND; const peditballoontip: TEditBalloonTip): BOOL;
  7655. begin
  7656. Result := BOOL(SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, lParam(@peditballoontip)));
  7657. end;
  7658. function Edit_HideBalloonTip(hwnd: HWND): BOOL;
  7659. begin
  7660. Result := BOOL(SendMessage(hwnd, EM_HIDEBALLOONTIP, 0, 0));
  7661. end;
  7662. procedure Edit_SetHilite(hwndCtl: HWND; ichStart, ichEnd: Integer);
  7663. begin
  7664. SendMessage(hwndCtl, EM_SETHILITE, ichStart, ichEnd);
  7665. end;
  7666. function Edit_GetHilite(hwndCtl: HWND): LRESULT;
  7667. begin
  7668. Result := SendMessage(hwndCtl, EM_GETHILITE, 0, 0);
  7669. end;
  7670. { ComboBox Control Functions }
  7671. function ComboBox_SetMinVisible(hwnd: HWND; iMinVisible: Integer): BOOL;
  7672. begin
  7673. Result := BOOL(SendMessage(hwnd, CB_SETMINVISIBLE, WPARAM(iMinVisible), 0));
  7674. end;
  7675. function ComboBox_GetMinVisible(hwnd: HWND): Integer;
  7676. begin
  7677. Result := SendMessage(hwnd, CB_GETMINVISIBLE, 0, 0);
  7678. end;
  7679. function ComboBox_SetCueBannerText(hwnd: HWND; lpcwText: LPCWSTR): BOOL;
  7680. begin
  7681. Result := BOOL(SendMessage(hwnd, CB_SETCUEBANNER, 0, LPARAM(lpcwText)));
  7682. end;
  7683. function ComboBox_GetCueBannerText(hwnd: HWND; lpwText: LPCWSTR; cchText: Integer): BOOL;
  7684. begin
  7685. Result := BOOL(SendMessage(hwnd, CB_GETCUEBANNER, WPARAM(lpwText), LPARAM(@cchText)));
  7686. end;
  7687. { TrackMouseEvent }
  7688. function _TrackMouseEvent; external cctrl name '_TrackMouseEvent';
  7689. { Flat Scrollbar APIs }
  7690. function FlatSB_EnableScrollBar; external cctrl name 'FlatSB_EnableScrollBar';
  7691. function FlatSB_GetScrollInfo; external cctrl name 'FlatSB_GetScrollInfo';
  7692. function FlatSB_GetScrollPos; external cctrl name 'FlatSB_GetScrollPos';
  7693. function FlatSB_GetScrollProp; external cctrl name 'FlatSB_GetScrollProp';
  7694. function FlatSB_GetScrollRange; external cctrl name 'FlatSB_GetScrollRange';
  7695. function FlatSB_SetScrollInfo; external cctrl name 'FlatSB_SetScrollInfo';
  7696. function FlatSB_SetScrollPos; external cctrl name 'FlatSB_SetScrollPos';
  7697. function FlatSB_SetScrollProp; external cctrl name 'FlatSB_SetScrollProp';
  7698. function FlatSB_SetScrollRange; external cctrl name 'FlatSB_SetScrollRange';
  7699. function FlatSB_ShowScrollBar; external cctrl name 'FlatSB_ShowScrollBar';
  7700. function InitializeFlatSB; external cctrl name 'InitializeFlatSB';
  7701. procedure UninitializeFlatSB; external cctrl name 'UninitializeFlatSB';
  7702. { Subclassing }
  7703. var
  7704. _SetWindowSubclass: function(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  7705. uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): BOOL; stdcall;
  7706. _GetWindowSubclass: function(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  7707. uIdSubclass: UINT_PTR; var pdwRefData: DWORD_PTR): BOOL; stdcall;
  7708. _RemoveWindowSubclass: function(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  7709. uIdSubclass: UINT_PTR): BOOL; stdcall;
  7710. _DefSubclassProc: function(hWnd: HWND; uMsg: UINT; wParam: WPARAM;
  7711. lParam: LPARAM): LRESULT; stdcall;
  7712. function SetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  7713. uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): BOOL;
  7714. begin
  7715. if Assigned(_SetWindowSubclass) then
  7716. Result := _SetWindowSubclass(hWnd, pfnSubclass, uIdSubclass, dwRefData)
  7717. else
  7718. begin
  7719. Result := False;
  7720. if ComCtl32DLL > 0 then
  7721. begin
  7722. _SetWindowSubclass := GetProcAddress(ComCtl32DLL, PAnsiChar('SetWindowSubclass')); // Do not localize
  7723. if Assigned(_SetWindowSubclass) then
  7724. Result := _SetWindowSubclass(hWnd, pfnSubclass, uIdSubclass, dwRefData);
  7725. end;
  7726. end;
  7727. end;
  7728. function GetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  7729. uIdSubclass: UINT_PTR; var pdwRefData: DWORD_PTR): BOOL;
  7730. begin
  7731. if Assigned(_GetWindowSubclass) then
  7732. Result := _GetWindowSubclass(hWnd, pfnSubclass, uIdSubclass, pdwRefData)
  7733. else
  7734. begin
  7735. Result := False;
  7736. if ComCtl32DLL > 0 then
  7737. begin
  7738. _GetWindowSubclass := GetProcAddress(ComCtl32DLL, PAnsiChar('GetWindowSubclass')); // Do not localize
  7739. if Assigned(_GetWindowSubclass) then
  7740. Result := _GetWindowSubclass(hWnd, pfnSubclass, uIdSubclass, pdwRefData);
  7741. end;
  7742. end;
  7743. end;
  7744. function RemoveWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC;
  7745. uIdSubclass: UINT_PTR): BOOL;
  7746. begin
  7747. if Assigned(_RemoveWindowSubclass) then
  7748. Result := _RemoveWindowSubclass(hWnd, pfnSubclass, uIdSubclass)
  7749. else
  7750. begin
  7751. Result := False;
  7752. if ComCtl32DLL > 0 then
  7753. begin
  7754. _RemoveWindowSubclass := GetProcAddress(ComCtl32DLL, PAnsiChar('RemoveWindowSubclass')); // Do not localize
  7755. if Assigned(_RemoveWindowSubclass) then
  7756. Result := _RemoveWindowSubclass(hWnd, pfnSubclass, uIdSubclass);
  7757. end;
  7758. end;
  7759. end;
  7760. function DefSubclassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM;
  7761. lParam: LPARAM): LRESULT;
  7762. begin
  7763. if Assigned(_DefSubclassProc) then
  7764. Result := _DefSubclassProc(hWnd, uMsg, wParam, lParam)
  7765. else
  7766. begin
  7767. Result := 0;
  7768. if ComCtl32DLL > 0 then
  7769. begin
  7770. _DefSubclassProc := GetProcAddress(ComCtl32DLL, PAnsiChar('DefSubclassProc')); // Do not localize
  7771. if Assigned(_DefSubclassProc) then
  7772. Result := _DefSubclassProc(hWnd, uMsg, wParam, lParam);
  7773. end;
  7774. end;
  7775. end;
  7776. var
  7777. _LoadIconMetric: function(hinst: HINST; pszName: LPCWSTR; lims: Integer;
  7778. var phico: HICON): HResult; stdcall;
  7779. _LoadIconWithScaleDown: function(hinst: HINST; pszName: LPCWSTR; cx: Integer;
  7780. cy: Integer; var phico: HICON): HResult; stdcall;
  7781. _DrawShadowText: function(hdc: HDC; pszText: LPCWSTR; cch: UINT; const prc: TRect;
  7782. dwFlags: DWORD; crText: COLORREF; crShadow: COLORREF; ixOffset: Integer;
  7783. iyOffset: Integer): Integer; stdcall;
  7784. function LoadIconMetric(hinst: HINST; pszName: LPCWSTR; lims: Integer;
  7785. var phico: HICON): HResult;
  7786. begin
  7787. if Assigned(_LoadIconMetric) then
  7788. Result := _LoadIconMetric(hinst, pszName, lims, phico)
  7789. else
  7790. begin
  7791. Result := E_NOTIMPL;
  7792. if ComCtl32DLL > 0 then
  7793. begin
  7794. _LoadIconMetric := GetProcAddress(ComCtl32DLL, PAnsiChar('LoadIconMetric')); // Do not localize
  7795. if Assigned(_LoadIconMetric) then
  7796. Result := _LoadIconMetric(hinst, pszName, lims, phico);
  7797. end;
  7798. end;
  7799. end;
  7800. function LoadIconWithScaleDown(hinst: HINST; pszName: LPCWSTR; cx: Integer;
  7801. cy: Integer; var phico: HICON): HResult;
  7802. begin
  7803. if Assigned(_LoadIconWithScaleDown) then
  7804. Result := _LoadIconWithScaleDown(hinst, pszName, cx, cy, phico)
  7805. else
  7806. begin
  7807. Result := E_NOTIMPL;
  7808. if ComCtl32DLL > 0 then
  7809. begin
  7810. _LoadIconWithScaleDown := GetProcAddress(ComCtl32DLL, PAnsiChar('LoadIconWithScaleDown')); // Do not localize
  7811. if Assigned(_LoadIconWithScaleDown) then
  7812. Result := _LoadIconWithScaleDown(hinst, pszName, cx, cy, phico);
  7813. end;
  7814. end;
  7815. end;
  7816. function DrawShadowText(hdc: HDC; pszText: LPCWSTR; cch: UINT; const prc: TRect;
  7817. dwFlags: DWORD; crText: COLORREF; crShadow: COLORREF; ixOffset: Integer;
  7818. iyOffset: Integer): Integer;
  7819. begin
  7820. if Assigned(_DrawShadowText) then
  7821. Result := _DrawShadowText(hdc, pszText, cch, prc, dwFlags, crText, crShadow,
  7822. ixOffset, iyOffset)
  7823. else
  7824. begin
  7825. Result := 0;
  7826. if ComCtl32DLL > 0 then
  7827. begin
  7828. _DrawShadowText := GetProcAddress(ComCtl32DLL, PAnsiChar('DrawShadowText')); // Do not localize
  7829. if Assigned(_DrawShadowText) then
  7830. Result := _DrawShadowText(hdc, pszText, cch, prc, dwFlags, crText,
  7831. crShadow, ixOffset, iyOffset);
  7832. end;
  7833. end;
  7834. end;
  7835. var
  7836. _DrawScrollArrow: procedure(hdc: HDC; lprc: PRect; wControlState: UINT;
  7837. rgbOveride: COLORREF); stdcall;
  7838. procedure DrawScrollArrow(hdc: HDC; lprc: PRect; wControlState: UINT;
  7839. rgbOveride: COLORREF);
  7840. begin
  7841. if Assigned(_DrawScrollArrow) then
  7842. _DrawScrollArrow(hdc, lprc, wControlState, rgbOveride)
  7843. else
  7844. begin
  7845. if ComCtl32DLL > 0 then
  7846. begin
  7847. _DrawScrollArrow := GetProcAddress(ComCtl32DLL, PAnsiChar('DrawScrollArrow')); // Do not localize
  7848. if Assigned(_DrawScrollArrow) then
  7849. _DrawScrollArrow(hdc, lprc, wControlState, rgbOveride);
  7850. end;
  7851. end;
  7852. end;
  7853. { Task Dialog }
  7854. var
  7855. _TaskDialogIndirect: function(const pTaskConfig: TTaskDialogConfig;
  7856. pnButton: PInteger; pnRadioButton: PInteger;
  7857. pfVerificationFlagChecked: PBOOL): HRESULT; stdcall;
  7858. _TaskDialog: function(hwndParent: HWND; hInstance: HINST;
  7859. pszWindowTitle: LPCWSTR; pszMainInstruction: LPCWSTR; pszContent: LPCWSTR;
  7860. dwCommonButtons: DWORD; pszIcon: LPCWSTR; pnButton: PInteger): HRESULT; stdcall;
  7861. function TaskDialogIndirect(const pTaskConfig: TTaskDialogConfig;
  7862. pnButton: PInteger; pnRadioButton: PInteger; pfVerificationFlagChecked: PBOOL): HRESULT;
  7863. begin
  7864. if Assigned(_TaskDialogIndirect) then
  7865. Result := _TaskDialogIndirect(pTaskConfig, pnButton, pnRadioButton,
  7866. pfVerificationFlagChecked)
  7867. else
  7868. begin
  7869. InitComCtl;
  7870. Result := E_NOTIMPL;
  7871. if ComCtl32DLL <> 0 then
  7872. begin
  7873. @_TaskDialogIndirect := GetProcAddress(ComCtl32DLL, PAnsiChar('TaskDialogIndirect'));
  7874. if Assigned(_TaskDialogIndirect) then
  7875. Result := _TaskDialogIndirect(pTaskConfig, pnButton, pnRadioButton,
  7876. pfVerificationFlagChecked)
  7877. end;
  7878. end;
  7879. end;
  7880. function TaskDialog(hwndParent: HWND; hInstance: HINST; pszWindowTitle,
  7881. pszMainInstruction, pszContent: LPCWSTR; dwCommonButtons: DWORD;
  7882. pszIcon: LPCWSTR; pnButton: PInteger): HRESULT;
  7883. begin
  7884. if Assigned(_TaskDialog) then
  7885. Result := _TaskDialog(hwndParent, hInstance, pszWindowTitle, pszMainInstruction,
  7886. pszContent, dwCommonButtons, pszIcon, pnButton)
  7887. else
  7888. begin
  7889. InitComCtl;
  7890. Result := E_NOTIMPL;
  7891. if ComCtl32DLL <> 0 then
  7892. begin
  7893. @_TaskDialog := GetProcAddress(ComCtl32DLL, PAnsiChar('TaskDialog'));
  7894. if Assigned(_TaskDialog) then
  7895. Result := _TaskDialog(hwndParent, hInstance, pszWindowTitle, pszMainInstruction,
  7896. pszContent, dwCommonButtons, pszIcon, pnButton);
  7897. end;
  7898. end;
  7899. end;
  7900. end.