home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / geninc32.pak / COMMCTRL.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  80KB  |  2,647 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * commctrl.h - - Interface for the Windows Common Controls                    *
  4. *                                                                             *
  5. * Version 1.0                                                                 *
  6. *                                                                             *
  7. * Copyright (c) 1991-1995, Microsoft Corp.      All rights reserved.          *
  8. *                                                                             *
  9. \*****************************************************************************/
  10.  
  11. #ifndef _INC_COMMCTRL
  12. #define _INC_COMMCTRL
  13.  
  14. #ifndef NOUSER
  15.  
  16.  
  17. //
  18. // Define API decoration for direct importing of DLL references.
  19. //
  20. #ifndef WINCOMMCTRLAPI
  21. #if !defined(_COMCTL32_) && defined(_WIN32)
  22. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  23. #else
  24. #define WINCOMMCTRLAPI
  25. #endif
  26. #endif // WINCOMMCTRLAPI
  27.  
  28. //
  29. // For compilers that don't support nameless unions
  30. //
  31. #ifndef DUMMYUNIONNAME
  32. #ifdef NONAMELESSUNION
  33. #define DUMMYUNIONNAME   u
  34. #define DUMMYUNIONNAME2  u2
  35. #define DUMMYUNIONNAME3  u3
  36. #else
  37. #define DUMMYUNIONNAME
  38. #define DUMMYUNIONNAME2
  39. #define DUMMYUNIONNAME3
  40. #endif
  41. #endif // DUMMYUNIONNAME
  42.  
  43. #ifdef _WIN32
  44. #include <pshpack1.h>
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if (WINVER >= 0x0400)
  52.  
  53. //
  54. // Users of this header may define any number of these constants to avoid
  55. // the definitions of each functional group.
  56. //
  57. //    NOTOOLBAR    Customizable bitmap-button toolbar control.
  58. //    NOUPDOWN     Up and Down arrow increment/decrement control.
  59. //    NOSTATUSBAR  Status bar control.
  60. //    NOMENUHELP   APIs to help manage menus, especially with a status bar.
  61. //    NOTRACKBAR   Customizable column-width tracking control.
  62. //    NODRAGLIST   APIs to make a listbox source and sink drag&drop actions.
  63. //    NOPROGRESS   Progress gas gauge.
  64. //    NOHOTKEY     HotKey control
  65. //    NOHEADER     Header bar control.
  66. //    NOIMAGEAPIS  ImageList apis.
  67. //    NOLISTVIEW   ListView control.
  68. //    NOTREEVIEW   TreeView control.
  69. //    NOTABCONTROL Tab control.
  70. //    NOANIMATE    Animate control.
  71. //
  72. //=============================================================================
  73.  
  74. #include <prsht.h>
  75.  
  76.  
  77. WINCOMMCTRLAPI void WINAPI InitCommonControls();
  78.  
  79. #define ODT_HEADER              100
  80. #define ODT_TAB                 101
  81. #define ODT_LISTVIEW            102
  82.  
  83.  
  84. //====== Ranges for control message IDs =======================================
  85.  
  86. #define LVM_FIRST               0x1000      // ListView messages
  87. #define TV_FIRST                0x1100      // TreeView messages
  88. #define HDM_FIRST               0x1200      // Header messages
  89.  
  90. //====== WM_NOTIFY Macros =====================================================
  91.  
  92. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  93.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  94. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
  95.     (LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR FAR*)(pnmhdr))
  96.  
  97.  
  98. //====== Generic WM_NOTIFY notification codes =================================
  99.  
  100. #define NM_OUTOFMEMORY          (NM_FIRST-1)
  101. #define NM_CLICK                (NM_FIRST-2)
  102. #define NM_DBLCLK               (NM_FIRST-3)
  103. #define NM_RETURN               (NM_FIRST-4)
  104. #define NM_RCLICK               (NM_FIRST-5)
  105. #define NM_RDBLCLK              (NM_FIRST-6)
  106. #define NM_SETFOCUS             (NM_FIRST-7)
  107. #define NM_KILLFOCUS            (NM_FIRST-8)
  108.  
  109.  
  110. //====== WM_NOTIFY codes (NMHDR.code values) ==================================
  111.  
  112. #define NM_FIRST                (0U-  0U)       // generic to all controls
  113. #define NM_LAST                 (0U- 99U)
  114.  
  115. #define LVN_FIRST               (0U-100U)       // listview
  116. #define LVN_LAST                (0U-199U)
  117.  
  118. #define HDN_FIRST               (0U-300U)       // header
  119. #define HDN_LAST                (0U-399U)
  120.  
  121. #define TVN_FIRST               (0U-400U)       // treeview
  122. #define TVN_LAST                (0U-499U)
  123.  
  124. #define TTN_FIRST               (0U-520U)       // tooltips
  125. #define TTN_LAST                (0U-549U)
  126.  
  127. #define TCN_FIRST               (0U-550U)       // tab control
  128. #define TCN_LAST                (0U-580U)
  129.  
  130. // Shell reserved               (0U-580U) -  (0U-589U)
  131.  
  132. #define CDN_FIRST               (0U-601U)       // common dialog (new)
  133. #define CDN_LAST                (0U-699U)
  134.  
  135. #define TBN_FIRST               (0U-700U)       // toolbar
  136. #define TBN_LAST                (0U-720U)
  137.  
  138. #define UDN_FIRST               (0U-721)        // updown
  139. #define UDN_LAST                (0U-740)
  140.  
  141. #define MSGF_COMMCTRL_BEGINDRAG     0x4200
  142. #define MSGF_COMMCTRL_SIZEHEADER    0x4201
  143. #define MSGF_COMMCTRL_DRAGSELECT    0x4202
  144. #define MSGF_COMMCTRL_TOOLBARCUST   0x4203
  145.  
  146.  
  147. //====== IMAGE APIS ===========================================================
  148.  
  149. #ifndef NOIMAGEAPIS
  150.  
  151. #define CLR_NONE                0xFFFFFFFFL
  152. #define CLR_DEFAULT             0xFF000000L
  153.  
  154. struct _IMAGELIST;
  155. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  156.  
  157. #define ILC_MASK                0x0001
  158. #define ILC_COLOR               0x0000
  159. #define ILC_COLORDDB            0x00FE
  160. #define ILC_COLOR4              0x0004
  161. #define ILC_COLOR8              0x0008
  162. #define ILC_COLOR16             0x0010
  163. #define ILC_COLOR24             0x0018
  164. #define ILC_COLOR32             0x0020
  165. #define ILC_PALETTE             0x0800
  166.  
  167. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
  168. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Destroy(HIMAGELIST himl);
  169. WINCOMMCTRLAPI int         WINAPI ImageList_GetImageCount(HIMAGELIST himl);
  170. WINCOMMCTRLAPI int         WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  171. WINCOMMCTRLAPI int         WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  172. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  173. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_GetBkColor(HIMAGELIST himl);
  174. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  175.  
  176. #define     ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon)
  177.  
  178. #define ILD_NORMAL              0x0000
  179. #define ILD_TRANSPARENT         0x0001
  180. #define ILD_MASK                0x0010
  181. #define ILD_IMAGE               0x0020
  182. #define ILD_BLEND25             0x0002
  183. #define ILD_BLEND50             0x0004
  184. #define ILD_OVERLAYMASK         0x0F00
  185. #define INDEXTOOVERLAYMASK(i)   ((i) << 8)
  186.  
  187. #define ILD_SELECTED            ILD_BLEND50
  188. #define ILD_FOCUS               ILD_BLEND25
  189. #define ILD_BLEND               ILD_BLEND50
  190. #define CLR_HILIGHT             CLR_DEFAULT
  191.  
  192. WINCOMMCTRLAPI BOOL WINAPI ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle);
  193.  
  194.  
  195. #ifdef _WIN32
  196.  
  197. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask);
  198. WINCOMMCTRLAPI int         WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask);
  199. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle);
  200. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Remove(HIMAGELIST himl, int i);
  201. WINCOMMCTRLAPI HICON       WINAPI ImageList_GetIcon(HIMAGELIST himl, int i, UINT flags);
  202. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageA(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  203. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  204.  
  205. #ifdef UNICODE
  206. #define ImageList_LoadImage     ImageList_LoadImageW
  207. #else
  208. #define ImageList_LoadImage     ImageList_LoadImageA
  209. #endif
  210.  
  211. WINCOMMCTRLAPI BOOL        WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot);
  212. WINCOMMCTRLAPI void        WINAPI ImageList_EndDrag();
  213. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragEnter(HWND hwndLock, int x, int y);
  214. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragLeave(HWND hwndLock);
  215. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragMove(int x, int y);
  216. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot);
  217.  
  218. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragShowNolock(BOOL fShow);
  219. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_GetDragImage(POINT FAR* ppt,POINT FAR* pptHotspot);
  220.  
  221. #define     ImageList_RemoveAll(himl) ImageList_Remove(himl, -1)
  222. #define     ImageList_ExtractIcon(hi, himl, i) ImageList_GetIcon(himl, i, 0)
  223. #define     ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask) ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)
  224.  
  225. #ifdef __IStream_INTERFACE_DEFINED__
  226. WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm);
  227. WINCOMMCTRLAPI BOOL       WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
  228. #endif
  229.  
  230. typedef struct _IMAGEINFO
  231. {
  232.     HBITMAP hbmImage;
  233.     HBITMAP hbmMask;
  234.     int     Unused1;
  235.     int     Unused2;
  236.     RECT    rcImage;
  237. } IMAGEINFO;
  238.  
  239. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetIconSize(HIMAGELIST himl, int FAR *cx, int FAR *cy);
  240. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetIconSize(HIMAGELIST himl, int cx, int cy);
  241. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO FAR* pImageInfo);
  242. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
  243.  
  244. #endif
  245.  
  246. #endif
  247.  
  248.  
  249. //====== HEADER CONTROL =======================================================
  250.  
  251. #ifndef NOHEADER
  252.  
  253. #ifdef _WIN32
  254. #define WC_HEADERA              "SysHeader32"
  255. #define WC_HEADERW              L"SysHeader32"
  256.  
  257. #ifdef UNICODE
  258. #define WC_HEADER               WC_HEADERW
  259. #else
  260. #define WC_HEADER               WC_HEADERA
  261. #endif
  262.  
  263. #else
  264. #define WC_HEADER               "SysHeader"
  265. #endif
  266.  
  267. #define HDS_HORZ                0x00000000
  268. #define HDS_BUTTONS             0x00000002
  269. #define HDS_HIDDEN              0x00000008
  270.  
  271. typedef struct _HD_ITEMA
  272. {
  273.     UINT    mask;
  274.     int     cxy;
  275.     LPSTR   pszText;
  276.     HBITMAP hbm;
  277.     int     cchTextMax;
  278.     int     fmt;
  279.     LPARAM  lParam;
  280. } HD_ITEMA;
  281.  
  282. typedef struct _HD_ITEMW
  283. {
  284.     UINT    mask;
  285.     int     cxy;
  286.     LPWSTR   pszText;
  287.     HBITMAP hbm;
  288.     int     cchTextMax;
  289.     int     fmt;
  290.     LPARAM  lParam;
  291. } HD_ITEMW;
  292.  
  293. #ifdef UNICODE
  294. #define HD_ITEM HD_ITEMW
  295. #else
  296. #define HD_ITEM HD_ITEMA
  297. #endif
  298.  
  299.  
  300. #define HDI_WIDTH               0x0001
  301. #define HDI_HEIGHT              HDI_WIDTH
  302. #define HDI_TEXT                0x0002
  303. #define HDI_FORMAT              0x0004
  304. #define HDI_LPARAM              0x0008
  305. #define HDI_BITMAP              0x0010
  306.  
  307. #define HDF_LEFT                0
  308. #define HDF_RIGHT               1
  309. #define HDF_CENTER              2
  310. #define HDF_JUSTIFYMASK         0x0003
  311. #define HDF_RTLREADING          4
  312.  
  313. #define HDF_OWNERDRAW           0x8000
  314. #define HDF_STRING              0x4000
  315. #define HDF_BITMAP              0x2000
  316.  
  317.  
  318. #define HDM_GETITEMCOUNT        (HDM_FIRST + 0)
  319. #define Header_GetItemCount(hwndHD) \
  320.     (int)SendMessage((hwndHD), HDM_GETITEMCOUNT, 0, 0L)
  321.  
  322.  
  323. #define HDM_INSERTITEMA         (HDM_FIRST + 1)
  324. #define HDM_INSERTITEMW         (HDM_FIRST + 10)
  325.  
  326. #ifdef UNICODE
  327. #define HDM_INSERTITEM          HDM_INSERTITEMW
  328. #else
  329. #define HDM_INSERTITEM          HDM_INSERTITEMA
  330. #endif
  331.  
  332. #define Header_InsertItem(hwndHD, i, phdi) \
  333.     (int)SendMessage((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  334.  
  335.  
  336. #define HDM_DELETEITEM          (HDM_FIRST + 2)
  337. #define Header_DeleteItem(hwndHD, i) \
  338.     (BOOL)SendMessage((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(i), 0L)
  339.  
  340.  
  341. #define HDM_GETITEMA            (HDM_FIRST + 3)
  342. #define HDM_GETITEMW            (HDM_FIRST + 11)
  343.  
  344. #ifdef UNICODE
  345. #define HDM_GETITEM             HDM_GETITEMW
  346. #else
  347. #define HDM_GETITEM             HDM_GETITEMA
  348. #endif
  349.  
  350. #define Header_GetItem(hwndHD, i, phdi) \
  351.     (BOOL)SendMessage((hwndHD), HDM_GETITEM, (WPARAM)(int)(i), (LPARAM)(HD_ITEM FAR*)(phdi))
  352.  
  353.  
  354. #define HDM_SETITEMA            (HDM_FIRST + 4)
  355. #define HDM_SETITEMW            (HDM_FIRST + 12)
  356.  
  357. #ifdef UNICODE
  358. #define HDM_SETITEM             HDM_SETITEMW
  359. #else
  360. #define HDM_SETITEM             HDM_SETITEMA
  361. #endif
  362.  
  363. #define Header_SetItem(hwndHD, i, phdi) \
  364.     (BOOL)SendMessage((hwndHD), HDM_SETITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  365.  
  366.  
  367. typedef struct _HD_LAYOUT
  368. {
  369.     RECT FAR* prc;
  370.     WINDOWPOS FAR* pwpos;
  371. } HD_LAYOUT;
  372.  
  373.  
  374. #define HDM_LAYOUT              (HDM_FIRST + 5)
  375. #define Header_Layout(hwndHD, playout) \
  376.     (BOOL)SendMessage((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout))
  377.  
  378.  
  379. #define HHT_NOWHERE             0x0001
  380. #define HHT_ONHEADER            0x0002
  381. #define HHT_ONDIVIDER           0x0004
  382. #define HHT_ONDIVOPEN           0x0008
  383. #define HHT_ABOVE               0x0100
  384. #define HHT_BELOW               0x0200
  385. #define HHT_TORIGHT             0x0400
  386. #define HHT_TOLEFT              0x0800
  387.  
  388. typedef struct _HD_HITTESTINFO
  389. {
  390.     POINT pt;
  391.     UINT flags;
  392.     int iItem;
  393. } HD_HITTESTINFO;
  394. #define HDM_HITTEST             (HDM_FIRST + 6)
  395.  
  396.  
  397. #define HDN_ITEMCHANGINGA       (HDN_FIRST-0)
  398. #define HDN_ITEMCHANGINGW       (HDN_FIRST-20)
  399. #define HDN_ITEMCHANGEDA        (HDN_FIRST-1)
  400. #define HDN_ITEMCHANGEDW        (HDN_FIRST-21)
  401. #define HDN_ITEMCLICKA          (HDN_FIRST-2)
  402. #define HDN_ITEMCLICKW          (HDN_FIRST-22)
  403. #define HDN_ITEMDBLCLICKA       (HDN_FIRST-3)
  404. #define HDN_ITEMDBLCLICKW       (HDN_FIRST-23)
  405. #define HDN_DIVIDERDBLCLICKA    (HDN_FIRST-5)
  406. #define HDN_DIVIDERDBLCLICKW    (HDN_FIRST-25)
  407. #define HDN_BEGINTRACKA         (HDN_FIRST-6)
  408. #define HDN_BEGINTRACKW         (HDN_FIRST-26)
  409. #define HDN_ENDTRACKA           (HDN_FIRST-7)
  410. #define HDN_ENDTRACKW           (HDN_FIRST-27)
  411. #define HDN_TRACKA              (HDN_FIRST-8)
  412. #define HDN_TRACKW              (HDN_FIRST-28)
  413.  
  414. #ifdef UNICODE
  415. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGW
  416. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDW
  417. #define HDN_ITEMCLICK            HDN_ITEMCLICKW
  418. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKW
  419. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKW
  420. #define HDN_BEGINTRACK           HDN_BEGINTRACKW
  421. #define HDN_ENDTRACK             HDN_ENDTRACKW
  422. #define HDN_TRACK                HDN_TRACKW
  423. #else
  424. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGA
  425. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDA
  426. #define HDN_ITEMCLICK            HDN_ITEMCLICKA
  427. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKA
  428. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKA
  429. #define HDN_BEGINTRACK           HDN_BEGINTRACKA
  430. #define HDN_ENDTRACK             HDN_ENDTRACKA
  431. #define HDN_TRACK                HDN_TRACKA
  432. #endif
  433.  
  434.  
  435. typedef struct _HD_NOTIFY
  436. {
  437.     NMHDR   hdr;
  438.     int     iItem;
  439.     int     iButton;
  440.     HD_ITEMA FAR* pitem;
  441. } HD_NOTIFYA;
  442.  
  443. typedef struct _HD_NOTIFYW
  444. {
  445.     NMHDR   hdr;
  446.     int     iItem;
  447.     int     iButton;
  448.     HD_ITEMW FAR* pitem;
  449. } HD_NOTIFYW;
  450.  
  451. #ifdef UNICODE
  452. #define  HD_NOTIFY              HD_NOTIFYW
  453. #else
  454. #define  HD_NOTIFY              HD_NOTIFYA
  455. #endif
  456.  
  457. #endif
  458.  
  459.  
  460. //====== TOOLBAR CONTROL ======================================================
  461.  
  462. #ifndef NOTOOLBAR
  463.  
  464. #ifdef _WIN32
  465. #define TOOLBARCLASSNAMEW       L"ToolbarWindow32"
  466. #define TOOLBARCLASSNAMEA       "ToolbarWindow32"
  467.  
  468. #ifdef  UNICODE
  469. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEW
  470. #else
  471. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEA
  472. #endif
  473.  
  474. #else
  475. #define TOOLBARCLASSNAME        "ToolbarWindow"
  476. #endif
  477.  
  478. typedef struct _TBBUTTON {
  479.     int iBitmap;
  480.     int idCommand;
  481.     BYTE fsState;
  482.     BYTE fsStyle;
  483. #ifdef _WIN32
  484.     BYTE bReserved[2];
  485. #endif
  486.     DWORD dwData;
  487.     int iString;
  488. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  489. typedef const TBBUTTON FAR* LPCTBBUTTON;
  490.  
  491. typedef struct _COLORMAP {
  492.     COLORREF from;
  493.     COLORREF to;
  494. } COLORMAP, FAR* LPCOLORMAP;
  495.  
  496. WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  497.                         HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  498.                         int iNumButtons, int dxButton, int dyButton,
  499.                         int dxBitmap, int dyBitmap, UINT uStructSize);
  500.  
  501. WINCOMMCTRLAPI HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, int idBitmap,
  502.                                   UINT wFlags, LPCOLORMAP lpColorMap,
  503.                                   int iNumMaps);
  504.  
  505. #define CMB_MASKED              0x02
  506.  
  507. #define TBSTATE_CHECKED         0x01
  508. #define TBSTATE_PRESSED         0x02
  509. #define TBSTATE_ENABLED         0x04
  510. #define TBSTATE_HIDDEN          0x08
  511. #define TBSTATE_INDETERMINATE   0x10
  512. #define TBSTATE_WRAP            0x20
  513.  
  514. #define TBSTYLE_BUTTON          0x00
  515. #define TBSTYLE_SEP             0x01
  516. #define TBSTYLE_CHECK           0x02
  517. #define TBSTYLE_GROUP           0x04
  518. #define TBSTYLE_CHECKGROUP      (TBSTYLE_GROUP | TBSTYLE_CHECK)
  519.  
  520. #define TBSTYLE_TOOLTIPS        0x0100
  521. #define TBSTYLE_WRAPABLE        0x0200
  522. #define TBSTYLE_ALTDRAG         0x0400
  523.  
  524. #define TB_ENABLEBUTTON         (WM_USER + 1)
  525. #define TB_CHECKBUTTON          (WM_USER + 2)
  526. #define TB_PRESSBUTTON          (WM_USER + 3)
  527. #define TB_HIDEBUTTON           (WM_USER + 4)
  528. #define TB_INDETERMINATE        (WM_USER + 5)
  529. #define TB_ISBUTTONENABLED      (WM_USER + 9)
  530. #define TB_ISBUTTONCHECKED      (WM_USER + 10)
  531. #define TB_ISBUTTONPRESSED      (WM_USER + 11)
  532. #define TB_ISBUTTONHIDDEN       (WM_USER + 12)
  533. #define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
  534. #define TB_SETSTATE             (WM_USER + 17)
  535. #define TB_GETSTATE             (WM_USER + 18)
  536. #define TB_ADDBITMAP            (WM_USER + 19)
  537.  
  538. #ifdef _WIN32
  539. typedef struct tagTBADDBITMAP {
  540.         HINSTANCE       hInst;
  541.         UINT            nID;
  542. } TBADDBITMAP, *LPTBADDBITMAP;
  543.  
  544. #define HINST_COMMCTRL          ((HINSTANCE)-1)
  545. #define IDB_STD_SMALL_COLOR     0
  546. #define IDB_STD_LARGE_COLOR     1
  547. #define IDB_VIEW_SMALL_COLOR    4
  548. #define IDB_VIEW_LARGE_COLOR    5
  549.  
  550. // icon indexes for standard bitmap
  551.  
  552. #define STD_CUT                 0
  553. #define STD_COPY                1
  554. #define STD_PASTE               2
  555. #define STD_UNDO                3
  556. #define STD_REDOW               4
  557. #define STD_DELETE              5
  558. #define STD_FILENEW             6
  559. #define STD_FILEOPEN            7
  560. #define STD_FILESAVE            8
  561. #define STD_PRINTPRE            9
  562. #define STD_PROPERTIES          10
  563. #define STD_HELP                11
  564. #define STD_FIND                12
  565. #define STD_REPLACE             13
  566. #define STD_PRINT               14
  567.  
  568. // icon indexes for standard view bitmap
  569.  
  570. #define VIEW_LARGEICONS         0
  571. #define VIEW_SMALLICONS         1
  572. #define VIEW_LIST               2
  573. #define VIEW_DETAILS            3
  574. #define VIEW_SORTNAME           4
  575. #define VIEW_SORTSIZE           5
  576. #define VIEW_SORTDATE           6
  577. #define VIEW_SORTTYPE           7
  578. #define VIEW_PARENTFOLDER       8
  579. #define VIEW_NETCONNECT         9
  580. #define VIEW_NETDISCONNECT      10
  581. #define VIEW_NEWFOLDER          11
  582.  
  583.  
  584. #endif
  585.  
  586. #define TB_ADDBUTTONS           (WM_USER + 20)
  587. #define TB_INSERTBUTTON         (WM_USER + 21)
  588. #define TB_DELETEBUTTON         (WM_USER + 22)
  589. #define TB_GETBUTTON            (WM_USER + 23)
  590. #define TB_BUTTONCOUNT          (WM_USER + 24)
  591. #define TB_COMMANDTOINDEX       (WM_USER + 25)
  592.  
  593. #ifdef _WIN32
  594.  
  595. typedef struct tagTBSAVEPARAMSA {
  596.     HKEY hkr;
  597.     LPCSTR pszSubKey;
  598.     LPCSTR pszValueName;
  599. } TBSAVEPARAMSA;
  600.  
  601. typedef struct tagTBSAVEPARAMSW {
  602.     HKEY hkr;
  603.     LPCWSTR pszSubKey;
  604.     LPCWSTR pszValueName;
  605. } TBSAVEPARAMSW;
  606.  
  607. #ifdef UNICODE
  608. #define TBSAVEPARAMS            TBSAVEPARAMSW
  609. #else
  610. #define TBSAVEPARAMS            TBSAVEPARAMSA
  611. #endif
  612.  
  613. #endif
  614.  
  615. #define TB_SAVERESTOREA         (WM_USER + 26)
  616. #define TB_SAVERESTOREW         (WM_USER + 76)
  617. #define TB_CUSTOMIZE            (WM_USER + 27)
  618. #define TB_ADDSTRINGA           (WM_USER + 28)
  619. #define TB_ADDSTRINGW           (WM_USER + 77)
  620. #define TB_GETITEMRECT          (WM_USER + 29)
  621. #define TB_BUTTONSTRUCTSIZE     (WM_USER + 30)
  622. #define TB_SETBUTTONSIZE        (WM_USER + 31)
  623. #define TB_SETBITMAPSIZE        (WM_USER + 32)
  624. #define TB_AUTOSIZE             (WM_USER + 33)
  625. #define TB_GETTOOLTIPS          (WM_USER + 35)
  626. #define TB_SETTOOLTIPS          (WM_USER + 36)
  627. #define TB_SETPARENT            (WM_USER + 37)
  628. #define TB_SETROWS              (WM_USER + 39)
  629. #define TB_GETROWS              (WM_USER + 40)
  630. #define TB_SETCMDID             (WM_USER + 42)
  631. #define TB_CHANGEBITMAP         (WM_USER + 43)
  632. #define TB_GETBITMAP            (WM_USER + 44)
  633. #define TB_GETBUTTONTEXTA       (WM_USER + 45)
  634. #define TB_GETBUTTONTEXTW       (WM_USER + 75)
  635. #define TB_REPLACEBITMAP        (WM_USER + 46)
  636.  
  637.  
  638. #ifdef UNICODE
  639. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTW
  640. #define TB_SAVERESTORE          TB_SAVERESTOREW
  641. #define TB_ADDSTRING            TB_ADDSTRINGW
  642. #else
  643. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTA
  644. #define TB_SAVERESTORE          TB_SAVERESTOREA
  645. #define TB_ADDSTRING            TB_ADDSTRINGA
  646. #endif
  647.  
  648. typedef struct {
  649.         HINSTANCE       hInstOld;
  650.         UINT            nIDOld;
  651.         HINSTANCE       hInstNew;
  652.         UINT            nIDNew;
  653.         int             nButtons;
  654. } TBREPLACEBITMAP, *LPTBREPLACEBITMAP;
  655.  
  656. #ifdef _WIN32
  657.  
  658. #define TBBF_LARGE              0x0001
  659.  
  660. #define TB_GETBITMAPFLAGS       (WM_USER + 41)
  661.  
  662. #define TBN_GETBUTTONINFOA      (TBN_FIRST-0)
  663. #define TBN_GETBUTTONINFOW      (TBN_FIRST-20)
  664. #define TBN_BEGINDRAG           (TBN_FIRST-1)
  665. #define TBN_ENDDRAG             (TBN_FIRST-2)
  666. #define TBN_BEGINADJUST         (TBN_FIRST-3)
  667. #define TBN_ENDADJUST           (TBN_FIRST-4)
  668. #define TBN_RESET               (TBN_FIRST-5)
  669. #define TBN_QUERYINSERT         (TBN_FIRST-6)
  670. #define TBN_QUERYDELETE         (TBN_FIRST-7)
  671. #define TBN_TOOLBARCHANGE       (TBN_FIRST-8)
  672. #define TBN_CUSTHELP            (TBN_FIRST-9)
  673.  
  674. #ifdef UNICODE
  675. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOW
  676. #else
  677. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOA
  678. #endif
  679.  
  680. typedef struct tagTBNOTIFYA {
  681.     NMHDR   hdr;
  682.     int     iItem;
  683.     TBBUTTON tbButton;
  684.     int     cchText;
  685.     LPSTR   pszText;
  686. } TBNOTIFYA, FAR *LPTBNOTIFYA;
  687.  
  688. typedef struct tagTBNOTIFYW {
  689.     NMHDR   hdr;
  690.     int     iItem;
  691.     TBBUTTON tbButton;
  692.     int     cchText;
  693.     LPWSTR   pszText;
  694. } TBNOTIFYW, FAR *LPTBNOTIFYW;
  695.  
  696. #ifdef UNICODE
  697. #define TBNOTIFY                TBNOTIFYW
  698. #define LPTBNOTIFY              LPTBNOTIFYW
  699. #else
  700. #define TBNOTIFY                TBNOTIFYA
  701. #define LPTBNOTIFY              LPTBNOTIFYA
  702. #endif
  703.  
  704. #endif
  705.  
  706. #endif
  707.  
  708.  
  709. //====== TOOLTIPS CONTROL =====================================================
  710.  
  711. #ifndef NOTOOLTIPS
  712.  
  713. #ifdef _WIN32
  714.  
  715. #define TOOLTIPS_CLASSW         L"tooltips_class32"
  716. #define TOOLTIPS_CLASSA         "tooltips_class32"
  717.  
  718. #ifdef UNICODE
  719. #define TOOLTIPS_CLASS          TOOLTIPS_CLASSW
  720. #else
  721. #define TOOLTIPS_CLASS          TOOLTIPS_CLASSA
  722. #endif
  723.  
  724. #else
  725. #define TOOLTIPS_CLASS          "tooltips_class"
  726. #endif
  727.  
  728. typedef struct tagTOOLINFOA {
  729.     UINT cbSize;
  730.     UINT uFlags;
  731.     HWND hwnd;
  732.     UINT uId;
  733.     RECT rect;
  734.     HINSTANCE hinst;
  735.     LPSTR lpszText;
  736. } TOOLINFOA, NEAR *PTOOLINFOA, FAR *LPTOOLINFOA;
  737.  
  738. typedef struct tagTOOLINFOW {
  739.     UINT cbSize;
  740.     UINT uFlags;
  741.     HWND hwnd;
  742.     UINT uId;
  743.     RECT rect;
  744.     HINSTANCE hinst;
  745.     LPWSTR lpszText;
  746. } TOOLINFOW, NEAR *PTOOLINFOW, FAR *LPTOOLINFOW;
  747.  
  748. #ifdef UNICODE
  749. #define TOOLINFO                TOOLINFOW
  750. #define PTOOLINFO               PTOOLINFOW
  751. #define LPTOOLINFO              LPTOOLINFOW
  752. #else
  753. #define TOOLINFO                TOOLINFOA
  754. #define PTOOLINFO               PTOOLINFOA
  755. #define LPTOOLINFO              LPTOOLINFOA
  756. #endif
  757.  
  758.  
  759. #define TTS_ALWAYSTIP           0x01
  760. #define TTS_NOPREFIX            0x02
  761.  
  762. #define TTF_IDISHWND            0x01
  763. #define TTF_CENTERTIP           0x02
  764. #define TTF_RTLREADING          0x04
  765. #define TTF_SUBCLASS            0x10
  766.  
  767. #define TTDT_AUTOMATIC          0
  768. #define TTDT_RESHOW             1
  769. #define TTDT_AUTOPOP            2
  770. #define TTDT_INITIAL            3
  771.  
  772. #define TTM_ACTIVATE            (WM_USER + 1)
  773. #define TTM_SETDELAYTIME        (WM_USER + 3)
  774. #define TTM_ADDTOOLA            (WM_USER + 4)
  775. #define TTM_ADDTOOLW            (WM_USER + 50)
  776. #define TTM_DELTOOLA            (WM_USER + 5)
  777. #define TTM_DELTOOLW            (WM_USER + 51)
  778. #define TTM_NEWTOOLRECTA        (WM_USER + 6)
  779. #define TTM_NEWTOOLRECTW        (WM_USER + 52)
  780. #define TTM_RELAYEVENT          (WM_USER + 7)
  781.  
  782. #define TTM_GETTOOLINFOA        (WM_USER + 8)
  783. #define TTM_GETTOOLINFOW        (WM_USER + 53)
  784.  
  785. #define TTM_SETTOOLINFOA        (WM_USER + 9)
  786. #define TTM_SETTOOLINFOW        (WM_USER + 54)
  787.  
  788. #define TTM_HITTESTA            (WM_USER +10)
  789. #define TTM_HITTESTW            (WM_USER +55)
  790. #define TTM_GETTEXTA            (WM_USER +11)
  791. #define TTM_GETTEXTW            (WM_USER +56)
  792. #define TTM_UPDATETIPTEXTA      (WM_USER +12)
  793. #define TTM_UPDATETIPTEXTW      (WM_USER +57)
  794. #define TTM_GETTOOLCOUNT        (WM_USER +13)
  795. #define TTM_ENUMTOOLSA          (WM_USER +14)
  796. #define TTM_ENUMTOOLSW          (WM_USER +58)
  797. #define TTM_GETCURRENTTOOLA     (WM_USER + 15)
  798. #define TTM_GETCURRENTTOOLW     (WM_USER + 59)
  799. #define TTM_WINDOWFROMPOINT     (WM_USER + 16)
  800.  
  801. #ifdef UNICODE
  802. #define TTM_ADDTOOL             TTM_ADDTOOLW
  803. #define TTM_DELTOOL             TTM_DELTOOLW
  804. #define TTM_NEWTOOLRECT         TTM_NEWTOOLRECTW
  805. #define TTM_GETTOOLINFO         TTM_GETTOOLINFOW
  806. #define TTM_SETTOOLINFO         TTM_SETTOOLINFOW
  807. #define TTM_HITTEST             TTM_HITTESTW
  808. #define TTM_GETTEXT             TTM_GETTEXTW
  809. #define TTM_UPDATETIPTEXT       TTM_UPDATETIPTEXTW
  810. #define TTM_ENUMTOOLS           TTM_ENUMTOOLSW
  811. #define TTM_GETCURRENTTOOL      TTM_GETCURRENTTOOLW
  812. #else
  813. #define TTM_ADDTOOL             TTM_ADDTOOLA
  814. #define TTM_DELTOOL             TTM_DELTOOLA
  815. #define TTM_NEWTOOLRECT         TTM_NEWTOOLRECTA
  816. #define TTM_GETTOOLINFO         TTM_GETTOOLINFOA
  817. #define TTM_SETTOOLINFO         TTM_SETTOOLINFOA
  818. #define TTM_HITTEST             TTM_HITTESTA
  819. #define TTM_GETTEXT             TTM_GETTEXTA
  820. #define TTM_UPDATETIPTEXT       TTM_UPDATETIPTEXTA
  821. #define TTM_ENUMTOOLS           TTM_ENUMTOOLSA
  822. #define TTM_GETCURRENTTOOL      TTM_GETCURRENTTOOLA
  823. #endif
  824.  
  825.  
  826. typedef struct _TT_HITTESTINFOA {
  827.     HWND hwnd;
  828.     POINT pt;
  829.     TOOLINFOA ti;
  830. } TTHITTESTINFOA, FAR * LPHITTESTINFOA;
  831.  
  832. typedef struct _TT_HITTESTINFOW {
  833.     HWND hwnd;
  834.     POINT pt;
  835.     TOOLINFOW ti;
  836. } TTHITTESTINFOW, FAR * LPHITTESTINFOW;
  837.  
  838.  
  839. #ifdef UNICODE
  840. #define TTHITTESTINFO           TTHITTESTINFOW
  841. #define LPHITTESTINFO           LPHITTESTINFOW
  842. #else
  843. #define TTHITTESTINFO           TTHITTESTINFOA
  844. #define LPHITTESTINFO           LPHITTESTINFOA
  845. #endif
  846.  
  847.  
  848. #define TTN_NEEDTEXTA           (TTN_FIRST - 0)
  849. #define TTN_NEEDTEXTW           (TTN_FIRST - 10)
  850. #define TTN_SHOW                (TTN_FIRST - 1)
  851. #define TTN_POP                 (TTN_FIRST - 2)
  852.  
  853.  
  854. #ifdef UNICODE
  855. #define TTN_NEEDTEXT            TTN_NEEDTEXTW
  856. #else
  857. #define TTN_NEEDTEXT            TTN_NEEDTEXTA
  858. #endif
  859.  
  860. typedef struct tagTOOLTIPTEXTA {
  861.     NMHDR hdr;
  862.     LPSTR lpszText;
  863.     char szText[80];
  864.     HINSTANCE hinst;
  865.     UINT uFlags;
  866. } TOOLTIPTEXTA, FAR *LPTOOLTIPTEXTA;
  867.  
  868. typedef struct tagTOOLTIPTEXTW {
  869.     NMHDR hdr;
  870.     LPWSTR lpszText;
  871.     WCHAR szText[80];
  872.     HINSTANCE hinst;
  873.     UINT uFlags;
  874. } TOOLTIPTEXTW, FAR *LPTOOLTIPTEXTW;
  875.  
  876.  
  877. #ifdef UNICODE
  878. #define TOOLTIPTEXT             TOOLTIPTEXTW
  879. #define LPTOOLTIPTEXT           LPTOOLTIPTEXTW
  880. #else
  881. #define TOOLTIPTEXT             TOOLTIPTEXTA
  882. #define LPTOOLTIPTEXT           LPTOOLTIPTEXTA
  883. #endif
  884.  
  885. #endif
  886.  
  887.  
  888. //====== STATUS BAR CONTROL ===================================================
  889.  
  890. #ifndef NOSTATUSBAR
  891.  
  892. #define SBARS_SIZEGRIP          0x0100
  893.  
  894.  
  895. WINCOMMCTRLAPI void WINAPI DrawStatusTextA(HDC hDC, LPRECT lprc, LPCSTR pszText, UINT uFlags);
  896. WINCOMMCTRLAPI void WINAPI DrawStatusTextW(HDC hDC, LPRECT lprc, LPCWSTR pszText, UINT uFlags);
  897.  
  898. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowA(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
  899. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR lpszText, HWND hwndParent, UINT wID);
  900.  
  901. #ifdef UNICODE
  902. #define CreateStatusWindow      CreateStatusWindowW
  903. #define DrawStatusText          DrawStatusTextW
  904. #else
  905. #define CreateStatusWindow      CreateStatusWindowA
  906. #define DrawStatusText          DrawStatusTextA
  907. #endif
  908.  
  909. #ifdef _WIN32
  910. #define STATUSCLASSNAMEW        L"msctls_statusbar32"
  911. #define STATUSCLASSNAMEA        "msctls_statusbar32"
  912.  
  913. #ifdef UNICODE
  914. #define STATUSCLASSNAME         STATUSCLASSNAMEW
  915. #else
  916. #define STATUSCLASSNAME         STATUSCLASSNAMEA
  917. #endif
  918.  
  919. #else
  920. #define STATUSCLASSNAME         "msctls_statusbar"
  921. #endif
  922.  
  923. #define SB_SETTEXTA             (WM_USER+1)
  924. #define SB_SETTEXTW             (WM_USER+11)
  925. #define SB_GETTEXTA             (WM_USER+2)
  926. #define SB_GETTEXTW             (WM_USER+13)
  927. #define SB_GETTEXTLENGTHA       (WM_USER+3)
  928. #define SB_GETTEXTLENGTHW       (WM_USER+12)
  929.  
  930. #ifdef UNICODE
  931. #define SB_GETTEXT              SB_GETTEXTW
  932. #define SB_SETTEXT              SB_SETTEXTW
  933. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHW
  934. #else
  935. #define SB_GETTEXT              SB_GETTEXTA
  936. #define SB_SETTEXT              SB_SETTEXTA
  937. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHA
  938. #endif
  939.  
  940.  
  941. #define SB_SETPARTS             (WM_USER+4)
  942. #define SB_GETPARTS             (WM_USER+6)
  943. #define SB_GETBORDERS           (WM_USER+7)
  944. #define SB_SETMINHEIGHT         (WM_USER+8)
  945. #define SB_SIMPLE               (WM_USER+9)
  946. #define SB_GETRECT              (WM_USER+10)
  947.  
  948.  
  949. #define SBT_OWNERDRAW            0x1000
  950. #define SBT_NOBORDERS            0x0100
  951. #define SBT_POPOUT               0x0200
  952. #define SBT_RTLREADING           0x0400
  953.  
  954. #endif
  955.  
  956. //====== MENU HELP ============================================================
  957.  
  958. #ifndef NOMENUHELP
  959.  
  960. WINCOMMCTRLAPI void WINAPI MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT FAR *lpwIDs);
  961. WINCOMMCTRLAPI BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo);
  962. WINCOMMCTRLAPI void WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo);
  963.  
  964. #define MINSYSCOMMAND   SC_SIZE
  965.  
  966. #endif
  967.  
  968.  
  969. //====== TRACKBAR CONTROL =====================================================
  970.  
  971. #ifndef NOTRACKBAR
  972.  
  973. #ifdef _WIN32
  974.  
  975. #define TRACKBAR_CLASSA         "msctls_trackbar32"
  976. #define TRACKBAR_CLASSW         L"msctls_trackbar32"
  977.  
  978. #ifdef UNICODE
  979. #define  TRACKBAR_CLASS         TRACKBAR_CLASSW
  980. #else
  981. #define  TRACKBAR_CLASS         TRACKBAR_CLASSA
  982. #endif
  983.  
  984. #else
  985. #define TRACKBAR_CLASS          "msctls_trackbar"
  986. #endif
  987.  
  988.  
  989. #define TBS_AUTOTICKS           0x0001
  990. #define TBS_VERT                0x0002
  991. #define TBS_HORZ                0x0000
  992. #define TBS_TOP                 0x0004
  993. #define TBS_BOTTOM              0x0000
  994. #define TBS_LEFT                0x0004
  995. #define TBS_RIGHT               0x0000
  996. #define TBS_BOTH                0x0008
  997. #define TBS_NOTICKS             0x0010
  998. #define TBS_ENABLESELRANGE      0x0020
  999. #define TBS_FIXEDLENGTH         0x0040
  1000. #define TBS_NOTHUMB             0x0080
  1001.  
  1002.  
  1003. #define TBM_GETPOS              (WM_USER)
  1004. #define TBM_GETRANGEMIN         (WM_USER+1)
  1005. #define TBM_GETRANGEMAX         (WM_USER+2)
  1006. #define TBM_GETTIC              (WM_USER+3)
  1007. #define TBM_SETTIC              (WM_USER+4)
  1008. #define TBM_SETPOS              (WM_USER+5)
  1009. #define TBM_SETRANGE            (WM_USER+6)
  1010. #define TBM_SETRANGEMIN         (WM_USER+7)
  1011. #define TBM_SETRANGEMAX         (WM_USER+8)
  1012. #define TBM_CLEARTICS           (WM_USER+9)
  1013. #define TBM_SETSEL              (WM_USER+10)
  1014. #define TBM_SETSELSTART         (WM_USER+11)
  1015. #define TBM_SETSELEND           (WM_USER+12)
  1016. #define TBM_GETPTICS            (WM_USER+14)
  1017. #define TBM_GETTICPOS           (WM_USER+15)
  1018. #define TBM_GETNUMTICS          (WM_USER+16)
  1019. #define TBM_GETSELSTART         (WM_USER+17)
  1020. #define TBM_GETSELEND           (WM_USER+18)
  1021. #define TBM_CLEARSEL            (WM_USER+19)
  1022. #define TBM_SETTICFREQ          (WM_USER+20)
  1023. #define TBM_SETPAGESIZE         (WM_USER+21)
  1024. #define TBM_GETPAGESIZE         (WM_USER+22)
  1025. #define TBM_SETLINESIZE         (WM_USER+23)
  1026. #define TBM_GETLINESIZE         (WM_USER+24)
  1027. #define TBM_GETTHUMBRECT        (WM_USER+25)
  1028. #define TBM_GETCHANNELRECT      (WM_USER+26)
  1029. #define TBM_SETTHUMBLENGTH      (WM_USER+27)
  1030. #define TBM_GETTHUMBLENGTH      (WM_USER+28)
  1031.  
  1032.  
  1033. #define TB_LINEUP               0
  1034. #define TB_LINEDOWN             1
  1035. #define TB_PAGEUP               2
  1036. #define TB_PAGEDOWN             3
  1037. #define TB_THUMBPOSITION        4
  1038. #define TB_THUMBTRACK           5
  1039. #define TB_TOP                  6
  1040. #define TB_BOTTOM               7
  1041. #define TB_ENDTRACK             8
  1042.  
  1043. #endif
  1044.  
  1045. //====== DRAG LIST CONTROL ====================================================
  1046.  
  1047. #ifndef NODRAGLIST
  1048.  
  1049. typedef struct tagDRAGLISTINFO {
  1050.     UINT uNotification;
  1051.     HWND hWnd;
  1052.     POINT ptCursor;
  1053. } DRAGLISTINFO, FAR *LPDRAGLISTINFO;
  1054.  
  1055. #define DL_BEGINDRAG            (WM_USER+133)
  1056. #define DL_DRAGGING             (WM_USER+134)
  1057. #define DL_DROPPED              (WM_USER+135)
  1058. #define DL_CANCELDRAG           (WM_USER+136)
  1059.  
  1060. #define DL_CURSORSET            0
  1061. #define DL_STOPCURSOR           1
  1062. #define DL_COPYCURSOR           2
  1063. #define DL_MOVECURSOR           3
  1064.  
  1065. #define DRAGLISTMSGSTRING       TEXT("commctrl_DragListMsg")
  1066.  
  1067. WINCOMMCTRLAPI BOOL WINAPI MakeDragList(HWND hLB);
  1068. WINCOMMCTRLAPI void WINAPI DrawInsert(HWND handParent, HWND hLB, int nItem);
  1069. WINCOMMCTRLAPI int WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll);
  1070.  
  1071. #endif
  1072.  
  1073.  
  1074. //====== UPDOWN CONTROL =======================================================
  1075.  
  1076. #ifndef NOUPDOWN
  1077.  
  1078. #ifdef _WIN32
  1079.  
  1080. #define UPDOWN_CLASSA           "msctls_updown32"
  1081. #define UPDOWN_CLASSW           L"msctls_updown32"
  1082.  
  1083. #ifdef UNICODE
  1084. #define  UPDOWN_CLASS           UPDOWN_CLASSW
  1085. #else
  1086. #define  UPDOWN_CLASS           UPDOWN_CLASSA
  1087. #endif
  1088.  
  1089. #else
  1090. #define UPDOWN_CLASS            "msctls_updown"
  1091. #endif
  1092.  
  1093.  
  1094. typedef struct _UDACCEL {
  1095.     UINT nSec;
  1096.     UINT nInc;
  1097. } UDACCEL, FAR *LPUDACCEL;
  1098.  
  1099. #define UD_MAXVAL               0x7fff
  1100. #define UD_MINVAL               (-UD_MAXVAL)
  1101.  
  1102.  
  1103. #define UDS_WRAP                0x0001
  1104. #define UDS_SETBUDDYINT         0x0002
  1105. #define UDS_ALIGNRIGHT          0x0004
  1106. #define UDS_ALIGNLEFT           0x0008
  1107. #define UDS_AUTOBUDDY           0x0010
  1108. #define UDS_ARROWKEYS           0x0020
  1109. #define UDS_HORZ                0x0040
  1110. #define UDS_NOTHOUSANDS         0x0080
  1111.  
  1112.  
  1113. #define UDM_SETRANGE            (WM_USER+101)
  1114. #define UDM_GETRANGE            (WM_USER+102)
  1115. #define UDM_SETPOS              (WM_USER+103)
  1116. #define UDM_GETPOS              (WM_USER+104)
  1117. #define UDM_SETBUDDY            (WM_USER+105)
  1118. #define UDM_GETBUDDY            (WM_USER+106)
  1119. #define UDM_SETACCEL            (WM_USER+107)
  1120. #define UDM_GETACCEL            (WM_USER+108)
  1121. #define UDM_SETBASE             (WM_USER+109)
  1122. #define UDM_GETBASE             (WM_USER+110)
  1123.  
  1124.  
  1125. WINCOMMCTRLAPI HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy,
  1126.                                 HWND hParent, int nID, HINSTANCE hInst,
  1127.                                 HWND hBuddy,
  1128.                                 int nUpper, int nLower, int nPos);
  1129.  
  1130. typedef struct _NM_UPDOWN
  1131. {
  1132.     NMHDR hdr;
  1133.     int iPos;
  1134.     int iDelta;
  1135. } NM_UPDOWN, FAR *LPNM_UPDOWN;
  1136.  
  1137. #define UDN_DELTAPOS (UDN_FIRST - 1)
  1138.  
  1139. #endif
  1140.  
  1141.  
  1142. //====== PROGRESS CONTROL =====================================================
  1143.  
  1144. #ifndef NOPROGRESS
  1145.  
  1146. #ifdef _WIN32
  1147.  
  1148. #define PROGRESS_CLASSA         "msctls_progress32"
  1149. #define PROGRESS_CLASSW         L"msctls_progress32"
  1150.  
  1151. #ifdef UNICODE
  1152. #define  PROGRESS_CLASS         PROGRESS_CLASSW
  1153. #else
  1154. #define  PROGRESS_CLASS         PROGRESS_CLASSA
  1155. #endif
  1156.  
  1157. #else
  1158. #define PROGRESS_CLASS          "msctls_progress"
  1159. #endif
  1160.  
  1161.  
  1162. #define PBM_SETRANGE            (WM_USER+1)
  1163. #define PBM_SETPOS              (WM_USER+2)
  1164. #define PBM_DELTAPOS            (WM_USER+3)
  1165. #define PBM_SETSTEP             (WM_USER+4)
  1166. #define PBM_STEPIT              (WM_USER+5)
  1167.  
  1168. #endif
  1169.  
  1170.  
  1171. //====== HOTKEY CONTROL =======================================================
  1172.  
  1173. #ifndef NOHOTKEY
  1174.  
  1175. #define HOTKEYF_SHIFT           0x01
  1176. #define HOTKEYF_CONTROL         0x02
  1177. #define HOTKEYF_ALT             0x04
  1178. #define HOTKEYF_EXT             0x08
  1179.  
  1180. #define HKCOMB_NONE             0x0001
  1181. #define HKCOMB_S                0x0002
  1182. #define HKCOMB_C                0x0004
  1183. #define HKCOMB_A                0x0008
  1184. #define HKCOMB_SC               0x0010
  1185. #define HKCOMB_SA               0x0020
  1186. #define HKCOMB_CA               0x0040
  1187. #define HKCOMB_SCA              0x0080
  1188.  
  1189.  
  1190. #define HKM_SETHOTKEY           (WM_USER+1)
  1191. #define HKM_GETHOTKEY           (WM_USER+2)
  1192. #define HKM_SETRULES            (WM_USER+3)
  1193.  
  1194. #ifdef _WIN32
  1195.  
  1196. #define HOTKEY_CLASSA           "msctls_hotkey32"
  1197. #define HOTKEY_CLASSW           L"msctls_hotkey32"
  1198.  
  1199. #ifdef UNICODE
  1200. #define HOTKEY_CLASS            HOTKEY_CLASSW
  1201. #else
  1202. #define HOTKEY_CLASS            HOTKEY_CLASSA
  1203. #endif
  1204.  
  1205. #else
  1206. #define HOTKEY_CLASS            "msctls_hotkey"
  1207. #endif
  1208.  
  1209. #endif
  1210.  
  1211.  
  1212. //====== COMMON CONTROL STYLES ================================================
  1213.  
  1214. #define CCS_TOP                 0x00000001L
  1215. #define CCS_NOMOVEY             0x00000002L
  1216. #define CCS_BOTTOM              0x00000003L
  1217. #define CCS_NORESIZE            0x00000004L
  1218. #define CCS_NOPARENTALIGN       0x00000008L
  1219. #define CCS_ADJUSTABLE          0x00000020L
  1220. #define CCS_NODIVIDER           0x00000040L
  1221.  
  1222.  
  1223. //====== LISTVIEW CONTROL =====================================================
  1224.  
  1225. #ifndef NOLISTVIEW
  1226.  
  1227. #ifdef _WIN32
  1228.  
  1229. #define WC_LISTVIEWA            "SysListView32"
  1230. #define WC_LISTVIEWW            L"SysListView32"
  1231.  
  1232. #ifdef UNICODE
  1233. #define WC_LISTVIEW             WC_LISTVIEWW
  1234. #else
  1235. #define WC_LISTVIEW             WC_LISTVIEWA
  1236. #endif
  1237.  
  1238. #else
  1239. #define WC_LISTVIEW             "SysListView"
  1240. #endif
  1241.  
  1242. #define LVS_ICON                0x0000
  1243. #define LVS_REPORT              0x0001
  1244. #define LVS_SMALLICON           0x0002
  1245. #define LVS_LIST                0x0003
  1246. #define LVS_TYPEMASK            0x0003
  1247. #define LVS_SINGLESEL           0x0004
  1248. #define LVS_SHOWSELALWAYS       0x0008
  1249. #define LVS_SORTASCENDING       0x0010
  1250. #define LVS_SORTDESCENDING      0x0020
  1251. #define LVS_SHAREIMAGELISTS     0x0040
  1252. #define LVS_NOLABELWRAP         0x0080
  1253. #define LVS_AUTOARRANGE         0x0100
  1254. #define LVS_EDITLABELS          0x0200
  1255. #define LVS_NOSCROLL            0x2000
  1256.  
  1257. #define LVS_TYPESTYLEMASK       0xfc00
  1258.  
  1259. #define LVS_ALIGNTOP            0x0000
  1260. #define LVS_ALIGNLEFT           0x0800
  1261. #define LVS_ALIGNMASK           0x0c00
  1262.  
  1263. #define LVS_OWNERDRAWFIXED      0x0400
  1264. #define LVS_NOCOLUMNHEADER      0x4000
  1265. #define LVS_NOSORTHEADER        0x8000
  1266.  
  1267. #define LVM_GETBKCOLOR          (LVM_FIRST + 0)
  1268. #define ListView_GetBkColor(hwnd)  \
  1269.     (COLORREF)SendMessage((hwnd), LVM_GETBKCOLOR, 0, 0L)
  1270.  
  1271. #define LVM_SETBKCOLOR          (LVM_FIRST + 1)
  1272. #define ListView_SetBkColor(hwnd, clrBk) \
  1273.     (BOOL)SendMessage((hwnd), LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  1274.  
  1275. #define LVM_GETIMAGELIST        (LVM_FIRST + 2)
  1276. #define ListView_GetImageList(hwnd, iImageList) \
  1277.     (HIMAGELIST)SendMessage((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
  1278.  
  1279. #define LVSIL_NORMAL            0
  1280. #define LVSIL_SMALL             1
  1281. #define LVSIL_STATE             2
  1282.  
  1283. #define LVM_SETIMAGELIST        (LVM_FIRST + 3)
  1284. #define ListView_SetImageList(hwnd, himl, iImageList) \
  1285.     (HIMAGELIST)(UINT)SendMessage((hwnd), LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl))
  1286.  
  1287. #define LVM_GETITEMCOUNT        (LVM_FIRST + 4)
  1288. #define ListView_GetItemCount(hwnd) \
  1289.     (int)SendMessage((hwnd), LVM_GETITEMCOUNT, 0, 0L)
  1290.  
  1291.  
  1292. #define LVIF_TEXT               0x0001
  1293. #define LVIF_IMAGE              0x0002
  1294. #define LVIF_PARAM              0x0004
  1295. #define LVIF_STATE              0x0008
  1296.  
  1297. #define LVIS_FOCUSED            0x0001
  1298. #define LVIS_SELECTED           0x0002
  1299. #define LVIS_CUT                0x0004
  1300. #define LVIS_DROPHILITED        0x0008
  1301.  
  1302. #define LVIS_OVERLAYMASK        0x0F00
  1303. #define LVIS_STATEIMAGEMASK     0xF000
  1304.  
  1305. #define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
  1306.  
  1307. typedef struct _LV_ITEMA
  1308. {
  1309.     UINT mask;
  1310.     int iItem;
  1311.     int iSubItem;
  1312.     UINT state;
  1313.     UINT stateMask;
  1314.     LPSTR pszText;
  1315.     int cchTextMax;
  1316.     int iImage;
  1317.     LPARAM lParam;
  1318. } LV_ITEMA;
  1319.  
  1320. typedef struct _LV_ITEMW
  1321. {
  1322.     UINT mask;
  1323.     int iItem;
  1324.     int iSubItem;
  1325.     UINT state;
  1326.     UINT stateMask;
  1327.     LPWSTR pszText;
  1328.     int cchTextMax;
  1329.     int iImage;
  1330.     LPARAM lParam;
  1331. } LV_ITEMW;
  1332.  
  1333. #ifdef UNICODE
  1334. #define LV_ITEM    LV_ITEMW
  1335. #else
  1336. #define LV_ITEM    LV_ITEMA
  1337. #endif
  1338.  
  1339. #define LPSTR_TEXTCALLBACKW     ((LPWSTR)-1L)
  1340. #define LPSTR_TEXTCALLBACKA     ((LPSTR)-1L)
  1341. #ifdef UNICODE
  1342. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKW
  1343. #else
  1344. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKA
  1345. #endif
  1346.  
  1347. #define I_IMAGECALLBACK         (-1)
  1348.  
  1349. #define LVM_GETITEMA            (LVM_FIRST + 5)
  1350. #define LVM_GETITEMW            (LVM_FIRST + 75)
  1351. #ifdef UNICODE
  1352. #define LVM_GETITEM             LVM_GETITEMW
  1353. #else
  1354. #define LVM_GETITEM             LVM_GETITEMA
  1355. #endif
  1356.  
  1357. #define ListView_GetItem(hwnd, pitem) \
  1358.     (BOOL)SendMessage((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM FAR*)(pitem))
  1359.  
  1360.  
  1361. #define LVM_SETITEMA            (LVM_FIRST + 6)
  1362. #define LVM_SETITEMW            (LVM_FIRST + 76)
  1363. #ifdef UNICODE
  1364. #define LVM_SETITEM             LVM_SETITEMW
  1365. #else
  1366. #define LVM_SETITEM             LVM_SETITEMA
  1367. #endif
  1368.  
  1369. #define ListView_SetItem(hwnd, pitem) \
  1370.     (BOOL)SendMessage((hwnd), LVM_SETITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1371.  
  1372.  
  1373. #define LVM_INSERTITEMA         (LVM_FIRST + 7)
  1374. #define LVM_INSERTITEMW         (LVM_FIRST + 77)
  1375. #ifdef UNICODE
  1376. #define LVM_INSERTITEM          LVM_INSERTITEMW
  1377. #else
  1378. #define LVM_INSERTITEM          LVM_INSERTITEMA
  1379. #endif
  1380. #define ListView_InsertItem(hwnd, pitem)   \
  1381.     (int)SendMessage((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1382.  
  1383.  
  1384. #define LVM_DELETEITEM          (LVM_FIRST + 8)
  1385. #define ListView_DeleteItem(hwnd, i) \
  1386.     (BOOL)SendMessage((hwnd), LVM_DELETEITEM, (WPARAM)(int)(i), 0L)
  1387.  
  1388.  
  1389. #define LVM_DELETEALLITEMS      (LVM_FIRST + 9)
  1390. #define ListView_DeleteAllItems(hwnd) \
  1391.     (BOOL)SendMessage((hwnd), LVM_DELETEALLITEMS, 0, 0L)
  1392.  
  1393.  
  1394. #define LVM_GETCALLBACKMASK     (LVM_FIRST + 10)
  1395. #define ListView_GetCallbackMask(hwnd) \
  1396.     (BOOL)SendMessage((hwnd), LVM_GETCALLBACKMASK, 0, 0)
  1397.  
  1398.  
  1399. #define LVM_SETCALLBACKMASK     (LVM_FIRST + 11)
  1400. #define ListView_SetCallbackMask(hwnd, mask) \
  1401.     (BOOL)SendMessage((hwnd), LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0)
  1402.  
  1403.  
  1404. #define LVNI_ALL                0x0000
  1405. #define LVNI_FOCUSED            0x0001
  1406. #define LVNI_SELECTED           0x0002
  1407. #define LVNI_CUT                0x0004
  1408. #define LVNI_DROPHILITED        0x0008
  1409.  
  1410. #define LVNI_ABOVE              0x0100
  1411. #define LVNI_BELOW              0x0200
  1412. #define LVNI_TOLEFT             0x0400
  1413. #define LVNI_TORIGHT            0x0800
  1414.  
  1415.  
  1416. #define LVM_GETNEXTITEM         (LVM_FIRST + 12)
  1417. #define ListView_GetNextItem(hwnd, i, flags) \
  1418.     (int)SendMessage((hwnd), LVM_GETNEXTITEM, (WPARAM)(int)(i), MAKELPARAM((flags), 0))
  1419.  
  1420.  
  1421. #define LVFI_PARAM              0x0001
  1422. #define LVFI_STRING             0x0002
  1423. #define LVFI_PARTIAL            0x0008
  1424. #define LVFI_WRAP               0x0020
  1425. #define LVFI_NEARESTXY          0x0040
  1426.  
  1427. typedef struct _LV_FINDINFOA
  1428. {
  1429.     UINT flags;
  1430.     LPCSTR psz;
  1431.     LPARAM lParam;
  1432.     POINT pt;
  1433.     UINT vkDirection;
  1434. } LV_FINDINFOA;
  1435.  
  1436. typedef struct _LV_FINDINFOW
  1437. {
  1438.     UINT flags;
  1439.     LPCWSTR psz;
  1440.     LPARAM lParam;
  1441.     POINT pt;
  1442.     UINT vkDirection;
  1443. } LV_FINDINFOW;
  1444.  
  1445. #ifdef UNICODE
  1446. #define  LV_FINDINFO            LV_FINDINFOW
  1447. #else
  1448. #define  LV_FINDINFO            LV_FINDINFOA
  1449. #endif
  1450.  
  1451. #define LVM_FINDITEMA           (LVM_FIRST + 13)
  1452. #define LVM_FINDITEMW           (LVM_FIRST + 83)
  1453. #ifdef UNICODE
  1454. #define  LVM_FINDITEM           LVM_FINDITEMW
  1455. #else
  1456. #define  LVM_FINDITEM           LVM_FINDITEMA
  1457. #endif
  1458.  
  1459. #define ListView_FindItem(hwnd, iStart, plvfi) \
  1460.     (int)SendMessage((hwnd), LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LV_FINDINFO FAR*)(plvfi))
  1461.  
  1462. #define LVIR_BOUNDS             0
  1463. #define LVIR_ICON               1
  1464. #define LVIR_LABEL              2
  1465. #define LVIR_SELECTBOUNDS       3
  1466.  
  1467.  
  1468. #define LVM_GETITEMRECT         (LVM_FIRST + 14)
  1469. #define ListView_GetItemRect(hwnd, i, prc, code) \
  1470.      (BOOL)SendMessage((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), \
  1471.            ((prc) ? (((RECT FAR *)(prc))->left = (code),(LPARAM)(RECT FAR*)(prc)) : (LPARAM)(RECT FAR*)NULL))
  1472.  
  1473.  
  1474. #define LVM_SETITEMPOSITION     (LVM_FIRST + 15)
  1475. #define ListView_SetItemPosition(hwndLV, i, x, y) \
  1476.     (BOOL)SendMessage((hwndLV), LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y)))
  1477.  
  1478.  
  1479. #define LVM_GETITEMPOSITION     (LVM_FIRST + 16)
  1480. #define ListView_GetItemPosition(hwndLV, i, ppt) \
  1481.     (BOOL)SendMessage((hwndLV), LVM_GETITEMPOSITION, (WPARAM)(int)(i), (LPARAM)(POINT FAR*)(ppt))
  1482.  
  1483.  
  1484. #define LVM_GETSTRINGWIDTHA     (LVM_FIRST + 17)
  1485. #define LVM_GETSTRINGWIDTHW     (LVM_FIRST + 87)
  1486. #ifdef UNICODE
  1487. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHW
  1488. #else
  1489. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHA
  1490. #endif
  1491.  
  1492. #define ListView_GetStringWidth(hwndLV, psz) \
  1493.     (int)SendMessage((hwndLV), LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCTSTR)(psz))
  1494.  
  1495.  
  1496. #define LVHT_NOWHERE            0x0001
  1497. #define LVHT_ONITEMICON         0x0002
  1498. #define LVHT_ONITEMLABEL        0x0004
  1499. #define LVHT_ONITEMSTATEICON    0x0008
  1500. #define LVHT_ONITEM             (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
  1501.  
  1502. #define LVHT_ABOVE              0x0008
  1503. #define LVHT_BELOW              0x0010
  1504. #define LVHT_TORIGHT            0x0020
  1505. #define LVHT_TOLEFT             0x0040
  1506.  
  1507. typedef struct _LV_HITTESTINFO
  1508. {
  1509.     POINT pt;
  1510.     UINT flags;
  1511.     int iItem;
  1512. } LV_HITTESTINFO;
  1513.  
  1514. #define LVM_HITTEST             (LVM_FIRST + 18)
  1515. #define ListView_HitTest(hwndLV, pinfo) \
  1516.     (int)SendMessage((hwndLV), LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO FAR*)(pinfo))
  1517.  
  1518.  
  1519. #define LVM_ENSUREVISIBLE       (LVM_FIRST + 19)
  1520. #define ListView_EnsureVisible(hwndLV, i, fPartialOK) \
  1521.     (BOOL)SendMessage((hwndLV), LVM_ENSUREVISIBLE, (WPARAM)(int)(i), MAKELPARAM((fPartialOK), 0))
  1522.  
  1523.  
  1524. #define LVM_SCROLL              (LVM_FIRST + 20)
  1525. #define ListView_Scroll(hwndLV, dx, dy) \
  1526.     (BOOL)SendMessage((hwndLV), LVM_SCROLL, (WPARAM)(int)dx, (LPARAM)(int)dy)
  1527.  
  1528.  
  1529. #define LVM_REDRAWITEMS         (LVM_FIRST + 21)
  1530. #define ListView_RedrawItems(hwndLV, iFirst, iLast) \
  1531.     (BOOL)SendMessage((hwndLV), LVM_REDRAWITEMS, (WPARAM)(int)iFirst, (LPARAM)(int)iLast)
  1532.  
  1533.  
  1534. #define LVA_DEFAULT             0x0000
  1535. #define LVA_ALIGNLEFT           0x0001
  1536. #define LVA_ALIGNTOP            0x0002
  1537. #define LVA_SNAPTOGRID          0x0005
  1538.  
  1539.  
  1540. #define LVM_ARRANGE             (LVM_FIRST + 22)
  1541. #define ListView_Arrange(hwndLV, code) \
  1542.     (BOOL)SendMessage((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0L)
  1543.  
  1544.  
  1545. #define LVM_EDITLABELA          (LVM_FIRST + 23)
  1546. #define LVM_EDITLABELW          (LVM_FIRST + 118)
  1547. #ifdef UNICODE
  1548. #define LVM_EDITLABEL           LVM_EDITLABELW
  1549. #else
  1550. #define LVM_EDITLABEL           LVM_EDITLABELA
  1551. #endif
  1552.  
  1553. #define ListView_EditLabel(hwndLV, i) \
  1554.     (HWND)SendMessage((hwndLV), LVM_EDITLABEL, (WPARAM)(int)(i), 0L)
  1555.  
  1556.  
  1557. #define LVM_GETEDITCONTROL      (LVM_FIRST + 24)
  1558. #define ListView_GetEditControl(hwndLV) \
  1559.     (HWND)SendMessage((hwndLV), LVM_GETEDITCONTROL, 0, 0L)
  1560.  
  1561.  
  1562. typedef struct _LV_COLUMNA
  1563. {
  1564.     UINT mask;
  1565.     int fmt;
  1566.     int cx;
  1567.     LPSTR pszText;
  1568.     int cchTextMax;
  1569.     int iSubItem;
  1570. } LV_COLUMNA;
  1571.  
  1572. typedef struct _LV_COLUMNW
  1573. {
  1574.     UINT mask;
  1575.     int fmt;
  1576.     int cx;
  1577.     LPWSTR pszText;
  1578.     int cchTextMax;
  1579.     int iSubItem;
  1580. } LV_COLUMNW;
  1581.  
  1582. #ifdef UNICODE
  1583. #define  LV_COLUMN              LV_COLUMNW
  1584. #else
  1585. #define  LV_COLUMN              LV_COLUMNA
  1586. #endif
  1587.  
  1588.  
  1589. #define LVCF_FMT                0x0001
  1590. #define LVCF_WIDTH              0x0002
  1591. #define LVCF_TEXT               0x0004
  1592. #define LVCF_SUBITEM            0x0008
  1593.  
  1594. #define LVCFMT_LEFT             0x0000
  1595. #define LVCFMT_RIGHT            0x0001
  1596. #define LVCFMT_CENTER           0x0002
  1597. #define LVCFMT_JUSTIFYMASK      0x0003
  1598.  
  1599.  
  1600. #define LVM_GETCOLUMNA         (LVM_FIRST + 25)
  1601. #define LVM_GETCOLUMNW         (LVM_FIRST + 95)
  1602. #ifdef UNICODE
  1603. #define  LVM_GETCOLUMN          LVM_GETCOLUMNW
  1604. #else
  1605. #define  LVM_GETCOLUMN          LVM_GETCOLUMNA
  1606. #endif
  1607.  
  1608. #define ListView_GetColumn(hwnd, iCol, pcol) \
  1609.     (BOOL)SendMessage((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN FAR*)(pcol))
  1610.  
  1611.  
  1612. #define LVM_SETCOLUMNA          (LVM_FIRST + 26)
  1613. #define LVM_SETCOLUMNW          (LVM_FIRST + 96)
  1614. #ifdef UNICODE
  1615. #define  LVM_SETCOLUMN          LVM_SETCOLUMNW
  1616. #else
  1617. #define  LVM_SETCOLUMN          LVM_SETCOLUMNA
  1618. #endif
  1619.  
  1620. #define ListView_SetColumn(hwnd, iCol, pcol) \
  1621.     (BOOL)SendMessage((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  1622.  
  1623.  
  1624. #define LVM_INSERTCOLUMNA       (LVM_FIRST + 27)
  1625. #define LVM_INSERTCOLUMNW       (LVM_FIRST + 97)
  1626. #ifdef UNICODE
  1627. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNW
  1628. #else
  1629. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNA
  1630. #endif
  1631.  
  1632. #define ListView_InsertColumn(hwnd, iCol, pcol) \
  1633.     (int)SendMessage((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  1634.  
  1635.  
  1636. #define LVM_DELETECOLUMN        (LVM_FIRST + 28)
  1637. #define ListView_DeleteColumn(hwnd, iCol) \
  1638.     (BOOL)SendMessage((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0)
  1639.  
  1640.  
  1641. #define LVM_GETCOLUMNWIDTH      (LVM_FIRST + 29)
  1642. #define ListView_GetColumnWidth(hwnd, iCol) \
  1643.     (int)SendMessage((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0)
  1644.  
  1645.  
  1646. #define LVSCW_AUTOSIZE              -1
  1647. #define LVSCW_AUTOSIZE_USEHEADER    -2
  1648. #define LVM_SETCOLUMNWIDTH          (LVM_FIRST + 30)
  1649.  
  1650. #define ListView_SetColumnWidth(hwnd, iCol, cx) \
  1651.     (BOOL)SendMessage((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0))
  1652.  
  1653.  
  1654. #define LVM_CREATEDRAGIMAGE     (LVM_FIRST + 33)
  1655. #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
  1656.     (HIMAGELIST)SendMessage((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
  1657.  
  1658.  
  1659. #define LVM_GETVIEWRECT         (LVM_FIRST + 34)
  1660. #define ListView_GetViewRect(hwnd, prc) \
  1661.     (BOOL)SendMessage((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT FAR*)(prc))
  1662.  
  1663.  
  1664. #define LVM_GETTEXTCOLOR        (LVM_FIRST + 35)
  1665. #define ListView_GetTextColor(hwnd)  \
  1666.     (COLORREF)SendMessage((hwnd), LVM_GETTEXTCOLOR, 0, 0L)
  1667.  
  1668.  
  1669. #define LVM_SETTEXTCOLOR        (LVM_FIRST + 36)
  1670. #define ListView_SetTextColor(hwnd, clrText) \
  1671.     (BOOL)SendMessage((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  1672.  
  1673.  
  1674. #define LVM_GETTEXTBKCOLOR      (LVM_FIRST + 37)
  1675. #define ListView_GetTextBkColor(hwnd)  \
  1676.     (COLORREF)SendMessage((hwnd), LVM_GETTEXTBKCOLOR, 0, 0L)
  1677.  
  1678.  
  1679. #define LVM_SETTEXTBKCOLOR      (LVM_FIRST + 38)
  1680. #define ListView_SetTextBkColor(hwnd, clrTextBk) \
  1681.     (BOOL)SendMessage((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  1682.  
  1683.  
  1684. #define LVM_GETTOPINDEX         (LVM_FIRST + 39)
  1685. #define ListView_GetTopIndex(hwndLV) \
  1686.     (int)SendMessage((hwndLV), LVM_GETTOPINDEX, 0, 0)
  1687.  
  1688.  
  1689. #define LVM_GETCOUNTPERPAGE     (LVM_FIRST + 40)
  1690. #define ListView_GetCountPerPage(hwndLV) \
  1691.     (int)SendMessage((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)
  1692.  
  1693.  
  1694. #define LVM_GETORIGIN           (LVM_FIRST + 41)
  1695. #define ListView_GetOrigin(hwndLV, ppt) \
  1696.     (BOOL)SendMessage((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT FAR*)(ppt))
  1697.  
  1698.  
  1699. #define LVM_UPDATE              (LVM_FIRST + 42)
  1700. #define ListView_Update(hwndLV, i) \
  1701.     (BOOL)SendMessage((hwndLV), LVM_UPDATE, (WPARAM)i, 0L)
  1702.  
  1703.  
  1704. #define LVM_SETITEMSTATE        (LVM_FIRST + 43)
  1705. #define ListView_SetItemState(hwndLV, i, data, mask) \
  1706. { LV_ITEM _ms_lvi;\
  1707.   _ms_lvi.stateMask = mask;\
  1708.   _ms_lvi.state = data;\
  1709.   SendMessage((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  1710. }
  1711.  
  1712.  
  1713. #define LVM_GETITEMSTATE        (LVM_FIRST + 44)
  1714. #define ListView_GetItemState(hwndLV, i, mask) \
  1715.    (UINT)SendMessage((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask)
  1716.  
  1717.  
  1718. #define LVM_GETITEMTEXTA        (LVM_FIRST + 45)
  1719. #define LVM_GETITEMTEXTW        (LVM_FIRST + 115)
  1720.  
  1721. #ifdef UNICODE
  1722. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTW
  1723. #else
  1724. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTA
  1725. #endif
  1726.  
  1727. #define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  1728. { LV_ITEM _ms_lvi;\
  1729.   _ms_lvi.iSubItem = iSubItem_;\
  1730.   _ms_lvi.cchTextMax = cchTextMax_;\
  1731.   _ms_lvi.pszText = pszText_;\
  1732.   SendMessage((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  1733. }
  1734.  
  1735.  
  1736. #define LVM_SETITEMTEXTA        (LVM_FIRST + 46)
  1737. #define LVM_SETITEMTEXTW        (LVM_FIRST + 116)
  1738.  
  1739. #ifdef UNICODE
  1740. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTW
  1741. #else
  1742. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTA
  1743. #endif
  1744.  
  1745. #define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) \
  1746. { LV_ITEM _ms_lvi;\
  1747.   _ms_lvi.iSubItem = iSubItem_;\
  1748.   _ms_lvi.pszText = pszText_;\
  1749.   SendMessage((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  1750. }
  1751.  
  1752.  
  1753. #define LVM_SETITEMCOUNT        (LVM_FIRST + 47)
  1754. #define ListView_SetItemCount(hwndLV, cItems) \
  1755.   SendMessage((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0)
  1756.  
  1757.  
  1758. typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
  1759.  
  1760.  
  1761. #define LVM_SORTITEMS           (LVM_FIRST + 48)
  1762. #define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) \
  1763.   (BOOL)SendMessage((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, \
  1764.   (LPARAM)(PFNLVCOMPARE)_pfnCompare)
  1765.  
  1766.  
  1767. #define LVM_SETITEMPOSITION32   (LVM_FIRST + 49)
  1768. #define ListView_SetItemPosition32(hwndLV, i, x, y) \
  1769. { POINT ptNewPos = {x,y}; \
  1770.     SendMessage((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); \
  1771. }
  1772.  
  1773.  
  1774. #define LVM_GETSELECTEDCOUNT    (LVM_FIRST + 50)
  1775. #define ListView_GetSelectedCount(hwndLV) \
  1776.     (UINT)SendMessage((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
  1777.  
  1778.  
  1779. #define LVM_GETITEMSPACING      (LVM_FIRST + 51)
  1780. #define ListView_GetItemSpacing(hwndLV, fSmall) \
  1781.         (DWORD)SendMessage((hwndLV), LVM_GETITEMSPACING, fSmall, 0L)
  1782.  
  1783.  
  1784. #define LVM_GETISEARCHSTRINGA   (LVM_FIRST + 52)
  1785. #define LVM_GETISEARCHSTRINGW   (LVM_FIRST + 117)
  1786.  
  1787. #ifdef UNICODE
  1788. #define LVM_GETISEARCHSTRING   LVM_GETISEARCHSTRINGW
  1789. #else
  1790. #define LVM_GETISEARCHSTRING   LVM_GETISEARCHSTRINGA
  1791. #endif
  1792.  
  1793. #define ListView_GetISearchString(hwndLV, lpsz) \
  1794.         (BOOL)SendMessage((hwndLV), LVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  1795.  
  1796.  
  1797. typedef struct _NM_LISTVIEW
  1798. {
  1799.     NMHDR   hdr;
  1800.     int     iItem;
  1801.     int     iSubItem;
  1802.     UINT    uNewState;
  1803.     UINT    uOldState;
  1804.     UINT    uChanged;
  1805.     POINT   ptAction;
  1806.     LPARAM  lParam;
  1807. } NM_LISTVIEW, FAR *LPNM_LISTVIEW;
  1808.  
  1809.  
  1810. #define LVN_ITEMCHANGING        (LVN_FIRST-0)
  1811. #define LVN_ITEMCHANGED         (LVN_FIRST-1)
  1812. #define LVN_INSERTITEM          (LVN_FIRST-2)
  1813. #define LVN_DELETEITEM          (LVN_FIRST-3)
  1814. #define LVN_DELETEALLITEMS      (LVN_FIRST-4)
  1815. #define LVN_BEGINLABELEDITA     (LVN_FIRST-5)
  1816. #define LVN_BEGINLABELEDITW     (LVN_FIRST-75)
  1817. #define LVN_ENDLABELEDITA       (LVN_FIRST-6)
  1818. #define LVN_ENDLABELEDITW       (LVN_FIRST-76)
  1819. #define LVN_COLUMNCLICK         (LVN_FIRST-8)
  1820. #define LVN_BEGINDRAG           (LVN_FIRST-9)
  1821. #define LVN_BEGINRDRAG          (LVN_FIRST-11)
  1822.  
  1823.  
  1824.  
  1825. #define LVN_GETDISPINFOA        (LVN_FIRST-50)
  1826. #define LVN_GETDISPINFOW        (LVN_FIRST-77)
  1827. #define LVN_SETDISPINFOA        (LVN_FIRST-51)
  1828. #define LVN_SETDISPINFOW        (LVN_FIRST-78)
  1829.  
  1830. #ifdef UNICODE
  1831. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITW
  1832. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITW
  1833. #define LVN_GETDISPINFO         LVN_GETDISPINFOW
  1834. #define LVN_SETDISPINFO         LVN_SETDISPINFOW
  1835. #else
  1836. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITA
  1837. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITA
  1838. #define LVN_GETDISPINFO         LVN_GETDISPINFOA
  1839. #define LVN_SETDISPINFO         LVN_SETDISPINFOA
  1840. #endif
  1841.  
  1842.  
  1843.  
  1844.  
  1845. #define LVIF_DI_SETITEM         0x1000
  1846.  
  1847. typedef struct _LV_DISPINFO {
  1848.     NMHDR hdr;
  1849.     LV_ITEMA item;
  1850. } LV_DISPINFOA;
  1851.  
  1852. typedef struct _LV_DISPINFOW {
  1853.     NMHDR hdr;
  1854.     LV_ITEMW item;
  1855. } LV_DISPINFOW;
  1856.  
  1857. #ifdef UNICODE
  1858. #define  LV_DISPINFO            LV_DISPINFOW
  1859. #else
  1860. #define  LV_DISPINFO            LV_DISPINFOA
  1861. #endif
  1862.  
  1863. #define LVN_KEYDOWN             (LVN_FIRST-55)
  1864.  
  1865. typedef struct _LV_KEYDOWN
  1866. {
  1867.     NMHDR hdr;
  1868.     WORD wVKey;
  1869.     UINT flags;
  1870. } LV_KEYDOWN;
  1871.  
  1872. #endif
  1873.  
  1874. //====== TREEVIEW CONTROL =====================================================
  1875.  
  1876. #ifndef NOTREEVIEW
  1877.  
  1878. #ifdef _WIN32
  1879. #define WC_TREEVIEWA            "SysTreeView32"
  1880. #define WC_TREEVIEWW            L"SysTreeView32"
  1881.  
  1882. #ifdef UNICODE
  1883. #define  WC_TREEVIEW            WC_TREEVIEWW
  1884. #else
  1885. #define  WC_TREEVIEW            WC_TREEVIEWA
  1886. #endif
  1887.  
  1888. #else
  1889. #define WC_TREEVIEW             "SysTreeView"
  1890. #endif
  1891.  
  1892. #define TVS_HASBUTTONS          0x0001
  1893. #define TVS_HASLINES            0x0002
  1894. #define TVS_LINESATROOT         0x0004
  1895. #define TVS_EDITLABELS          0x0008
  1896. #define TVS_DISABLEDRAGDROP     0x0010
  1897. #define TVS_SHOWSELALWAYS       0x0020
  1898.  
  1899. typedef struct _TREEITEM FAR* HTREEITEM;
  1900.  
  1901. #define TVIF_TEXT               0x0001
  1902. #define TVIF_IMAGE              0x0002
  1903. #define TVIF_PARAM              0x0004
  1904. #define TVIF_STATE              0x0008
  1905. #define TVIF_HANDLE             0x0010
  1906. #define TVIF_SELECTEDIMAGE      0x0020
  1907. #define TVIF_CHILDREN           0x0040
  1908.  
  1909. #define TVIS_FOCUSED            0x0001
  1910. #define TVIS_SELECTED           0x0002
  1911. #define TVIS_CUT                0x0004
  1912. #define TVIS_DROPHILITED        0x0008
  1913. #define TVIS_BOLD               0x0010
  1914. #define TVIS_EXPANDED           0x0020
  1915. #define TVIS_EXPANDEDONCE       0x0040
  1916.  
  1917. #define TVIS_OVERLAYMASK        0x0F00
  1918. #define TVIS_STATEIMAGEMASK     0xF000
  1919. #define TVIS_USERMASK           0xF000
  1920.  
  1921.  
  1922. #define I_CHILDRENCALLBACK  (-1)
  1923.  
  1924. typedef struct _TV_ITEMA {
  1925.     UINT      mask;
  1926.     HTREEITEM hItem;
  1927.     UINT      state;
  1928.     UINT      stateMask;
  1929.     LPSTR     pszText;
  1930.     int       cchTextMax;
  1931.     int       iImage;
  1932.     int       iSelectedImage;
  1933.     int       cChildren;
  1934.     LPARAM    lParam;
  1935. } TV_ITEMA, FAR *LPTV_ITEMA;
  1936.  
  1937. typedef struct _TV_ITEMW {
  1938.     UINT      mask;
  1939.     HTREEITEM hItem;
  1940.     UINT      state;
  1941.     UINT      stateMask;
  1942.     LPWSTR    pszText;
  1943.     int       cchTextMax;
  1944.     int       iImage;
  1945.     int       iSelectedImage;
  1946.     int       cChildren;
  1947.     LPARAM    lParam;
  1948. } TV_ITEMW, FAR *LPTV_ITEMW;
  1949.  
  1950. #ifdef UNICODE
  1951. #define  TV_ITEM                TV_ITEMW
  1952. #define  LPTV_ITEM              LPTV_ITEMW
  1953. #else
  1954. #define  TV_ITEM                TV_ITEMA
  1955. #define  LPTV_ITEM              LPTV_ITEMA
  1956. #endif
  1957.  
  1958.  
  1959. #define TVI_ROOT                ((HTREEITEM)0xFFFF0000)
  1960. #define TVI_FIRST               ((HTREEITEM)0xFFFF0001)
  1961. #define TVI_LAST                ((HTREEITEM)0xFFFF0002)
  1962. #define TVI_SORT                ((HTREEITEM)0xFFFF0003)
  1963.  
  1964. typedef struct _TV_INSERTSTRUCTA {
  1965.     HTREEITEM hParent;
  1966.     HTREEITEM hInsertAfter;
  1967.     TV_ITEMA item;
  1968. } TV_INSERTSTRUCTA, FAR *LPTV_INSERTSTRUCTA;
  1969.  
  1970. typedef struct _TV_INSERTSTRUCTW {
  1971.     HTREEITEM hParent;
  1972.     HTREEITEM hInsertAfter;
  1973.     TV_ITEMW item;
  1974. } TV_INSERTSTRUCTW, FAR *LPTV_INSERTSTRUCTW;
  1975.  
  1976. #ifdef UNICODE
  1977. #define  TV_INSERTSTRUCT        TV_INSERTSTRUCTW
  1978. #define  LPTV_INSERTSTRUCT      LPTV_INSERTSTRUCTW
  1979. #else
  1980. #define  TV_INSERTSTRUCT        TV_INSERTSTRUCTA
  1981. #define  LPTV_INSERTSTRUCT      LPTV_INSERTSTRUCTA
  1982. #endif
  1983.  
  1984. #define TVM_INSERTITEMA         (TV_FIRST + 0)
  1985. #define TVM_INSERTITEMW         (TV_FIRST + 50)
  1986. #ifdef UNICODE
  1987. #define  TVM_INSERTITEM         TVM_INSERTITEMW
  1988. #else
  1989. #define  TVM_INSERTITEM         TVM_INSERTITEMA
  1990. #endif
  1991.  
  1992. #define TreeView_InsertItem(hwnd, lpis) \
  1993.     (HTREEITEM)SendMessage((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis))
  1994.  
  1995.  
  1996. #define TVM_DELETEITEM          (TV_FIRST + 1)
  1997. #define TreeView_DeleteItem(hwnd, hitem) \
  1998.     (BOOL)SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem))
  1999.  
  2000.  
  2001. #define TreeView_DeleteAllItems(hwnd) \
  2002.     (BOOL)SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT)
  2003.  
  2004.  
  2005. #define TVM_EXPAND              (TV_FIRST + 2)
  2006. #define TreeView_Expand(hwnd, hitem, code) \
  2007.     (BOOL)SendMessage((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2008.  
  2009.  
  2010. #define TVE_COLLAPSE            0x0001
  2011. #define TVE_EXPAND              0x0002
  2012. #define TVE_TOGGLE              0x0003
  2013. #define TVE_COLLAPSERESET       0x8000
  2014.  
  2015.  
  2016. #define TVM_GETITEMRECT         (TV_FIRST + 4)
  2017. #define TreeView_GetItemRect(hwnd, hitem, prc, code) \
  2018.     (*(HTREEITEM FAR *)prc = (hitem), (BOOL)SendMessage((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT FAR*)(prc)))
  2019.  
  2020.  
  2021. #define TVM_GETCOUNT            (TV_FIRST + 5)
  2022. #define TreeView_GetCount(hwnd) \
  2023.     (UINT)SendMessage((hwnd), TVM_GETCOUNT, 0, 0)
  2024.  
  2025.  
  2026. #define TVM_GETINDENT           (TV_FIRST + 6)
  2027. #define TreeView_GetIndent(hwnd) \
  2028.     (UINT)SendMessage((hwnd), TVM_GETINDENT, 0, 0)
  2029.  
  2030.  
  2031. #define TVM_SETINDENT           (TV_FIRST + 7)
  2032. #define TreeView_SetIndent(hwnd, indent) \
  2033.     (BOOL)SendMessage((hwnd), TVM_SETINDENT, (WPARAM)indent, 0)
  2034.  
  2035.  
  2036. #define TVM_GETIMAGELIST        (TV_FIRST + 8)
  2037. #define TreeView_GetImageList(hwnd, iImage) \
  2038.     (HIMAGELIST)SendMessage((hwnd), TVM_GETIMAGELIST, iImage, 0)
  2039.  
  2040.  
  2041. #define TVSIL_NORMAL            0
  2042. #define TVSIL_STATE             2
  2043.  
  2044.  
  2045. #define TVM_SETIMAGELIST        (TV_FIRST + 9)
  2046. #define TreeView_SetImageList(hwnd, himl, iImage) \
  2047.     (HIMAGELIST)SendMessage((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl))
  2048.  
  2049.  
  2050. #define TVM_GETNEXTITEM         (TV_FIRST + 10)
  2051. #define TreeView_GetNextItem(hwnd, hitem, code) \
  2052.     (HTREEITEM)SendMessage((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2053.  
  2054.  
  2055. #define TVGN_ROOT               0x0000
  2056. #define TVGN_NEXT               0x0001
  2057. #define TVGN_PREVIOUS           0x0002
  2058. #define TVGN_PARENT             0x0003
  2059. #define TVGN_CHILD              0x0004
  2060. #define TVGN_FIRSTVISIBLE       0x0005
  2061. #define TVGN_NEXTVISIBLE        0x0006
  2062. #define TVGN_PREVIOUSVISIBLE    0x0007
  2063. #define TVGN_DROPHILITE         0x0008
  2064. #define TVGN_CARET              0x0009
  2065.  
  2066. #define TreeView_GetChild(hwnd, hitem)          TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)
  2067. #define TreeView_GetNextSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)
  2068. #define TreeView_GetPrevSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)
  2069. #define TreeView_GetParent(hwnd, hitem)         TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)
  2070. #define TreeView_GetFirstVisible(hwnd)          TreeView_GetNextItem(hwnd, NULL,  TVGN_FIRSTVISIBLE)
  2071. #define TreeView_GetNextVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE)
  2072. #define TreeView_GetPrevVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE)
  2073. #define TreeView_GetSelection(hwnd)             TreeView_GetNextItem(hwnd, NULL,  TVGN_CARET)
  2074. #define TreeView_GetDropHilight(hwnd)           TreeView_GetNextItem(hwnd, NULL,  TVGN_DROPHILITE)
  2075. #define TreeView_GetRoot(hwnd)                  TreeView_GetNextItem(hwnd, NULL,  TVGN_ROOT)
  2076.  
  2077.  
  2078. #define TVM_SELECTITEM          (TV_FIRST + 11)
  2079. #define TreeView_Select(hwnd, hitem, code) \
  2080.     (HTREEITEM)SendMessage((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2081.  
  2082.  
  2083. #define TreeView_SelectItem(hwnd, hitem)            TreeView_Select(hwnd, hitem, TVGN_CARET)
  2084. #define TreeView_SelectDropTarget(hwnd, hitem)      TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
  2085. #define TreeView_SelectSetFirstVisible(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
  2086.  
  2087.  
  2088. #define TVM_GETITEMA            (TV_FIRST + 12)
  2089. #define TVM_GETITEMW            (TV_FIRST + 62)
  2090.  
  2091. #ifdef UNICODE
  2092. #define  TVM_GETITEM            TVM_GETITEMW
  2093. #else
  2094. #define  TVM_GETITEM            TVM_GETITEMA
  2095. #endif
  2096.  
  2097. #define TreeView_GetItem(hwnd, pitem) \
  2098.     (BOOL)SendMessage((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM FAR*)(pitem))
  2099.  
  2100.  
  2101. #define TVM_SETITEMA            (TV_FIRST + 13)
  2102. #define TVM_SETITEMW            (TV_FIRST + 63)
  2103.  
  2104. #ifdef UNICODE
  2105. #define  TVM_SETITEM            TVM_SETITEMW
  2106. #else
  2107. #define  TVM_SETITEM            TVM_SETITEMA
  2108. #endif
  2109.  
  2110. #define TreeView_SetItem(hwnd, pitem) \
  2111.     (BOOL)SendMessage((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM FAR*)(pitem))
  2112.  
  2113.  
  2114. #define TVM_EDITLABELA          (TV_FIRST + 14)
  2115. #define TVM_EDITLABELW          (TV_FIRST + 65)
  2116. #ifdef UNICODE
  2117. #define TVM_EDITLABEL           TVM_EDITLABELW
  2118. #else
  2119. #define TVM_EDITLABEL           TVM_EDITLABELA
  2120. #endif
  2121.  
  2122. #define TreeView_EditLabel(hwnd, hitem) \
  2123.     (HWND)SendMessage((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
  2124.  
  2125.  
  2126. #define TVM_GETEDITCONTROL      (TV_FIRST + 15)
  2127. #define TreeView_GetEditControl(hwnd) \
  2128.     (HWND)SendMessage((hwnd), TVM_GETEDITCONTROL, 0, 0)
  2129.  
  2130.  
  2131. #define TVM_GETVISIBLECOUNT     (TV_FIRST + 16)
  2132. #define TreeView_GetVisibleCount(hwnd) \
  2133.     (UINT)SendMessage((hwnd), TVM_GETVISIBLECOUNT, 0, 0)
  2134.  
  2135.  
  2136. #define TVM_HITTEST             (TV_FIRST + 17)
  2137. #define TreeView_HitTest(hwnd, lpht) \
  2138.     (HTREEITEM)SendMessage((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
  2139.  
  2140.  
  2141. typedef struct _TV_HITTESTINFO {
  2142.     POINT       pt;
  2143.     UINT        flags;
  2144.     HTREEITEM   hItem;
  2145. } TV_HITTESTINFO, FAR *LPTV_HITTESTINFO;
  2146.  
  2147. #define TVHT_NOWHERE            0x0001
  2148. #define TVHT_ONITEMICON         0x0002
  2149. #define TVHT_ONITEMLABEL        0x0004
  2150. #define TVHT_ONITEM             (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
  2151. #define TVHT_ONITEMINDENT       0x0008
  2152. #define TVHT_ONITEMBUTTON       0x0010
  2153. #define TVHT_ONITEMRIGHT        0x0020
  2154. #define TVHT_ONITEMSTATEICON    0x0040
  2155.  
  2156. #define TVHT_ABOVE              0x0100
  2157. #define TVHT_BELOW              0x0200
  2158. #define TVHT_TORIGHT            0x0400
  2159. #define TVHT_TOLEFT             0x0800
  2160.  
  2161.  
  2162. #define TVM_CREATEDRAGIMAGE     (TV_FIRST + 18)
  2163. #define TreeView_CreateDragImage(hwnd, hitem) \
  2164.     (HIMAGELIST)SendMessage((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem))
  2165.  
  2166.  
  2167. #define TVM_SORTCHILDREN        (TV_FIRST + 19)
  2168. #define TreeView_SortChildren(hwnd, hitem, recurse) \
  2169.     (BOOL)SendMessage((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem))
  2170.  
  2171.  
  2172. #define TVM_ENSUREVISIBLE       (TV_FIRST + 20)
  2173. #define TreeView_EnsureVisible(hwnd, hitem) \
  2174.     (BOOL)SendMessage((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem))
  2175.  
  2176.  
  2177. #define TVM_SORTCHILDRENCB      (TV_FIRST + 21)
  2178. #define TreeView_SortChildrenCB(hwnd, psort, recurse) \
  2179.     (BOOL)SendMessage((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \
  2180.     (LPARAM)(LPTV_SORTCB)(psort))
  2181.  
  2182.  
  2183. #define TVM_ENDEDITLABELNOW     (TV_FIRST + 22)
  2184. #define TreeView_EndEditLabelNow(hwnd, fCancel) \
  2185.     (BOOL)SendMessage((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0)
  2186.  
  2187.  
  2188. #define TVM_GETISEARCHSTRINGA   (TV_FIRST + 23)
  2189. #define TVM_GETISEARCHSTRINGW   (TV_FIRST + 64)
  2190.  
  2191. #ifdef UNICODE
  2192. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGW
  2193. #else
  2194. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGA
  2195. #endif
  2196.  
  2197. #define TreeView_GetISearchString(hwndTV, lpsz) \
  2198.         (BOOL)SendMessage((hwndTV), TVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  2199.  
  2200.  
  2201. typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  2202. typedef struct _TV_SORTCB
  2203. {
  2204.         HTREEITEM       hParent;
  2205.         PFNTVCOMPARE    lpfnCompare;
  2206.         LPARAM          lParam;
  2207. } TV_SORTCB, FAR *LPTV_SORTCB;
  2208.  
  2209.  
  2210. typedef struct _NM_TREEVIEWA {
  2211.     NMHDR       hdr;
  2212.     UINT        action;
  2213.     TV_ITEMA    itemOld;
  2214.     TV_ITEMA    itemNew;
  2215.     POINT       ptDrag;
  2216. } NM_TREEVIEWA, FAR *LPNM_TREEVIEWA;
  2217.  
  2218. typedef struct _NM_TREEVIEWW {
  2219.     NMHDR       hdr;
  2220.     UINT        action;
  2221.     TV_ITEMW    itemOld;
  2222.     TV_ITEMW    itemNew;
  2223.     POINT       ptDrag;
  2224. } NM_TREEVIEWW, FAR *LPNM_TREEVIEWW;
  2225.  
  2226. #ifdef UNICODE
  2227. #define  NM_TREEVIEW            NM_TREEVIEWW
  2228. #define  LPNM_TREEVIEW          LPNM_TREEVIEWW
  2229. #else
  2230. #define  NM_TREEVIEW            NM_TREEVIEWA
  2231. #define  LPNM_TREEVIEW          LPNM_TREEVIEWA
  2232. #endif
  2233.  
  2234. #define TVN_SELCHANGINGA        (TVN_FIRST-1)
  2235. #define TVN_SELCHANGINGW        (TVN_FIRST-50)
  2236. #define TVN_SELCHANGEDA         (TVN_FIRST-2)
  2237. #define TVN_SELCHANGEDW         (TVN_FIRST-51)
  2238.  
  2239. #define TVC_UNKNOWN             0x0000
  2240. #define TVC_BYMOUSE             0x0001
  2241. #define TVC_BYKEYBOARD          0x0002
  2242.  
  2243. #define TVN_GETDISPINFOA        (TVN_FIRST-3)
  2244. #define TVN_GETDISPINFOW        (TVN_FIRST-52)
  2245. #define TVN_SETDISPINFOA        (TVN_FIRST-4)
  2246. #define TVN_SETDISPINFOW        (TVN_FIRST-53)
  2247.  
  2248. #define TVIF_DI_SETITEM         0x1000
  2249.  
  2250. typedef struct _TV_DISPINFOA {
  2251.     NMHDR hdr;
  2252.     TV_ITEMA item;
  2253. } TV_DISPINFOA;
  2254.  
  2255. typedef struct _TV_DISPINFOW {
  2256.     NMHDR hdr;
  2257.     TV_ITEMW item;
  2258. } TV_DISPINFOW;
  2259.  
  2260. #ifdef UNICODE
  2261. #   define  TV_DISPINFO TV_DISPINFOW
  2262. #else
  2263. #   define  TV_DISPINFO TV_DISPINFOA
  2264. #endif
  2265.  
  2266. #define TVN_ITEMEXPANDINGA      (TVN_FIRST-5)
  2267. #define TVN_ITEMEXPANDINGW      (TVN_FIRST-54)
  2268. #define TVN_ITEMEXPANDEDA       (TVN_FIRST-6)
  2269. #define TVN_ITEMEXPANDEDW       (TVN_FIRST-55)
  2270. #define TVN_BEGINDRAGA          (TVN_FIRST-7)
  2271. #define TVN_BEGINDRAGW          (TVN_FIRST-56)
  2272. #define TVN_BEGINRDRAGA         (TVN_FIRST-8)
  2273. #define TVN_BEGINRDRAGW         (TVN_FIRST-57)
  2274. #define TVN_DELETEITEMA         (TVN_FIRST-9)
  2275. #define TVN_DELETEITEMW         (TVN_FIRST-58)
  2276. #define TVN_BEGINLABELEDITA     (TVN_FIRST-10)
  2277. #define TVN_BEGINLABELEDITW     (TVN_FIRST-59)
  2278. #define TVN_ENDLABELEDITA       (TVN_FIRST-11)
  2279. #define TVN_ENDLABELEDITW       (TVN_FIRST-60)
  2280. #define TVN_KEYDOWN             (TVN_FIRST-12)
  2281.  
  2282. typedef struct _TV_KEYDOWN {
  2283.     NMHDR hdr;
  2284.     WORD wVKey;
  2285.     UINT flags;
  2286. } TV_KEYDOWN;
  2287.  
  2288. #ifdef UNICODE
  2289. #define TVN_SELCHANGING         TVN_SELCHANGINGW
  2290. #define TVN_SELCHANGED          TVN_SELCHANGEDW
  2291. #define TVN_GETDISPINFO         TVN_GETDISPINFOW
  2292. #define TVN_SETDISPINFO         TVN_SETDISPINFOW
  2293. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGW
  2294. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDW
  2295. #define TVN_BEGINDRAG           TVN_BEGINDRAGW
  2296. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGW
  2297. #define TVN_DELETEITEM          TVN_DELETEITEMW
  2298. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITW
  2299. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITW
  2300. #else
  2301. #define TVN_SELCHANGING         TVN_SELCHANGINGA
  2302. #define TVN_SELCHANGED          TVN_SELCHANGEDA
  2303. #define TVN_GETDISPINFO         TVN_GETDISPINFOA
  2304. #define TVN_SETDISPINFO         TVN_SETDISPINFOA
  2305. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGA
  2306. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDA
  2307. #define TVN_BEGINDRAG           TVN_BEGINDRAGA
  2308. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGA
  2309. #define TVN_DELETEITEM          TVN_DELETEITEMA
  2310. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITA
  2311. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITA
  2312. #endif
  2313.  
  2314. #endif
  2315.  
  2316.  
  2317. //====== TAB CONTROL ==========================================================
  2318.  
  2319. #ifndef NOTABCONTROL
  2320.  
  2321. #ifdef _WIN32
  2322.  
  2323. #define WC_TABCONTROLA          "SysTabControl32"
  2324. #define WC_TABCONTROLW          L"SysTabControl32"
  2325.  
  2326. #ifdef UNICODE
  2327. #define  WC_TABCONTROL          WC_TABCONTROLW
  2328. #else
  2329. #define  WC_TABCONTROL          WC_TABCONTROLA
  2330. #endif
  2331.  
  2332. #else
  2333. #define WC_TABCONTROL           "SysTabControl"
  2334. #endif
  2335.  
  2336.  
  2337. #define TCS_FORCEICONLEFT       0x0010
  2338. #define TCS_FORCELABELLEFT      0x0020
  2339. #define TCS_TABS                0x0000
  2340. #define TCS_BUTTONS             0x0100
  2341. #define TCS_SINGLELINE          0x0000
  2342. #define TCS_MULTILINE           0x0200
  2343. #define TCS_RIGHTJUSTIFY        0x0000
  2344. #define TCS_FIXEDWIDTH          0x0400
  2345. #define TCS_RAGGEDRIGHT         0x0800
  2346. #define TCS_FOCUSONBUTTONDOWN   0x1000
  2347. #define TCS_OWNERDRAWFIXED      0x2000
  2348. #define TCS_TOOLTIPS            0x4000
  2349. #define TCS_FOCUSNEVER          0x8000
  2350.  
  2351.  
  2352. #define TCM_FIRST               0x1300
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358. #define TCM_GETIMAGELIST        (TCM_FIRST + 2)
  2359. #define TabCtrl_GetImageList(hwnd) \
  2360.     (HIMAGELIST)SendMessage((hwnd), TCM_GETIMAGELIST, 0, 0L)
  2361.  
  2362.  
  2363. #define TCM_SETIMAGELIST        (TCM_FIRST + 3)
  2364. #define TabCtrl_SetImageList(hwnd, himl) \
  2365.     (HIMAGELIST)SendMessage((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl))
  2366.  
  2367.  
  2368. #define TCM_GETITEMCOUNT        (TCM_FIRST + 4)
  2369. #define TabCtrl_GetItemCount(hwnd) \
  2370.     (int)SendMessage((hwnd), TCM_GETITEMCOUNT, 0, 0L)
  2371.  
  2372.  
  2373.  
  2374. #define TCIF_TEXT               0x0001
  2375. #define TCIF_IMAGE              0x0002
  2376. #define TCIF_RTLREADING         0x0004
  2377. #define TCIF_PARAM              0x0008
  2378.  
  2379.  
  2380. typedef struct _TC_ITEMHEADERA
  2381. {
  2382.     UINT mask;
  2383.     UINT lpReserved1;
  2384.     UINT lpReserved2;
  2385.     LPSTR pszText;
  2386.     int cchTextMax;
  2387.     int iImage;
  2388. } TC_ITEMHEADERA;
  2389.  
  2390. typedef struct _TC_ITEMHEADERW
  2391. {
  2392.     UINT mask;
  2393.     UINT lpReserved1;
  2394.     UINT lpReserved2;
  2395.     LPWSTR pszText;
  2396.     int cchTextMax;
  2397.     int iImage;
  2398. } TC_ITEMHEADERW;
  2399.  
  2400. #ifdef UNICODE
  2401. #define  TC_ITEMHEADER          TC_ITEMHEADERW
  2402. #else
  2403. #define  TC_ITEMHEADER          TC_ITEMHEADERA
  2404. #endif
  2405.  
  2406.  
  2407. typedef struct _TC_ITEMA
  2408. {
  2409.     UINT mask;
  2410.     UINT lpReserved1;
  2411.     UINT lpReserved2;
  2412.     LPSTR pszText;
  2413.     int cchTextMax;
  2414.     int iImage;
  2415.  
  2416.     LPARAM lParam;
  2417. } TC_ITEMA;
  2418.  
  2419. typedef struct _TC_ITEMW
  2420. {
  2421.     UINT mask;
  2422.     UINT lpReserved1;
  2423.     UINT lpReserved2;
  2424.     LPWSTR pszText;
  2425.     int cchTextMax;
  2426.     int iImage;
  2427.  
  2428.     LPARAM lParam;
  2429. } TC_ITEMW;
  2430.  
  2431. #ifdef UNICODE
  2432. #define  TC_ITEM                TC_ITEMW
  2433. #else
  2434. #define  TC_ITEM                TC_ITEMA
  2435. #endif
  2436.  
  2437.  
  2438. #define TCM_GETITEMA            (TCM_FIRST + 5)
  2439. #define TCM_GETITEMW            (TCM_FIRST + 60)
  2440.  
  2441. #ifdef UNICODE
  2442. #define TCM_GETITEM             TCM_GETITEMW
  2443. #else
  2444. #define TCM_GETITEM             TCM_GETITEMA
  2445. #endif
  2446.  
  2447. #define TabCtrl_GetItem(hwnd, iItem, pitem) \
  2448.     (BOOL)SendMessage((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  2449.  
  2450.  
  2451. #define TCM_SETITEMA            (TCM_FIRST + 6)
  2452. #define TCM_SETITEMW            (TCM_FIRST + 61)
  2453.  
  2454. #ifdef UNICODE
  2455. #define TCM_SETITEM             TCM_SETITEMW
  2456. #else
  2457. #define TCM_SETITEM             TCM_SETITEMA
  2458. #endif
  2459.  
  2460. #define TabCtrl_SetItem(hwnd, iItem, pitem) \
  2461.     (BOOL)SendMessage((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  2462.  
  2463.  
  2464. #define TCM_INSERTITEMA         (TCM_FIRST + 7)
  2465. #define TCM_INSERTITEMW         (TCM_FIRST + 62)
  2466.  
  2467. #ifdef UNICODE
  2468. #define TCM_INSERTITEM          TCM_INSERTITEMW
  2469. #else
  2470. #define TCM_INSERTITEM          TCM_INSERTITEMA
  2471. #endif
  2472.  
  2473. #define TabCtrl_InsertItem(hwnd, iItem, pitem)   \
  2474.     (int)SendMessage((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem))
  2475.  
  2476.  
  2477. #define TCM_DELETEITEM          (TCM_FIRST + 8)
  2478. #define TabCtrl_DeleteItem(hwnd, i) \
  2479.     (BOOL)SendMessage((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L)
  2480.  
  2481.  
  2482. #define TCM_DELETEALLITEMS      (TCM_FIRST + 9)
  2483. #define TabCtrl_DeleteAllItems(hwnd) \
  2484.     (BOOL)SendMessage((hwnd), TCM_DELETEALLITEMS, 0, 0L)
  2485.  
  2486.  
  2487. #define TCM_GETITEMRECT         (TCM_FIRST + 10)
  2488. #define TabCtrl_GetItemRect(hwnd, i, prc) \
  2489.     (BOOL)SendMessage((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc))
  2490.  
  2491.  
  2492. #define TCM_GETCURSEL           (TCM_FIRST + 11)
  2493. #define TabCtrl_GetCurSel(hwnd) \
  2494.     (int)SendMessage((hwnd), TCM_GETCURSEL, 0, 0)
  2495.  
  2496.  
  2497. #define TCM_SETCURSEL           (TCM_FIRST + 12)
  2498. #define TabCtrl_SetCurSel(hwnd, i) \
  2499.     (int)SendMessage((hwnd), TCM_SETCURSEL, (WPARAM)i, 0)
  2500.  
  2501.  
  2502. #define TCHT_NOWHERE            0x0001
  2503. #define TCHT_ONITEMICON         0x0002
  2504. #define TCHT_ONITEMLABEL        0x0004
  2505. #define TCHT_ONITEM             (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
  2506.  
  2507.  
  2508. typedef struct _TC_HITTESTINFO
  2509. {
  2510.     POINT pt;
  2511.     UINT flags;
  2512. } TC_HITTESTINFO, FAR * LPTC_HITTESTINFO;
  2513.  
  2514.  
  2515. #define TCM_HITTEST             (TCM_FIRST + 13)
  2516. #define TabCtrl_HitTest(hwndTC, pinfo) \
  2517.     (int)SendMessage((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
  2518.  
  2519.  
  2520. #define TCM_SETITEMEXTRA        (TCM_FIRST + 14)
  2521. #define TabCtrl_SetItemExtra(hwndTC, cb) \
  2522.     (BOOL)SendMessage((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L)
  2523.  
  2524.  
  2525. #define TCM_ADJUSTRECT          (TCM_FIRST + 40)
  2526. #define TabCtrl_AdjustRect(hwnd, bLarger, prc) \
  2527.     (int)SendMessage(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT FAR *)prc)
  2528.  
  2529.  
  2530. #define TCM_SETITEMSIZE         (TCM_FIRST + 41)
  2531. #define TabCtrl_SetItemSize(hwnd, x, y) \
  2532.     (DWORD)SendMessage((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y))
  2533.  
  2534.  
  2535. #define TCM_REMOVEIMAGE         (TCM_FIRST + 42)
  2536. #define TabCtrl_RemoveImage(hwnd, i) \
  2537.         (void)SendMessage((hwnd), TCM_REMOVEIMAGE, i, 0L)
  2538.  
  2539.  
  2540. #define TCM_SETPADDING          (TCM_FIRST + 43)
  2541. #define TabCtrl_SetPadding(hwnd,  cx, cy) \
  2542.         (void)SendMessage((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy))
  2543.  
  2544.  
  2545. #define TCM_GETROWCOUNT         (TCM_FIRST + 44)
  2546. #define TabCtrl_GetRowCount(hwnd) \
  2547.         (int)SendMessage((hwnd), TCM_GETROWCOUNT, 0, 0L)
  2548.  
  2549.  
  2550. #define TCM_GETTOOLTIPS         (TCM_FIRST + 45)
  2551. #define TabCtrl_GetToolTips(hwnd) \
  2552.         (HWND)SendMessage((hwnd), TCM_GETTOOLTIPS, 0, 0L)
  2553.  
  2554.  
  2555. #define TCM_SETTOOLTIPS         (TCM_FIRST + 46)
  2556. #define TabCtrl_SetToolTips(hwnd, hwndTT) \
  2557.         (void)SendMessage((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0L)
  2558.  
  2559.  
  2560. #define TCM_GETCURFOCUS         (TCM_FIRST + 47)
  2561. #define TabCtrl_GetCurFocus(hwnd) \
  2562.     (int)SendMessage((hwnd), TCM_GETCURFOCUS, 0, 0)
  2563.  
  2564. #define TCM_SETCURFOCUS         (TCM_FIRST + 48)
  2565. #define TabCtrl_SetCurFocus(hwnd, i) \
  2566.     SendMessage((hwnd),TCM_SETCURFOCUS, i, 0)
  2567.  
  2568.  
  2569. #define TCN_KEYDOWN             (TCN_FIRST - 0)
  2570. typedef struct _TC_KEYDOWN
  2571. {
  2572.     NMHDR hdr;
  2573.     WORD wVKey;
  2574.     UINT flags;
  2575. } TC_KEYDOWN;
  2576.  
  2577. #define TCN_SELCHANGE           (TCN_FIRST - 1)
  2578. #define TCN_SELCHANGING         (TCN_FIRST - 2)
  2579.  
  2580. #endif
  2581.  
  2582.  
  2583. //====== ANIMATE CONTROL ======================================================
  2584.  
  2585. #ifndef NOANIMATE
  2586.  
  2587. #ifdef _WIN32
  2588.  
  2589. #define ANIMATE_CLASSW          L"SysAnimate32"
  2590. #define ANIMATE_CLASSA          "SysAnimate32"
  2591.  
  2592. #ifdef UNICODE
  2593. #define ANIMATE_CLASS           ANIMATE_CLASSW
  2594. #else
  2595. #define ANIMATE_CLASS           ANIMATE_CLASSA
  2596. #endif
  2597.  
  2598. #define ACS_CENTER              0x0001
  2599. #define ACS_TRANSPARENT         0x0002
  2600. #define ACS_AUTOPLAY            0x0004
  2601.  
  2602.  
  2603. #define ACM_OPENA               (WM_USER+100)
  2604. #define ACM_OPENW               (WM_USER+103)
  2605.  
  2606. #ifdef UNICODE
  2607. #define ACM_OPEN                ACM_OPENW
  2608. #else
  2609. #define ACM_OPEN                ACM_OPENA
  2610. #endif
  2611.  
  2612. #define ACM_PLAY                (WM_USER+101)
  2613. #define ACM_STOP                (WM_USER+102)
  2614.  
  2615.  
  2616. #define ACN_START               1
  2617. #define ACN_STOP                2
  2618.  
  2619.  
  2620. #define Animate_Create(hwndP, id, dwStyle, hInstance)   \
  2621.             CreateWindow(ANIMATE_CLASS, NULL,           \
  2622.                 dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), hInstance, NULL)
  2623.  
  2624. #define Animate_Open(hwnd, szName)          (BOOL)SendMessage(hwnd, ACM_OPEN, 0, (LPARAM)(LPTSTR)(szName))
  2625. #define Animate_Play(hwnd, from, to, rep)   (BOOL)SendMessage(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), (LPARAM)MAKELONG(from, to))
  2626. #define Animate_Stop(hwnd)                  (BOOL)SendMessage(hwnd, ACM_STOP, 0, 0)
  2627. #define Animate_Close(hwnd)                 Animate_Open(hwnd, NULL)
  2628. #define Animate_Seek(hwnd, frame)           Animate_Play(hwnd, frame, frame, 1)
  2629. #endif
  2630.  
  2631. #endif
  2632.  
  2633.  
  2634. #endif // (WINVER >= 0x0400)
  2635.  
  2636. #ifdef __cplusplus
  2637. }
  2638. #endif
  2639.  
  2640. #ifdef _WIN32
  2641. #include <poppack.h>
  2642. #endif
  2643.  
  2644. #endif
  2645.  
  2646. #endif
  2647.