home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1998 October / dpcb1098.iso / Business / Maxim / MAX5 / data.z / COMMCTRL.H < prev    next >
C/C++ Source or Header  |  1998-05-15  |  131KB  |  4,081 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * commctrl.h - - Interface for the Windows Common Controls                    *
  4. *                                                                             *
  5. * Version 1.2                                                                 *
  6. *                                                                             *
  7. * Copyright (c) 1991-1996, Microsoft Corp.      All rights reserved.          *
  8. *                                                                             *
  9. \*****************************************************************************/
  10.  
  11.  
  12. #ifndef _INC_COMMCTRL
  13. #define _INC_COMMCTRL
  14.  
  15. #ifndef NOUSER
  16.  
  17.  
  18. //
  19. // Define API decoration for direct importing of DLL references.
  20. //
  21. #ifndef WINCOMMCTRLAPI
  22. #if !defined(_COMCTL32_) && defined(_WIN32)
  23. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  24. #else
  25. #define WINCOMMCTRLAPI
  26. #endif
  27. #endif // WINCOMMCTRLAPI
  28.  
  29. //
  30. // For compilers that don't support nameless unions
  31. //
  32. #ifndef DUMMYUNIONNAME
  33. #ifdef NONAMELESSUNION
  34. #define DUMMYUNIONNAME          u
  35. #define DUMMYUNIONNAME2         u2
  36. #define DUMMYUNIONNAME3         u3
  37. #else
  38. #define DUMMYUNIONNAME
  39. #define DUMMYUNIONNAME2
  40. #define DUMMYUNIONNAME3
  41. #endif
  42. #endif // DUMMYUNIONNAME
  43.  
  44. #ifdef _WIN32
  45. #include <pshpack1.h>
  46. #endif
  47.  
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. //
  53. // Users of this header may define any number of these constants to avoid
  54. // the definitions of each functional group.
  55. //
  56. //    NOTOOLBAR    Customizable bitmap-button toolbar control.
  57. //    NOUPDOWN     Up and Down arrow increment/decrement control.
  58. //    NOSTATUSBAR  Status bar control.
  59. //    NOMENUHELP   APIs to help manage menus, especially with a status bar.
  60. //    NOTRACKBAR   Customizable column-width tracking control.
  61. //    NODRAGLIST   APIs to make a listbox source and sink drag&drop actions.
  62. //    NOPROGRESS   Progress gas gauge.
  63. //    NOHOTKEY     HotKey control
  64. //    NOHEADER     Header bar control.
  65. //    NOIMAGEAPIS  ImageList apis.
  66. //    NOLISTVIEW   ListView control.
  67. //    NOTREEVIEW   TreeView control.
  68. //    NOTABCONTROL Tab control.
  69. //    NOANIMATE    Animate control.
  70. //
  71. //=============================================================================
  72.  
  73. #include <prsht.h>
  74.  
  75. #ifndef SNDMSG
  76. #ifdef __cplusplus
  77. #define SNDMSG ::SendMessage
  78. #else
  79. #define SNDMSG SendMessage
  80. #endif
  81. #endif // ifndef SNDMSG
  82.  
  83. WINCOMMCTRLAPI void WINAPI InitCommonControls(void);
  84.  
  85. typedef struct tagINITCOMMONCONTROLSEX {
  86.     DWORD dwSize;             // size of this structure
  87.     DWORD dwICC;              // flags indicating which classes to be initialized
  88. } INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
  89. #define ICC_LISTVIEW_CLASSES 0x00000001 // listview, header
  90. #define ICC_TREEVIEW_CLASSES 0x00000002 // treeview, tooltips
  91. #define ICC_BAR_CLASSES      0x00000004 // toolbar, statusbar, trackbar, tooltips
  92. #define ICC_TAB_CLASSES      0x00000008 // tab, tooltips
  93. #define ICC_UPDOWN_CLASS     0x00000010 // updown
  94. #define ICC_PROGRESS_CLASS   0x00000020 // progress
  95. #define ICC_HOTKEY_CLASS     0x00000040 // hotkey
  96. #define ICC_ANIMATE_CLASS    0x00000080 // animate
  97. #define ICC_WIN95_CLASSES    0x000000FF
  98. #define ICC_DATE_CLASSES     0x00000100 // month picker, date picker, time picker, updown
  99. #define ICC_USEREX_CLASSES   0x00000200 // comboex
  100. #define ICC_COOL_CLASSES     0x00000400 // rebar (coolbar) control
  101. WINCOMMCTRLAPI BOOL WINAPI InitCommonControlsEx(LPINITCOMMONCONTROLSEX);
  102.  
  103. #define ODT_HEADER              100
  104. #define ODT_TAB                 101
  105. #define ODT_LISTVIEW            102
  106.  
  107.  
  108. //====== Ranges for control message IDs =======================================
  109.  
  110. #define LVM_FIRST               0x1000      // ListView messages
  111. #define TV_FIRST                0x1100      // TreeView messages
  112. #define HDM_FIRST               0x1200      // Header messages
  113.  
  114. //====== WM_NOTIFY Macros =====================================================
  115.  
  116. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  117.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  118. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
  119.     (LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR FAR*)(pnmhdr))
  120.  
  121.  
  122. //====== Generic WM_NOTIFY notification codes =================================
  123.  
  124. #define NM_OUTOFMEMORY          (NM_FIRST-1)
  125. #define NM_CLICK                (NM_FIRST-2)
  126. #define NM_DBLCLK               (NM_FIRST-3)
  127. #define NM_RETURN               (NM_FIRST-4)
  128. #define NM_RCLICK               (NM_FIRST-5)
  129. #define NM_RDBLCLK              (NM_FIRST-6)
  130. #define NM_SETFOCUS             (NM_FIRST-7)
  131. #define NM_KILLFOCUS            (NM_FIRST-8)
  132. #define NM_CUSTOMDRAW           (NM_FIRST-12)
  133. #define NM_HOVER                (NM_FIRST-13)
  134.  
  135. //====== WM_NOTIFY codes (NMHDR.code values) ==================================
  136.  
  137. #define NM_FIRST                (0U-  0U)       // generic to all controls
  138. #define NM_LAST                 (0U- 99U)
  139.  
  140. #define LVN_FIRST               (0U-100U)       // listview
  141. #define LVN_LAST                (0U-199U)
  142.  
  143. #define HDN_FIRST               (0U-300U)       // header
  144. #define HDN_LAST                (0U-399U)
  145.  
  146. #define TVN_FIRST               (0U-400U)       // treeview
  147. #define TVN_LAST                (0U-499U)
  148.  
  149. #define TTN_FIRST               (0U-520U)       // tooltips
  150. #define TTN_LAST                (0U-549U)
  151.  
  152. #define TCN_FIRST               (0U-550U)       // tab control
  153. #define TCN_LAST                (0U-580U)
  154.  
  155. // Shell reserved               (0U-580U) -  (0U-589U)
  156.  
  157. #define CDN_FIRST               (0U-601U)       // common dialog (new)
  158. #define CDN_LAST                (0U-699U)
  159.  
  160. #define TBN_FIRST               (0U-700U)       // toolbar
  161. #define TBN_LAST                (0U-720U)
  162.  
  163. #define UDN_FIRST               (0U-721)        // updown
  164. #define UDN_LAST                (0U-740)
  165.  
  166. #define MCN_FIRST               (0U-750U)       // monthcal
  167. #define MCN_LAST                (0U-759U)
  168.  
  169. #define DTN_FIRST               (0U-760U)       // datetimepick
  170. #define DTN_LAST                (0U-799U)
  171.  
  172. #define CBEN_FIRST              (0U-800U)       // combo box ex
  173. #define CBEN_LAST               (0U-830U)
  174.  
  175. #define RBN_FIRST               (0U-831U)       // rebar
  176. #define RBN_LAST                (0U-859U)
  177.  
  178. #define MSGF_COMMCTRL_BEGINDRAG     0x4200
  179. #define MSGF_COMMCTRL_SIZEHEADER    0x4201
  180. #define MSGF_COMMCTRL_DRAGSELECT    0x4202
  181. #define MSGF_COMMCTRL_TOOLBARCUST   0x4203
  182.  
  183.  
  184. //==================== CUSTOM DRAW ==========================================
  185.  
  186.  
  187. // custom draw return flags
  188. // values under 0x00010000 are reserved for global custom draw values.
  189. // above that are for specific controls
  190. #define CDRF_DODEFAULT          0x00000000
  191. #define CDRF_NEWFONT            0x00000002
  192. #define CDRF_SKIPDEFAULT        0x00000004
  193.  
  194.  
  195. #define CDRF_NOTIFYPOSTPAINT    0x00000010
  196. #define CDRF_NOTIFYITEMDRAW     0x00000020
  197. #define CDRF_NOTIFYPOSTERASE    0x00000040
  198. #define CDRF_NOTIFYITEMERASE    0x00000080
  199.  
  200.  
  201.  
  202. // drawstage flags
  203. // values under 0x00010000 are reserved for global custom draw values.
  204. // above that are for specific controls
  205. #define CDDS_PREPAINT           0x00000001
  206. #define CDDS_POSTPAINT          0x00000002
  207. #define CDDS_PREERASE           0x00000003
  208. #define CDDS_POSTERASE          0x00000004
  209. // the 0x000010000 bit means it's individual item specific
  210. #define CDDS_ITEM               0x00010000
  211. #define CDDS_ITEMPREPAINT       (CDDS_ITEM | CDDS_PREPAINT)
  212. #define CDDS_ITEMPOSTPAINT      (CDDS_ITEM | CDDS_POSTPAINT)
  213. #define CDDS_ITEMPREERASE       (CDDS_ITEM | CDDS_PREERASE)
  214. #define CDDS_ITEMPOSTERASE      (CDDS_ITEM | CDDS_POSTERASE)
  215.  
  216.  
  217.  
  218. // itemState flags
  219. #define CDIS_SELECTED    0x0001
  220. #define CDIS_GRAYED      0x0002
  221. #define CDIS_DISABLED    0x0004
  222. #define CDIS_CHECKED     0x0008
  223. #define CDIS_FOCUS       0x0010
  224. #define CDIS_DEFAULT     0x0020
  225. #define CDIS_HOT         0x0040
  226.  
  227. typedef struct tagNMCUSTOMDRAWINFO
  228. {
  229.     NMHDR hdr;
  230.     DWORD dwDrawStage;
  231.     HDC hdc;
  232.     RECT rc;
  233.     DWORD dwItemSpec;  // this is control specific, but it's how to specify an item.  valid only with CDDS_ITEM bit set
  234.     UINT  uItemState;
  235.     LPARAM lItemlParam;
  236. } NMCUSTOMDRAW, FAR * LPNMCUSTOMDRAW;
  237.  
  238.  
  239.  
  240. // for tooltips
  241.  
  242. typedef struct tagNMTTCUSTOMDRAW
  243. {
  244.     NMCUSTOMDRAW nmcd;
  245.     UINT uDrawFlags;
  246. } NMTTCUSTOMDRAW, FAR * LPNMTTCUSTOMDRAW;
  247.  
  248.  
  249.  
  250. //====== IMAGE APIS ===========================================================
  251.  
  252. #ifndef NOIMAGEAPIS
  253.  
  254. #define CLR_NONE                0xFFFFFFFFL
  255. #define CLR_DEFAULT             0xFF000000L
  256.  
  257. struct _IMAGELIST;
  258. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  259.  
  260. typedef struct _IMAGELISTDRAWPARAMS {
  261.     DWORD       cbSize;
  262.     HIMAGELIST  himl;
  263.     int         i;
  264.     HDC         hdcDst;
  265.     int         x;
  266.     int         y;
  267.     int         cx;
  268.     int         cy;
  269.     int         xBitmap;        // x offest from the upperleft of bitmap
  270.     int         yBitmap;        // y offset from the upperleft of bitmap
  271.     COLORREF    rgbBk;
  272.     COLORREF    rgbFg;
  273.     UINT        fStyle;
  274.     DWORD       dwRop;
  275. } IMAGELISTDRAWPARAMS, FAR * LPIMAGELISTDRAWPARAMS;
  276.  
  277.  
  278. #define ILC_MASK                0x0001
  279. #define ILC_COLOR               0x0000
  280. #define ILC_COLORDDB            0x00FE
  281. #define ILC_COLOR4              0x0004
  282. #define ILC_COLOR8              0x0008
  283. #define ILC_COLOR16             0x0010
  284. #define ILC_COLOR24             0x0018
  285. #define ILC_COLOR32             0x0020
  286. #define ILC_PALETTE             0x0800      // (no longer supported...never worked anyway)
  287.  
  288.  
  289. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
  290. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Destroy(HIMAGELIST himl);
  291. WINCOMMCTRLAPI int         WINAPI ImageList_GetImageCount(HIMAGELIST himl);
  292. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetImageCount(HIMAGELIST himl, UINT uNewCount);
  293. WINCOMMCTRLAPI int         WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  294. WINCOMMCTRLAPI int         WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  295. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  296. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_GetBkColor(HIMAGELIST himl);
  297. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  298.  
  299. #define     ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon)
  300.  
  301. #define ILD_NORMAL              0x0000
  302. #define ILD_TRANSPARENT         0x0001
  303. #define ILD_MASK                0x0010
  304. #define ILD_IMAGE               0x0020
  305. #define ILD_ROP                 0x0040
  306. #define ILD_BLEND25             0x0002
  307. #define ILD_BLEND50             0x0004
  308. #define ILD_OVERLAYMASK         0x0F00
  309. #define INDEXTOOVERLAYMASK(i)   ((i) << 8)
  310.  
  311. #define ILD_SELECTED            ILD_BLEND50
  312. #define ILD_FOCUS               ILD_BLEND25
  313. #define ILD_BLEND               ILD_BLEND50
  314. #define CLR_HILIGHT             CLR_DEFAULT
  315.  
  316. WINCOMMCTRLAPI BOOL WINAPI ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle);
  317.  
  318.  
  319. #ifdef _WIN32
  320.  
  321. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask);
  322. WINCOMMCTRLAPI int         WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask);
  323. 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);
  324. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS* pimldp);
  325. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Remove(HIMAGELIST himl, int i);
  326. WINCOMMCTRLAPI HICON       WINAPI ImageList_GetIcon(HIMAGELIST himl, int i, UINT flags);
  327. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageA(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  328. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  329.  
  330. #ifdef UNICODE
  331. #define ImageList_LoadImage     ImageList_LoadImageW
  332. #else
  333. #define ImageList_LoadImage     ImageList_LoadImageA
  334. #endif
  335.  
  336. #define ILCF_MOVE   (0x00000000)
  337. #define ILCF_SWAP   (0x00000001)
  338. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Copy(HIMAGELIST himlDst, int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags);
  339.  
  340. WINCOMMCTRLAPI BOOL        WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot);
  341. WINCOMMCTRLAPI void        WINAPI ImageList_EndDrag();
  342. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragEnter(HWND hwndLock, int x, int y);
  343. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragLeave(HWND hwndLock);
  344. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragMove(int x, int y);
  345. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot);
  346.  
  347. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragShowNolock(BOOL fShow);
  348. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_GetDragImage(POINT FAR* ppt,POINT FAR* pptHotspot);
  349.  
  350. #define     ImageList_RemoveAll(himl) ImageList_Remove(himl, -1)
  351. #define     ImageList_ExtractIcon(hi, himl, i) ImageList_GetIcon(himl, i, 0)
  352. #define     ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask) ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)
  353.  
  354. #ifdef __IStream_INTERFACE_DEFINED__
  355. WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm);
  356. WINCOMMCTRLAPI BOOL       WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
  357. #endif
  358.  
  359. typedef struct _IMAGEINFO
  360. {
  361.     HBITMAP hbmImage;
  362.     HBITMAP hbmMask;
  363.     int     Unused1;
  364.     int     Unused2;
  365.     RECT    rcImage;
  366. } IMAGEINFO, FAR *LPIMAGEINFO;
  367.  
  368. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetIconSize(HIMAGELIST himl, int FAR *cx, int FAR *cy);
  369. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetIconSize(HIMAGELIST himl, int cx, int cy);
  370. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO FAR* pImageInfo);
  371. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
  372.  
  373.  
  374. #endif
  375.  
  376. #endif
  377.  
  378.  
  379. //====== HEADER CONTROL =======================================================
  380.  
  381. #ifndef NOHEADER
  382.  
  383. #ifdef _WIN32
  384. #define WC_HEADERA              "SysHeader32"
  385. #define WC_HEADERW              L"SysHeader32"
  386.  
  387. #ifdef UNICODE
  388. #define WC_HEADER               WC_HEADERW
  389. #else
  390. #define WC_HEADER               WC_HEADERA
  391. #endif
  392.  
  393. #else
  394. #define WC_HEADER               "SysHeader"
  395. #endif
  396.  
  397. #define HDS_HORZ                0x0000
  398. #define HDS_BUTTONS             0x0002
  399. #define HDS_HOTTRACK            0x0004
  400. #define HDS_HIDDEN              0x0008
  401.  
  402.  
  403. #define HDS_DRAGDROP            0x0040
  404. #define HDS_FULLDRAG            0x0080
  405.  
  406. typedef struct _HD_ITEMA
  407. {
  408.     UINT    mask;
  409.     int     cxy;
  410.     LPSTR   pszText;
  411.     HBITMAP hbm;
  412.     int     cchTextMax;
  413.     int     fmt;
  414.     LPARAM  lParam;
  415.     int     iImage;        // index of bitmap in ImageList
  416.     int     iOrder;        // where to draw this item
  417. } HDITEMA, FAR * LPHDITEMA;
  418.  
  419.  
  420.  
  421. typedef struct _HD_ITEMW
  422. {
  423.     UINT    mask;
  424.     int     cxy;
  425.     LPWSTR   pszText;
  426.     HBITMAP hbm;
  427.     int     cchTextMax;
  428.     int     fmt;
  429.     LPARAM  lParam;
  430.     int     iImage;        // index of bitmap in ImageList
  431.     int     iOrder;
  432. } HDITEMW, FAR * LPHDITEMW;
  433.  
  434. #define HD_ITEMA HDITEMA
  435. #define HD_ITEMW HDITEMW
  436.  
  437. #ifdef UNICODE
  438. #define HDITEM HDITEMW
  439. #define LPHDITEM LPHDITEMW
  440. #else
  441. #define HDITEM HDITEMA
  442. #define LPHDITEM LPHDITEMW
  443. #endif
  444.  
  445. #define HD_ITEM HDITEM
  446.  
  447.  
  448. #define HDI_WIDTH               0x0001
  449. #define HDI_HEIGHT              HDI_WIDTH
  450. #define HDI_TEXT                0x0002
  451. #define HDI_FORMAT              0x0004
  452. #define HDI_LPARAM              0x0008
  453. #define HDI_BITMAP              0x0010
  454. #define HDI_IMAGE               0x0020
  455. #define HDI_DI_SETITEM          0x0040
  456. #define HDI_ORDER               0x0080
  457.  
  458. #define HDF_LEFT                0
  459. #define HDF_RIGHT               1
  460. #define HDF_CENTER              2
  461. #define HDF_JUSTIFYMASK         0x0003
  462. #define HDF_RTLREADING          4
  463.  
  464. #define HDF_OWNERDRAW           0x8000
  465. #define HDF_STRING              0x4000
  466. #define HDF_BITMAP              0x2000
  467. #define HDF_BITMAP_ON_RIGHT    0x1000
  468.  
  469. #define HDF_IMAGE               0x0800
  470.  
  471. #define HDM_GETITEMCOUNT        (HDM_FIRST + 0)
  472. #define Header_GetItemCount(hwndHD) \
  473.     (int)SNDMSG((hwndHD), HDM_GETITEMCOUNT, 0, 0L)
  474.  
  475.  
  476. #define HDM_INSERTITEMA         (HDM_FIRST + 1)
  477. #define HDM_INSERTITEMW         (HDM_FIRST + 10)
  478.  
  479. #ifdef UNICODE
  480. #define HDM_INSERTITEM          HDM_INSERTITEMW
  481. #else
  482. #define HDM_INSERTITEM          HDM_INSERTITEMA
  483. #endif
  484.  
  485. #define Header_InsertItem(hwndHD, i, phdi) \
  486.     (int)SNDMSG((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  487.  
  488.  
  489. #define HDM_DELETEITEM          (HDM_FIRST + 2)
  490. #define Header_DeleteItem(hwndHD, i) \
  491.     (BOOL)SNDMSG((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(i), 0L)
  492.  
  493.  
  494. #define HDM_GETITEMA            (HDM_FIRST + 3)
  495. #define HDM_GETITEMW            (HDM_FIRST + 11)
  496.  
  497. #ifdef UNICODE
  498. #define HDM_GETITEM             HDM_GETITEMW
  499. #else
  500. #define HDM_GETITEM             HDM_GETITEMA
  501. #endif
  502.  
  503. #define Header_GetItem(hwndHD, i, phdi) \
  504.     (BOOL)SNDMSG((hwndHD), HDM_GETITEM, (WPARAM)(int)(i), (LPARAM)(HD_ITEM FAR*)(phdi))
  505.  
  506.  
  507. #define HDM_SETITEMA            (HDM_FIRST + 4)
  508. #define HDM_SETITEMW            (HDM_FIRST + 12)
  509.  
  510. #ifdef UNICODE
  511. #define HDM_SETITEM             HDM_SETITEMW
  512. #else
  513. #define HDM_SETITEM             HDM_SETITEMA
  514. #endif
  515.  
  516. #define Header_SetItem(hwndHD, i, phdi) \
  517.     (BOOL)SNDMSG((hwndHD), HDM_SETITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  518.  
  519.  
  520. typedef struct _HD_LAYOUT
  521. {
  522.     RECT FAR* prc;
  523.     WINDOWPOS FAR* pwpos;
  524. } HDLAYOUT, FAR *LPHDLAYOUT;
  525.  
  526. #define HD_LAYOUT               HDLAYOUT
  527.  
  528. #define HDM_LAYOUT              (HDM_FIRST + 5)
  529. #define Header_Layout(hwndHD, playout) \
  530.     (BOOL)SNDMSG((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout))
  531.  
  532.  
  533. #define HHT_NOWHERE             0x0001
  534. #define HHT_ONHEADER            0x0002
  535. #define HHT_ONDIVIDER           0x0004
  536. #define HHT_ONDIVOPEN           0x0008
  537. #define HHT_ABOVE               0x0100
  538. #define HHT_BELOW               0x0200
  539. #define HHT_TORIGHT             0x0400
  540. #define HHT_TOLEFT              0x0800
  541.  
  542. typedef struct _HD_HITTESTINFO
  543. {
  544.     POINT pt;
  545.     UINT flags;
  546.     int iItem;
  547. } HDHITTESTINFO, FAR *LPHDHITTESTINFO;
  548.  
  549. #define HD_HITTESTINFO HDHITTESTINFO
  550.  
  551.  
  552. #define HDM_HITTEST             (HDM_FIRST + 6)
  553.  
  554. #define HDM_GETITEMRECT         (HDM_FIRST + 7)
  555. #define Header_GetItemRect(hwnd, iItem, lprc) \
  556.         (BOOL)SNDMSG((hwnd), HDM_GETITEMRECT, (WPARAM)iItem, (LPARAM)lprc)
  557.  
  558. #define HDM_SETIMAGELIST        (HDM_FIRST + 8)
  559. #define Header_SetImageList(hwnd, himl) \
  560.         (HIMAGELIST)SNDMSG((hwnd), HDM_SETIMAGELIST, 0, (LPARAM)himl)
  561.  
  562. #define HDM_GETIMAGELIST        (HDM_FIRST + 9)
  563. #define Header_GetImageList(hwnd) \
  564.         (HIMAGELIST)SNDMSG((hwnd), HDM_GETIMAGELIST, 0, 0)
  565.  
  566.  
  567. #define HDM_ORDERTOINDEX        (HDM_FIRST + 15)
  568. #define Header_OrderToIndex(hwnd, i) \
  569.         (int)SNDMSG((hwnd), HDM_ORDERTOINDEX, (WPARAM)i, 0)
  570.  
  571. #define HDM_CREATEDRAGIMAGE     (HDM_FIRST + 16)  // wparam = which item (by index)
  572. #define Header_CreateDragImage(hwnd, i) \
  573.         (HIMAGELIST)SNDMSG((hwnd), HDM_CREATEDRAGIMAGE, (WPARAM)i, 0)
  574.  
  575. #define HDM_GETORDERARRAY       (HDM_FIRST + 17)
  576. #define Header_GetOrderArray(hwnd, iCount, lpi) \
  577.         (BOOL)SNDMSG((hwnd), HDM_GETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)
  578.  
  579. #define HDM_SETORDERARRAY       (HDM_FIRST + 18)
  580. #define Header_SetOrderArray(hwnd, iCount, lpi) \
  581.         (BOOL)SNDMSG((hwnd), HDM_SETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)
  582. // lparam = int array of size HDM_GETITEMCOUNT
  583. // the array specifies the order that all items should be displayed.
  584. // e.g.  { 2, 0, 1}
  585. // says the index 2 item should be shown in the 0ths position
  586. //      index 0 should be shown in the 1st position
  587. //      index 1 should be shown in the 2nd position
  588.  
  589.  
  590. #define HDM_SETHOTDIVIDER          (HDM_FIRST + 19)
  591. #define Header_SetHotDivider(hwnd, fPos, dw) \
  592.         (int)SNDMSG((hwnd), HDM_SETHOTDIVIDER, (WPARAM)fPos, (LPARAM)dw)
  593. // convenience message for external dragdrop
  594. // wParam = BOOL  specifying whether the lParam is a dwPos of the cursor
  595. //              position or the index of which divider to hotlight
  596. // lParam = depends on wParam  (-1 and wParm = FALSE turns off hotlight)
  597.  
  598. #define HDN_ITEMCHANGINGA       (HDN_FIRST-0)
  599. #define HDN_ITEMCHANGINGW       (HDN_FIRST-20)
  600. #define HDN_ITEMCHANGEDA        (HDN_FIRST-1)
  601. #define HDN_ITEMCHANGEDW        (HDN_FIRST-21)
  602. #define HDN_ITEMCLICKA          (HDN_FIRST-2)
  603. #define HDN_ITEMCLICKW          (HDN_FIRST-22)
  604. #define HDN_ITEMDBLCLICKA       (HDN_FIRST-3)
  605. #define HDN_ITEMDBLCLICKW       (HDN_FIRST-23)
  606. #define HDN_DIVIDERDBLCLICKA    (HDN_FIRST-5)
  607. #define HDN_DIVIDERDBLCLICKW    (HDN_FIRST-25)
  608. #define HDN_BEGINTRACKA         (HDN_FIRST-6)
  609. #define HDN_BEGINTRACKW         (HDN_FIRST-26)
  610. #define HDN_ENDTRACKA           (HDN_FIRST-7)
  611. #define HDN_ENDTRACKW           (HDN_FIRST-27)
  612. #define HDN_TRACKA              (HDN_FIRST-8)
  613. #define HDN_TRACKW              (HDN_FIRST-28)
  614. #define HDN_GETDISPINFOA        (HDN_FIRST-9)
  615. #define HDN_GETDISPINFOW        (HDN_FIRST-29)
  616. #define HDN_BEGINDRAG           (HDN_FIRST-10)
  617. #define HDN_ENDDRAG             (HDN_FIRST-11)
  618.  
  619. #ifdef UNICODE
  620. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGW
  621. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDW
  622. #define HDN_ITEMCLICK            HDN_ITEMCLICKW
  623. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKW
  624. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKW
  625. #define HDN_BEGINTRACK           HDN_BEGINTRACKW
  626. #define HDN_ENDTRACK             HDN_ENDTRACKW
  627. #define HDN_TRACK                HDN_TRACKW
  628. #define HDN_GETDISPINFO          HDN_GETDISPINFOW
  629. #else
  630. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGA
  631. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDA
  632. #define HDN_ITEMCLICK            HDN_ITEMCLICKA
  633. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKA
  634. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKA
  635. #define HDN_BEGINTRACK           HDN_BEGINTRACKA
  636. #define HDN_ENDTRACK             HDN_ENDTRACKA
  637. #define HDN_TRACK                HDN_TRACKA
  638. #define HDN_GETDISPINFO          HDN_GETDISPINFOA
  639. #endif
  640.  
  641.  
  642. typedef struct tagNMHEADERA
  643. {
  644.     NMHDR   hdr;
  645.     int     iItem;
  646.     int     iButton;
  647.     HDITEMA FAR* pitem;
  648. }  NMHEADERA, FAR* LPNMHEADERA;
  649.  
  650.  
  651. typedef struct tagNMHEADERW
  652. {
  653.     NMHDR   hdr;
  654.     int     iItem;
  655.     int     iButton;
  656.     HDITEMW FAR* pitem;
  657. } NMHEADERW, FAR* LPNMHEADERW;
  658.  
  659.  
  660. #ifdef UNICODE
  661. #define NMHEADER                NMHEADERW
  662. #define LPNMHEADER              LPNMHEADERW
  663. #else
  664. #define NMHEADER                NMHEADERA
  665. #define LPNMHEADER              LPNMHEADERA
  666. #endif
  667.  
  668.  
  669. #define HD_NOTIFYA              NMHEADERA
  670. #define HD_NOTIFYW              NMHEADERW
  671. #define HD_NOTIFY               NMHEADER
  672.  
  673.  
  674. typedef struct tagNMHDDISPINFOW
  675. {
  676.     NMHDR   hdr;
  677.     int     iItem;
  678.     UINT    mask;
  679.     LPWSTR  pszText;
  680.     int     cchTextMax;
  681.     int     iImage;
  682.     LPARAM  lParam;
  683. } NMHDDISPINFOW, FAR* LPNMHDDISPINFOW;
  684.  
  685. typedef struct tagNMHDDISPINFOA
  686. {
  687.     NMHDR   hdr;
  688.     int     iItem;
  689.     UINT    mask;
  690.     LPSTR   pszText;
  691.     int     cchTextMax;
  692.     int     iImage;
  693.     LPARAM  lParam;
  694. } NMHDDISPINFOA, FAR* LPNMHDDISPINFOA;
  695.  
  696.  
  697. #ifdef UNICODE
  698. #define NMHDDISPINFO            NMHDDISPINFOW
  699. #define LPNMHDDISPINFO          LPNMHDDISPINFOW
  700. #else
  701. #define NMHDDISPINFO            NMHDDISPINFOA
  702. #define LPNMHDDISPINFO          LPNMHDDISPINFOA
  703. #endif
  704.  
  705. #endif
  706.  
  707.  
  708. //====== TOOLBAR CONTROL ======================================================
  709.  
  710. #ifndef NOTOOLBAR
  711.  
  712. #ifdef _WIN32
  713. #define TOOLBARCLASSNAMEW       L"ToolbarWindow32"
  714. #define TOOLBARCLASSNAMEA       "ToolbarWindow32"
  715.  
  716. #ifdef  UNICODE
  717. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEW
  718. #else
  719. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEA
  720. #endif
  721.  
  722. #else
  723. #define TOOLBARCLASSNAME        "ToolbarWindow"
  724. #endif
  725.  
  726. typedef struct _TBBUTTON {
  727.     int iBitmap;
  728.     int idCommand;
  729.     BYTE fsState;
  730.     BYTE fsStyle;
  731. #ifdef _WIN32
  732.     BYTE bReserved[2];
  733. #endif
  734.     DWORD dwData;
  735.     int iString;
  736. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  737. typedef const TBBUTTON FAR* LPCTBBUTTON;
  738.  
  739.  
  740. typedef struct _COLORMAP {
  741.     COLORREF from;
  742.     COLORREF to;
  743. } COLORMAP, FAR* LPCOLORMAP;
  744.  
  745. WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  746.                         HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  747.                         int iNumButtons, int dxButton, int dyButton,
  748.                         int dxBitmap, int dyBitmap, UINT uStructSize);
  749.  
  750. WINCOMMCTRLAPI HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, int idBitmap,
  751.                                   UINT wFlags, LPCOLORMAP lpColorMap,
  752.                                   int iNumMaps);
  753.  
  754. #define CMB_MASKED              0x02
  755.  
  756. #define TBSTATE_CHECKED         0x01
  757. #define TBSTATE_PRESSED         0x02
  758. #define TBSTATE_ENABLED         0x04
  759. #define TBSTATE_HIDDEN          0x08
  760. #define TBSTATE_INDETERMINATE   0x10
  761. #define TBSTATE_WRAP            0x20
  762. #define TBSTATE_ELLIPSES        0x40
  763.  
  764.  
  765. #define TBSTYLE_BUTTON          0x00
  766. #define TBSTYLE_SEP             0x01
  767. #define TBSTYLE_CHECK           0x02
  768. #define TBSTYLE_GROUP           0x04
  769. #define TBSTYLE_CHECKGROUP      (TBSTYLE_GROUP | TBSTYLE_CHECK)
  770. #define TBSTYLE_DROPDOWN        0x08
  771.  
  772. #define TBSTYLE_TOOLTIPS        0x0100
  773. #define TBSTYLE_WRAPABLE        0x0200
  774. #define TBSTYLE_ALTDRAG         0x0400
  775. #define TBSTYLE_FLAT            0x0800
  776. #define TBSTYLE_LIST            0x1000
  777. #define TBSTYLE_CUSTOMERASE     0x2000
  778.  
  779. #define TB_ENABLEBUTTON         (WM_USER + 1)
  780. #define TB_CHECKBUTTON          (WM_USER + 2)
  781. #define TB_PRESSBUTTON          (WM_USER + 3)
  782. #define TB_HIDEBUTTON           (WM_USER + 4)
  783. #define TB_INDETERMINATE        (WM_USER + 5)
  784. #define TB_ISBUTTONENABLED      (WM_USER + 9)
  785. #define TB_ISBUTTONCHECKED      (WM_USER + 10)
  786. #define TB_ISBUTTONPRESSED      (WM_USER + 11)
  787. #define TB_ISBUTTONHIDDEN       (WM_USER + 12)
  788. #define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
  789. #define TB_SETSTATE             (WM_USER + 17)
  790. #define TB_GETSTATE             (WM_USER + 18)
  791. #define TB_ADDBITMAP            (WM_USER + 19)
  792.  
  793. #ifdef _WIN32
  794. typedef struct tagTBADDBITMAP {
  795.         HINSTANCE       hInst;
  796.         UINT            nID;
  797. } TBADDBITMAP, *LPTBADDBITMAP;
  798.  
  799. #define HINST_COMMCTRL          ((HINSTANCE)-1)
  800. #define IDB_STD_SMALL_COLOR     0
  801. #define IDB_STD_LARGE_COLOR     1
  802. #define IDB_VIEW_SMALL_COLOR    4
  803. #define IDB_VIEW_LARGE_COLOR    5
  804. #define IDB_HIST_SMALL_COLOR    8
  805. #define IDB_HIST_LARGE_COLOR    9
  806.  
  807. // icon indexes for standard bitmap
  808.  
  809. #define STD_CUT                 0
  810. #define STD_COPY                1
  811. #define STD_PASTE               2
  812. #define STD_UNDO                3
  813. #define STD_REDOW               4
  814. #define STD_DELETE              5
  815. #define STD_FILENEW             6
  816. #define STD_FILEOPEN            7
  817. #define STD_FILESAVE            8
  818. #define STD_PRINTPRE            9
  819. #define STD_PROPERTIES          10
  820. #define STD_HELP                11
  821. #define STD_FIND                12
  822. #define STD_REPLACE             13
  823. #define STD_PRINT               14
  824.  
  825. // icon indexes for standard view bitmap
  826.  
  827. #define VIEW_LARGEICONS         0
  828. #define VIEW_SMALLICONS         1
  829. #define VIEW_LIST               2
  830. #define VIEW_DETAILS            3
  831. #define VIEW_SORTNAME           4
  832. #define VIEW_SORTSIZE           5
  833. #define VIEW_SORTDATE           6
  834. #define VIEW_SORTTYPE           7
  835. #define VIEW_PARENTFOLDER       8
  836. #define VIEW_NETCONNECT         9
  837. #define VIEW_NETDISCONNECT      10
  838. #define VIEW_NEWFOLDER          11
  839.  
  840. #define HIST_BACK               0
  841. #define HIST_FORWARD            1
  842. #define HIST_FAVORITES          2
  843. #define HIST_ADDTOFAVORITES     3
  844. #define HIST_VIEWTREE           4
  845.  
  846. #endif
  847.  
  848. #define TB_ADDBUTTONS           (WM_USER + 20)
  849. #define TB_INSERTBUTTON         (WM_USER + 21)
  850. #define TB_DELETEBUTTON         (WM_USER + 22)
  851. #define TB_GETBUTTON            (WM_USER + 23)
  852. #define TB_BUTTONCOUNT          (WM_USER + 24)
  853. #define TB_COMMANDTOINDEX       (WM_USER + 25)
  854.  
  855. #ifdef _WIN32
  856.  
  857. typedef struct tagTBSAVEPARAMSA {
  858.     HKEY hkr;
  859.     LPCSTR pszSubKey;
  860.     LPCSTR pszValueName;
  861. } TBSAVEPARAMSA, FAR* LPTBSAVEPARAMSA;
  862.  
  863. typedef struct tagTBSAVEPARAMSW {
  864.     HKEY hkr;
  865.     LPCWSTR pszSubKey;
  866.     LPCWSTR pszValueName;
  867. } TBSAVEPARAMSW, FAR *LPTBSAVEPARAMW;
  868.  
  869. #ifdef UNICODE
  870. #define TBSAVEPARAMS            TBSAVEPARAMSW
  871. #define LPTBSAVEPARAMS          LPTBSAVEPARAMSW
  872. #else
  873. #define TBSAVEPARAMS            TBSAVEPARAMSA
  874. #define LPTBSAVEPARAMS          LPTBSAVEPARAMSA
  875. #endif
  876.  
  877. #endif
  878.  
  879. #define TB_SAVERESTOREA         (WM_USER + 26)
  880. #define TB_SAVERESTOREW         (WM_USER + 76)
  881. #define TB_CUSTOMIZE            (WM_USER + 27)
  882. #define TB_ADDSTRINGA           (WM_USER + 28)
  883. #define TB_ADDSTRINGW           (WM_USER + 77)
  884. #define TB_GETITEMRECT          (WM_USER + 29)
  885. #define TB_BUTTONSTRUCTSIZE     (WM_USER + 30)
  886. #define TB_SETBUTTONSIZE        (WM_USER + 31)
  887. #define TB_SETBITMAPSIZE        (WM_USER + 32)
  888. #define TB_AUTOSIZE             (WM_USER + 33)
  889. #define TB_GETTOOLTIPS          (WM_USER + 35)
  890. #define TB_SETTOOLTIPS          (WM_USER + 36)
  891. #define TB_SETPARENT            (WM_USER + 37)
  892. #define TB_SETROWS              (WM_USER + 39)
  893. #define TB_GETROWS              (WM_USER + 40)
  894. #define TB_SETCMDID             (WM_USER + 42)
  895. #define TB_CHANGEBITMAP         (WM_USER + 43)
  896. #define TB_GETBITMAP            (WM_USER + 44)
  897. #define TB_GETBUTTONTEXTA       (WM_USER + 45)
  898. #define TB_GETBUTTONTEXTW       (WM_USER + 75)
  899. #define TB_REPLACEBITMAP        (WM_USER + 46)
  900. #define TB_SETINDENT            (WM_USER + 47)
  901. #define TB_SETIMAGELIST         (WM_USER + 48)
  902. #define TB_GETIMAGELIST         (WM_USER + 49)
  903. #define TB_LOADIMAGES           (WM_USER + 50)
  904. #define TB_GETRECT              (WM_USER + 51) // wParam is the Cmd instead of index
  905. #define TB_SETHOTIMAGELIST      (WM_USER + 52)
  906. #define TB_GETHOTIMAGELIST      (WM_USER + 53)
  907. #define TB_SETDISABLEDIMAGELIST (WM_USER + 54)
  908. #define TB_GETDISABLEDIMAGELIST (WM_USER + 55)
  909. #define TB_SETSTYLE             (WM_USER + 56)
  910. #define TB_GETSTYLE             (WM_USER + 57)
  911. #define TB_GETBUTTONSIZE        (WM_USER + 58)
  912. #define TB_SETBUTTONWIDTH       (WM_USER + 59)
  913. #define TB_SETMAXTEXTROWS       (WM_USER + 60)
  914. #define TB_GETTEXTROWS          (WM_USER + 61)
  915. #ifdef UNICODE
  916. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTW
  917. #define TB_SAVERESTORE          TB_SAVERESTOREW
  918. #define TB_ADDSTRING            TB_ADDSTRINGW
  919. #else
  920. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTA
  921. #define TB_SAVERESTORE          TB_SAVERESTOREA
  922. #define TB_ADDSTRING            TB_ADDSTRINGA
  923. #endif
  924.  
  925. typedef struct {
  926.         HINSTANCE       hInstOld;
  927.         UINT            nIDOld;
  928.         HINSTANCE       hInstNew;
  929.         UINT            nIDNew;
  930.         int             nButtons;
  931. } TBREPLACEBITMAP, *LPTBREPLACEBITMAP;
  932.  
  933. #ifdef _WIN32
  934.  
  935. #define TBBF_LARGE              0x0001
  936.  
  937. #define TB_GETBITMAPFLAGS       (WM_USER + 41)
  938.  
  939. #define TBN_GETBUTTONINFOA      (TBN_FIRST-0)
  940. #define TBN_GETBUTTONINFOW      (TBN_FIRST-20)
  941. #define TBN_BEGINDRAG           (TBN_FIRST-1)
  942. #define TBN_ENDDRAG             (TBN_FIRST-2)
  943. #define TBN_BEGINADJUST         (TBN_FIRST-3)
  944. #define TBN_ENDADJUST           (TBN_FIRST-4)
  945. #define TBN_RESET               (TBN_FIRST-5)
  946. #define TBN_QUERYINSERT         (TBN_FIRST-6)
  947. #define TBN_QUERYDELETE         (TBN_FIRST-7)
  948. #define TBN_TOOLBARCHANGE       (TBN_FIRST-8)
  949. #define TBN_CUSTHELP            (TBN_FIRST-9)
  950. #define TBN_DROPDOWN            (TBN_FIRST - 10)
  951. #define TBN_CLOSEUP             (TBN_FIRST - 11)
  952.  
  953. #ifdef UNICODE
  954. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOW
  955. #else
  956. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOA
  957. #endif
  958.  
  959. typedef struct tagNMTOOLBARA {
  960.     NMHDR   hdr;
  961.     int     iItem;
  962.     TBBUTTON tbButton;
  963.     int     cchText;
  964.     LPSTR   pszText;
  965. } NMTOOLBARA, FAR* LPNMTOOLBARA;
  966.  
  967.  
  968. typedef struct tagNMTOOLBARW {
  969.     NMHDR   hdr;
  970.     int     iItem;
  971.     TBBUTTON tbButton;
  972.     int     cchText;
  973.     LPWSTR   pszText;
  974. } NMTOOLBARW, FAR* LPNMTOOLBARW;
  975.  
  976. #ifdef UNICODE
  977. #define NMTOOLBAR               NMTOOLBARW
  978. #define LPNMTOOLBAR             LPNMTOOLBARW
  979. #else
  980. #define NMTOOLBAR               NMTOOLBARA
  981. #define LPNMTOOLBAR             LPNMTOOLBARA
  982. #endif
  983.  
  984. #define TBNOTIFYA NMTOOLBARA
  985. #define TBNOTIFYW NMTOOLBARW
  986. #define TBNOTIFY  NMTOOLBAR
  987. #define LPTBNOTIFY  LPNMTOOLBAR
  988. #define LPTBNOTIFYA LPNMTOOLBARA
  989. #define LPTBNOTIFYW LPNMTOOLBARW
  990.  
  991. #endif
  992.  
  993. #endif
  994.  
  995.  
  996. //====== REBAR CONTROL ========================================================
  997.  
  998. #ifndef NOREBAR
  999.  
  1000. #ifdef _WIN32
  1001. #define REBARCLASSNAMEW         L"ReBarWindow32"
  1002. #define REBARCLASSNAMEA         "ReBarWindow32"
  1003.  
  1004. #ifdef  UNICODE
  1005. #define REBARCLASSNAME          REBARCLASSNAMEW
  1006. #else
  1007. #define REBARCLASSNAME          REBARCLASSNAMEA
  1008. #endif
  1009.  
  1010. #else
  1011. #define REBARCLASSNAME          "ReBarWindow"
  1012. #endif
  1013.  
  1014. #define RBIM_IMAGELIST  0x00000001
  1015.  
  1016. #define RBS_TOOLTIPS    0x00000100
  1017. #define RBS_VARHEIGHT   0x00000200
  1018. #define RBS_BANDBORDERS 0x00000400
  1019. #define RBS_FIXEDORDER  0x00000800
  1020.  
  1021. typedef struct tagREBARINFO
  1022. {
  1023.     UINT        cbSize;
  1024.     UINT        fMask;
  1025. #ifndef NOIMAGEAPIS
  1026.     HIMAGELIST  himl;
  1027. #else
  1028.     HANDLE      himl;
  1029. #endif
  1030. }   REBARINFO, FAR *LPREBARINFO;
  1031.  
  1032. #define RBBS_BREAK      0x00000001  // break to new line
  1033. #define RBBS_FIXEDSIZE  0x00000002  // band can't be sized
  1034. #define RBBS_CHILDEDGE  0x00000004  // edge around top & bottom of child window
  1035. #define RBBS_HIDDEN     0x00000008  // don't show
  1036. #define RBBS_NOVERT     0x00000010  // don't show when vertical
  1037. #define RBBS_FIXEDBMP   0x00000020  // bitmap doesn't move during band resize
  1038.  
  1039. #define RBBIM_STYLE     0x00000001
  1040. #define RBBIM_COLORS    0x00000002
  1041. #define RBBIM_TEXT      0x00000004
  1042. #define RBBIM_IMAGE     0x00000008
  1043. #define RBBIM_CHILD     0x00000010
  1044. #define RBBIM_CHILDSIZE 0x00000020
  1045. #define RBBIM_SIZE      0x00000040
  1046. #define RBBIM_BACKGROUND 0x00000080
  1047. #define RBBIM_ID        0x00000100
  1048.  
  1049. typedef struct tagREBARBANDINFOA
  1050. {
  1051.     UINT        cbSize;
  1052.     UINT        fMask;
  1053.     UINT        fStyle;
  1054.     COLORREF    clrFore;
  1055.     COLORREF    clrBack;
  1056.     LPSTR       lpText;
  1057.     UINT        cch;
  1058.     int         iImage;
  1059.     HWND        hwndChild;
  1060.     UINT        cxMinChild;
  1061.     UINT        cyMinChild;
  1062.     UINT        cx;
  1063.     HBITMAP     hbmBack;
  1064.     UINT        wID;
  1065. }   REBARBANDINFOA, FAR *LPREBARBANDINFOA;
  1066. typedef REBARBANDINFOA CONST FAR *LPCREBARBANDINFOA;
  1067.  
  1068. typedef struct tagREBARBANDINFOW
  1069. {
  1070.     UINT        cbSize;
  1071.     UINT        fMask;
  1072.     UINT        fStyle;
  1073.     COLORREF    clrFore;
  1074.     COLORREF    clrBack;
  1075.     LPWSTR      lpText;
  1076.     UINT        cch;
  1077.     int         iImage;
  1078.     HWND        hwndChild;
  1079.     UINT        cxMinChild;
  1080.     UINT        cyMinChild;
  1081.     UINT        cx;
  1082.     HBITMAP     hbmBack;
  1083.     UINT        wID;
  1084. }   REBARBANDINFOW, FAR *LPREBARBANDINFOW;
  1085. typedef REBARBANDINFOW CONST FAR *LPCREBARBANDINFOW;
  1086.  
  1087. #ifdef UNICODE
  1088. #define REBARBANDINFO       REBARBANDINFOW
  1089. #define LPREBARBANDINFO     LPREBARBANDINFOW
  1090. #define LPCREBARBANDINFO    LPCREBARBANDINFOW
  1091. #else
  1092. #define REBARBANDINFO       REBARBANDINFOA
  1093. #define LPREBARBANDINFO     LPREBARBANDINFOA
  1094. #define LPCREBARBANDINFO    LPCREBARBANDINFOA
  1095. #endif
  1096.  
  1097. #define RB_INSERTBANDA  (WM_USER +  1)
  1098. #define RB_DELETEBAND   (WM_USER +  2)
  1099. #define RB_GETBARINFO   (WM_USER +  3)
  1100. #define RB_SETBARINFO   (WM_USER +  4)
  1101. #define RB_GETBANDINFO  (WM_USER +  5)
  1102. #define RB_SETBANDINFOA (WM_USER +  6)
  1103. #define RB_SETPARENT    (WM_USER +  7)
  1104. #define RB_INSERTBANDW  (WM_USER +  10)
  1105. #define RB_SETBANDINFOW (WM_USER +  11)
  1106. #define RB_GETBANDCOUNT (WM_USER +  12)
  1107. #define RB_GETROWCOUNT  (WM_USER +  13)
  1108. #define RB_GETROWHEIGHT (WM_USER +  14)
  1109.  
  1110. #ifdef UNICODE
  1111. #define RB_INSERTBAND   RB_INSERTBANDW
  1112. #define RB_SETBANDINFO   RB_SETBANDINFOW
  1113. #else
  1114. #define RB_INSERTBAND   RB_INSERTBANDA
  1115. #define RB_SETBANDINFO   RB_SETBANDINFOA
  1116. #endif
  1117.  
  1118. #define RBN_HEIGHTCHANGE    (RBN_FIRST - 0)
  1119.  
  1120. #endif
  1121.  
  1122. //====== TOOLTIPS CONTROL =====================================================
  1123.  
  1124. #ifndef NOTOOLTIPS
  1125.  
  1126. #ifdef _WIN32
  1127.  
  1128. #define TOOLTIPS_CLASSW         L"tooltips_class32"
  1129. #define TOOLTIPS_CLASSA         "tooltips_class32"
  1130.  
  1131. #ifdef UNICODE
  1132. #define TOOLTIPS_CLASS          TOOLTIPS_CLASSW
  1133. #else
  1134. #define TOOLTIPS_CLASS          TOOLTIPS_CLASSA
  1135. #endif
  1136.  
  1137. #else
  1138. #define TOOLTIPS_CLASS          "tooltips_class"
  1139. #endif
  1140.  
  1141. typedef struct tagTOOLINFOA {
  1142.     UINT cbSize;
  1143.     UINT uFlags;
  1144.     HWND hwnd;
  1145.     UINT uId;
  1146.     RECT rect;
  1147.     HINSTANCE hinst;
  1148.     LPSTR lpszText;
  1149.     LPARAM lParam;
  1150. } TTTOOLINFOA, NEAR *PTOOLINFOA, FAR *LPTTTOOLINFOA;
  1151.  
  1152. typedef struct tagTOOLINFOW {
  1153.     UINT cbSize;
  1154.     UINT uFlags;
  1155.     HWND hwnd;
  1156.     UINT uId;
  1157.     RECT rect;
  1158.     HINSTANCE hinst;
  1159.     LPWSTR lpszText;
  1160.     LPARAM lParam;
  1161. } TTTOOLINFOW, NEAR *PTOOLINFOW, FAR* LPTTTOOLINFOW;
  1162.  
  1163. #ifdef UNICODE
  1164. #define TTTOOLINFO              TTTOOLINFOW
  1165. #define PTOOLINFO               PTOOLINFOW
  1166. #define LPTTTOOLINFO            LPTTTOOLINFOW
  1167. #else
  1168. #define PTOOLINFO               PTOOLINFOA
  1169. #define TTTOOLINFO              TTTOOLINFOA
  1170. #define LPTTTOOLINFO            LPTTTOOLINFOA
  1171. #endif
  1172.  
  1173.  
  1174. #define LPTOOLINFO              LPTTTOOLINFO
  1175. #define LPTOOLINFOA             LPTTTOOLINFOA
  1176. #define LPTOOLINFOW             LPTTTOOLINFOW
  1177. #define TOOLINFO                TTTOOLINFO
  1178. #define TOOLINFOA               TTTOOLINFOA
  1179. #define TOOLINFOW               TTTOOLINFOW
  1180.  
  1181.  
  1182. #define TTS_ALWAYSTIP           0x01
  1183. #define TTS_NOPREFIX            0x02
  1184.  
  1185. #define TTF_IDISHWND            0x0001
  1186.  
  1187. // Use this to center around trackpoint in trackmode
  1188. // -OR- to center around tool in normal mode.
  1189. // Use TTF_ABSOLUTE to place the tip exactly at the track coords when
  1190. // in tracking mode.  TTF_ABSOLUTE can be used in conjunction with TTF_CENTERTIP
  1191. // to center the tip absolutely about the track point.
  1192.  
  1193. #define TTF_CENTERTIP           0x0002
  1194. #define TTF_RTLREADING          0x0004
  1195. #define TTF_SUBCLASS            0x0010
  1196. #define TTF_TRACK               0x0020
  1197. #define TTF_ABSOLUTE            0x0080
  1198. #define TTF_TRANSPARENT         0x0100
  1199. #define TTF_DI_SETITEM          0x8000       // valid only on the TTN_NEEDTEXT callback
  1200.  
  1201. #define TTDT_AUTOMATIC          0
  1202. #define TTDT_RESHOW             1
  1203. #define TTDT_AUTOPOP            2
  1204. #define TTDT_INITIAL            3
  1205.  
  1206. #define TTM_ACTIVATE            (WM_USER + 1)
  1207. #define TTM_SETDELAYTIME        (WM_USER + 3)
  1208. #define TTM_ADDTOOLA            (WM_USER + 4)
  1209. #define TTM_ADDTOOLW            (WM_USER + 50)
  1210. #define TTM_DELTOOLA            (WM_USER + 5)
  1211. #define TTM_DELTOOLW            (WM_USER + 51)
  1212. #define TTM_NEWTOOLRECTA        (WM_USER + 6)
  1213. #define TTM_NEWTOOLRECTW        (WM_USER + 52)
  1214. #define TTM_RELAYEVENT          (WM_USER + 7)
  1215.  
  1216. #define TTM_GETTOOLINFOA        (WM_USER + 8)
  1217. #define TTM_GETTOOLINFOW        (WM_USER + 53)
  1218.  
  1219. #define TTM_SETTOOLINFOA        (WM_USER + 9)
  1220. #define TTM_SETTOOLINFOW        (WM_USER + 54)
  1221.  
  1222. #define TTM_HITTESTA            (WM_USER +10)
  1223. #define TTM_HITTESTW            (WM_USER +55)
  1224. #define TTM_GETTEXTA            (WM_USER +11)
  1225. #define TTM_GETTEXTW            (WM_USER +56)
  1226. #define TTM_UPDATETIPTEXTA      (WM_USER +12)
  1227. #define TTM_UPDATETIPTEXTW      (WM_USER +57)
  1228. #define TTM_GETTOOLCOUNT        (WM_USER +13)
  1229. #define TTM_ENUMTOOLSA          (WM_USER +14)
  1230. #define TTM_ENUMTOOLSW          (WM_USER +58)
  1231. #define TTM_GETCURRENTTOOLA     (WM_USER + 15)
  1232. #define TTM_GETCURRENTTOOLW     (WM_USER + 59)
  1233. #define TTM_WINDOWFROMPOINT     (WM_USER + 16)
  1234. #define TTM_TRACKACTIVATE       (WM_USER + 17)  // wParam = TRUE/FALSE start end  lparam = LPTOOLINFO
  1235. #define TTM_TRACKPOSITION       (WM_USER + 18)  // lParam = dwPos
  1236. #define TTM_SETTIPBKCOLOR       (WM_USER + 19)
  1237. #define TTM_SETTIPTEXTCOLOR     (WM_USER + 20)
  1238. #define TTM_GETDELAYTIME        (WM_USER + 21)
  1239. #define TTM_GETTIPBKCOLOR       (WM_USER + 22)
  1240. #define TTM_GETTIPTEXTCOLOR     (WM_USER + 23)
  1241. #define TTM_SETMAXTIPWIDTH      (WM_USER + 24)
  1242. #define TTM_GETMAXTIPWIDTH      (WM_USER + 25)
  1243. #define TTM_SETMARGIN           (WM_USER + 26)  // lParam = lprc
  1244. #define TTM_GETMARGIN           (WM_USER + 27)  // lParam = lprc
  1245. #define TTM_POP                 (WM_USER + 28)
  1246.  
  1247.  
  1248. #ifdef UNICODE
  1249. #define TTM_ADDTOOL             TTM_ADDTOOLW
  1250. #define TTM_DELTOOL             TTM_DELTOOLW
  1251. #define TTM_NEWTOOLRECT         TTM_NEWTOOLRECTW
  1252. #define TTM_GETTOOLINFO         TTM_GETTOOLINFOW
  1253. #define TTM_SETTOOLINFO         TTM_SETTOOLINFOW
  1254. #define TTM_HITTEST             TTM_HITTESTW
  1255. #define TTM_GETTEXT             TTM_GETTEXTW
  1256. #define TTM_UPDATETIPTEXT       TTM_UPDATETIPTEXTW
  1257. #define TTM_ENUMTOOLS           TTM_ENUMTOOLSW
  1258. #define TTM_GETCURRENTTOOL      TTM_GETCURRENTTOOLW
  1259. #else
  1260. #define TTM_ADDTOOL             TTM_ADDTOOLA
  1261. #define TTM_DELTOOL             TTM_DELTOOLA
  1262. #define TTM_NEWTOOLRECT         TTM_NEWTOOLRECTA
  1263. #define TTM_GETTOOLINFO         TTM_GETTOOLINFOA
  1264. #define TTM_SETTOOLINFO         TTM_SETTOOLINFOA
  1265. #define TTM_HITTEST             TTM_HITTESTA
  1266. #define TTM_GETTEXT             TTM_GETTEXTA
  1267. #define TTM_UPDATETIPTEXT       TTM_UPDATETIPTEXTA
  1268. #define TTM_ENUMTOOLS           TTM_ENUMTOOLSA
  1269. #define TTM_GETCURRENTTOOL      TTM_GETCURRENTTOOLA
  1270. #endif
  1271.  
  1272.  
  1273. typedef struct _TT_HITTESTINFOA {
  1274.     HWND hwnd;
  1275.     POINT pt;
  1276.     TTTOOLINFOA ti;
  1277. } TTHITTESTINFOA, FAR * LPTTHITTESTINFOA;
  1278.  
  1279. typedef struct _TT_HITTESTINFOW {
  1280.     HWND hwnd;
  1281.     POINT pt;
  1282.     TTTOOLINFOW ti;
  1283. } TTHITTESTINFOW, FAR * LPTTHITTESTINFOW;
  1284.  
  1285. #define LPHITTESTINFOW          LPTTHITTESTINFOW
  1286. #define LPHITTESTINFOA          LPTTHITTESTINFOA
  1287. #define LPHITTESTINFO           LPTTHITTESTINFO
  1288.  
  1289. #ifdef UNICODE
  1290. #define TTHITTESTINFO           TTHITTESTINFOW
  1291. #define LPTTHITTESTINFO         LPTTHITTESTINFOW
  1292. #else
  1293. #define TTHITTESTINFO           TTHITTESTINFOA
  1294. #define LPTTHITTESTINFO         LPTTHITTESTINFOA
  1295. #endif
  1296.  
  1297. #define TTN_GETDISPINFOA        (TTN_FIRST - 0)
  1298. #define TTN_GETDISPINFOW        (TTN_FIRST - 10)
  1299. #define TTN_SHOW                (TTN_FIRST - 1)
  1300. #define TTN_POP                 (TTN_FIRST - 2)
  1301.  
  1302.  
  1303. #ifdef UNICODE
  1304. #define TTN_GETDISPINFO         TTN_GETDISPINFOW
  1305. #else
  1306. #define TTN_GETDISPINFO         TTN_GETDISPINFOA
  1307. #endif
  1308.  
  1309. #define TTN_NEEDTEXT            TTN_GETDISPINFO
  1310. #define TTN_NEEDTEXTA           TTN_GETDISPINFOA
  1311. #define TTN_NEEDTEXTW           TTN_GETDISPINFOW
  1312.  
  1313.  
  1314. typedef struct tagNMTTDISPIFNOA {
  1315.     NMHDR hdr;
  1316.     LPSTR lpszText;
  1317.     char szText[80];
  1318.     HINSTANCE hinst;
  1319.     UINT uFlags;
  1320.     LPARAM lParam;
  1321. } NMTTDISPINFOA, FAR *LPNMTTDISPINFOA;
  1322.  
  1323.  
  1324. typedef struct tagNMTTDISPINFOW {
  1325.     NMHDR hdr;
  1326.     LPWSTR lpszText;
  1327.     WCHAR szText[80];
  1328.     HINSTANCE hinst;
  1329.     UINT uFlags;
  1330.     LPARAM lParam;
  1331. } NMTTDISPINFOW, FAR *LPNMTTDISPINFOW;
  1332.  
  1333. #define TOOLTIPTEXTW NMTTDISPINFOW
  1334. #define TOOLTIPTEXTA NMTTDISPINFOA
  1335. #define TOOLTIPTEXT  NMTTDISPINFO
  1336. #define LPTOOLTIPTEXT  LPNMTTDISPINFO
  1337. #define LPTOOLTIPTEXTA LPNMTTDISPINFOA
  1338. #define LPTOOLTIPTEXTW LPNMTTDISPINFOW
  1339.  
  1340.  
  1341. #ifdef UNICODE
  1342. #define NMTTDISPINFO            NMTTDISPINFOW
  1343. #define LPNMTTDISPINFO          LPNMTTDISPINFOW
  1344. #else
  1345. #define NMTTDISPINFO            NMTTDISPINFOA
  1346. #define LPNMTTDISPINFO          LPNMTTDISPINFOA
  1347. #endif
  1348.  
  1349. #endif
  1350.  
  1351.  
  1352. //====== STATUS BAR CONTROL ===================================================
  1353.  
  1354. #ifndef NOSTATUSBAR
  1355.  
  1356. #define SBARS_SIZEGRIP          0x0100
  1357.  
  1358.  
  1359. WINCOMMCTRLAPI void WINAPI DrawStatusTextA(HDC hDC, LPRECT lprc, LPCSTR pszText, UINT uFlags);
  1360. WINCOMMCTRLAPI void WINAPI DrawStatusTextW(HDC hDC, LPRECT lprc, LPCWSTR pszText, UINT uFlags);
  1361.  
  1362. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowA(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
  1363. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR lpszText, HWND hwndParent, UINT wID);
  1364.  
  1365. #ifdef UNICODE
  1366. #define CreateStatusWindow      CreateStatusWindowW
  1367. #define DrawStatusText          DrawStatusTextW
  1368. #else
  1369. #define CreateStatusWindow      CreateStatusWindowA
  1370. #define DrawStatusText          DrawStatusTextA
  1371. #endif
  1372.  
  1373. #ifdef _WIN32
  1374. #define STATUSCLASSNAMEW        L"msctls_statusbar32"
  1375. #define STATUSCLASSNAMEA        "msctls_statusbar32"
  1376.  
  1377. #ifdef UNICODE
  1378. #define STATUSCLASSNAME         STATUSCLASSNAMEW
  1379. #else
  1380. #define STATUSCLASSNAME         STATUSCLASSNAMEA
  1381. #endif
  1382.  
  1383. #else
  1384. #define STATUSCLASSNAME         "msctls_statusbar"
  1385. #endif
  1386.  
  1387. #define SB_SETTEXTA             (WM_USER+1)
  1388. #define SB_SETTEXTW             (WM_USER+11)
  1389. #define SB_GETTEXTA             (WM_USER+2)
  1390. #define SB_GETTEXTW             (WM_USER+13)
  1391. #define SB_GETTEXTLENGTHA       (WM_USER+3)
  1392. #define SB_GETTEXTLENGTHW       (WM_USER+12)
  1393.  
  1394. #ifdef UNICODE
  1395. #define SB_GETTEXT              SB_GETTEXTW
  1396. #define SB_SETTEXT              SB_SETTEXTW
  1397. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHW
  1398. #else
  1399. #define SB_GETTEXT              SB_GETTEXTA
  1400. #define SB_SETTEXT              SB_SETTEXTA
  1401. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHA
  1402. #endif
  1403.  
  1404.  
  1405. #define SB_SETPARTS             (WM_USER+4)
  1406. #define SB_GETPARTS             (WM_USER+6)
  1407. #define SB_GETBORDERS           (WM_USER+7)
  1408. #define SB_SETMINHEIGHT         (WM_USER+8)
  1409. #define SB_SIMPLE               (WM_USER+9)
  1410. #define SB_GETRECT              (WM_USER+10)
  1411. #define SB_ISSIMPLE             (WM_USER+14)
  1412.  
  1413.  
  1414. #define SBT_OWNERDRAW            0x1000
  1415. #define SBT_NOBORDERS            0x0100
  1416. #define SBT_POPOUT               0x0200
  1417. #define SBT_RTLREADING           0x0400
  1418.  
  1419. #endif
  1420.  
  1421. //====== MENU HELP ============================================================
  1422.  
  1423. #ifndef NOMENUHELP
  1424.  
  1425. WINCOMMCTRLAPI void WINAPI MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT FAR *lpwIDs);
  1426. WINCOMMCTRLAPI BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo);
  1427. WINCOMMCTRLAPI void WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo);
  1428.  
  1429. #define MINSYSCOMMAND   SC_SIZE
  1430.  
  1431. #endif
  1432.  
  1433.  
  1434. //====== TRACKBAR CONTROL =====================================================
  1435.  
  1436. #ifndef NOTRACKBAR
  1437.  
  1438. #ifdef _WIN32
  1439.  
  1440. #define TRACKBAR_CLASSA         "msctls_trackbar32"
  1441. #define TRACKBAR_CLASSW         L"msctls_trackbar32"
  1442.  
  1443. #ifdef UNICODE
  1444. #define  TRACKBAR_CLASS         TRACKBAR_CLASSW
  1445. #else
  1446. #define  TRACKBAR_CLASS         TRACKBAR_CLASSA
  1447. #endif
  1448.  
  1449. #else
  1450. #define TRACKBAR_CLASS          "msctls_trackbar"
  1451. #endif
  1452.  
  1453.  
  1454. #define TBS_AUTOTICKS           0x0001
  1455. #define TBS_VERT                0x0002
  1456. #define TBS_HORZ                0x0000
  1457. #define TBS_TOP                 0x0004
  1458. #define TBS_BOTTOM              0x0000
  1459. #define TBS_LEFT                0x0004
  1460. #define TBS_RIGHT               0x0000
  1461. #define TBS_BOTH                0x0008
  1462. #define TBS_NOTICKS             0x0010
  1463. #define TBS_ENABLESELRANGE      0x0020
  1464. #define TBS_FIXEDLENGTH         0x0040
  1465. #define TBS_NOTHUMB             0x0080
  1466. #define TBS_TOOLTIPS            0x0100
  1467.  
  1468. #define TBM_GETPOS              (WM_USER)
  1469. #define TBM_GETRANGEMIN         (WM_USER+1)
  1470. #define TBM_GETRANGEMAX         (WM_USER+2)
  1471. #define TBM_GETTIC              (WM_USER+3)
  1472. #define TBM_SETTIC              (WM_USER+4)
  1473. #define TBM_SETPOS              (WM_USER+5)
  1474. #define TBM_SETRANGE            (WM_USER+6)
  1475. #define TBM_SETRANGEMIN         (WM_USER+7)
  1476. #define TBM_SETRANGEMAX         (WM_USER+8)
  1477. #define TBM_CLEARTICS           (WM_USER+9)
  1478. #define TBM_SETSEL              (WM_USER+10)
  1479. #define TBM_SETSELSTART         (WM_USER+11)
  1480. #define TBM_SETSELEND           (WM_USER+12)
  1481. #define TBM_GETPTICS            (WM_USER+14)
  1482. #define TBM_GETTICPOS           (WM_USER+15)
  1483. #define TBM_GETNUMTICS          (WM_USER+16)
  1484. #define TBM_GETSELSTART         (WM_USER+17)
  1485. #define TBM_GETSELEND           (WM_USER+18)
  1486. #define TBM_CLEARSEL            (WM_USER+19)
  1487. #define TBM_SETTICFREQ          (WM_USER+20)
  1488. #define TBM_SETPAGESIZE         (WM_USER+21)
  1489. #define TBM_GETPAGESIZE         (WM_USER+22)
  1490. #define TBM_SETLINESIZE         (WM_USER+23)
  1491. #define TBM_GETLINESIZE         (WM_USER+24)
  1492. #define TBM_GETTHUMBRECT        (WM_USER+25)
  1493. #define TBM_GETCHANNELRECT      (WM_USER+26)
  1494. #define TBM_SETTHUMBLENGTH      (WM_USER+27)
  1495. #define TBM_GETTHUMBLENGTH      (WM_USER+28)
  1496. #define TBM_SETTOOLTIPS         (WM_USER+29)
  1497. #define TBM_GETTOOLTIPS         (WM_USER+30)
  1498. #define TBM_SETTIPSIDE          (WM_USER+31)
  1499. // TrackBar Tip Side flags
  1500. #define TBTS_TOP                0
  1501. #define TBTS_LEFT               1
  1502. #define TBTS_BOTTOM             2
  1503. #define TBTS_RIGHT              3
  1504.  
  1505. #define TBM_SETBUDDY            (WM_USER+32) // wparam = BOOL fLeft; (or right)
  1506. #define TBM_GETBUDDY            (WM_USER+33) // wparam = BOOL fLeft; (or right)
  1507.  
  1508.  
  1509. #define TB_LINEUP               0
  1510. #define TB_LINEDOWN             1
  1511. #define TB_PAGEUP               2
  1512. #define TB_PAGEDOWN             3
  1513. #define TB_THUMBPOSITION        4
  1514. #define TB_THUMBTRACK           5
  1515. #define TB_TOP                  6
  1516. #define TB_BOTTOM               7
  1517. #define TB_ENDTRACK             8
  1518.  
  1519.  
  1520. // custom draw item specs
  1521. #define TBCD_TICS    0x0001
  1522. #define TBCD_THUMB   0x0002
  1523. #define TBCD_CHANNEL 0x0003
  1524.  
  1525. #endif // trackbar
  1526.  
  1527. //====== DRAG LIST CONTROL ====================================================
  1528.  
  1529. #ifndef NODRAGLIST
  1530.  
  1531. typedef struct tagDRAGLISTINFO {
  1532.     UINT uNotification;
  1533.     HWND hWnd;
  1534.     POINT ptCursor;
  1535. } DRAGLISTINFO, FAR *LPDRAGLISTINFO;
  1536.  
  1537. #define DL_BEGINDRAG            (WM_USER+133)
  1538. #define DL_DRAGGING             (WM_USER+134)
  1539. #define DL_DROPPED              (WM_USER+135)
  1540. #define DL_CANCELDRAG           (WM_USER+136)
  1541.  
  1542. #define DL_CURSORSET            0
  1543. #define DL_STOPCURSOR           1
  1544. #define DL_COPYCURSOR           2
  1545. #define DL_MOVECURSOR           3
  1546.  
  1547. #define DRAGLISTMSGSTRING       TEXT("commctrl_DragListMsg")
  1548.  
  1549. WINCOMMCTRLAPI BOOL WINAPI MakeDragList(HWND hLB);
  1550. WINCOMMCTRLAPI void WINAPI DrawInsert(HWND handParent, HWND hLB, int nItem);
  1551. WINCOMMCTRLAPI int WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll);
  1552.  
  1553. #endif
  1554.  
  1555.  
  1556. //====== UPDOWN CONTROL =======================================================
  1557.  
  1558. #ifndef NOUPDOWN
  1559.  
  1560. #ifdef _WIN32
  1561.  
  1562. #define UPDOWN_CLASSA           "msctls_updown32"
  1563. #define UPDOWN_CLASSW           L"msctls_updown32"
  1564.  
  1565. #ifdef UNICODE
  1566. #define  UPDOWN_CLASS           UPDOWN_CLASSW
  1567. #else
  1568. #define  UPDOWN_CLASS           UPDOWN_CLASSA
  1569. #endif
  1570.  
  1571. #else
  1572. #define UPDOWN_CLASS            "msctls_updown"
  1573. #endif
  1574.  
  1575.  
  1576. typedef struct _UDACCEL {
  1577.     UINT nSec;
  1578.     UINT nInc;
  1579. } UDACCEL, FAR *LPUDACCEL;
  1580.  
  1581. #define UD_MAXVAL               0x7fff
  1582. #define UD_MINVAL               (-UD_MAXVAL)
  1583.  
  1584.  
  1585. #define UDS_WRAP                0x0001
  1586. #define UDS_SETBUDDYINT         0x0002
  1587. #define UDS_ALIGNRIGHT          0x0004
  1588. #define UDS_ALIGNLEFT           0x0008
  1589. #define UDS_AUTOBUDDY           0x0010
  1590. #define UDS_ARROWKEYS           0x0020
  1591. #define UDS_HORZ                0x0040
  1592. #define UDS_NOTHOUSANDS         0x0080
  1593. #define UDS_HOTTRACK            0x0100
  1594.  
  1595.  
  1596. #define UDM_SETRANGE            (WM_USER+101)
  1597. #define UDM_GETRANGE            (WM_USER+102)
  1598. #define UDM_SETPOS              (WM_USER+103)
  1599. #define UDM_GETPOS              (WM_USER+104)
  1600. #define UDM_SETBUDDY            (WM_USER+105)
  1601. #define UDM_GETBUDDY            (WM_USER+106)
  1602. #define UDM_SETACCEL            (WM_USER+107)
  1603. #define UDM_GETACCEL            (WM_USER+108)
  1604. #define UDM_SETBASE             (WM_USER+109)
  1605. #define UDM_GETBASE             (WM_USER+110)
  1606.  
  1607.  
  1608. WINCOMMCTRLAPI HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy,
  1609.                                 HWND hParent, int nID, HINSTANCE hInst,
  1610.                                 HWND hBuddy,
  1611.                                 int nUpper, int nLower, int nPos);
  1612.  
  1613. typedef struct _NM_UPDOWN
  1614. {
  1615.     NMHDR hdr;
  1616.     int iPos;
  1617.     int iDelta;
  1618. } NMUPDOWN, FAR *LPNMUPDOWN;
  1619.  
  1620. #define NM_UPDOWN NMUPDOWN
  1621. #define LPNM_UPDOWN LPNMUPDOWN
  1622.  
  1623. #define UDN_DELTAPOS            (UDN_FIRST - 1)
  1624.  
  1625. #endif
  1626.  
  1627.  
  1628. //====== PROGRESS CONTROL =====================================================
  1629.  
  1630. #ifndef NOPROGRESS
  1631.  
  1632. #ifdef _WIN32
  1633.  
  1634. #define PROGRESS_CLASSA         "msctls_progress32"
  1635. #define PROGRESS_CLASSW         L"msctls_progress32"
  1636.  
  1637. #ifdef UNICODE
  1638. #define  PROGRESS_CLASS         PROGRESS_CLASSW
  1639. #else
  1640. #define  PROGRESS_CLASS         PROGRESS_CLASSA
  1641. #endif
  1642.  
  1643. #else
  1644. #define PROGRESS_CLASS          "msctls_progress"
  1645. #endif
  1646.  
  1647.  
  1648. #define PBS_SMOOTH              0x01
  1649. #define PBS_VERTICAL            0x04
  1650.  
  1651. #define PBM_SETRANGE            (WM_USER+1)
  1652. #define PBM_SETPOS              (WM_USER+2)
  1653. #define PBM_DELTAPOS            (WM_USER+3)
  1654. #define PBM_SETSTEP             (WM_USER+4)
  1655. #define PBM_STEPIT              (WM_USER+5)
  1656. #define PBM_SETRANGE32          (WM_USER+6)  // lParam = high, wParam = low
  1657. typedef struct
  1658. {
  1659.    int iLow;
  1660.    int iHigh;
  1661. } PBRANGE, *PPBRANGE;
  1662. #define PBM_GETRANGE            (WM_USER+7)  // wParam = return (TRUE ? low : high). lParam = PPBRANGE or NULL
  1663. #define PBM_GETPOS              (WM_USER+8)
  1664.  
  1665. #endif
  1666.  
  1667.  
  1668. //====== HOTKEY CONTROL =======================================================
  1669.  
  1670. #ifndef NOHOTKEY
  1671.  
  1672. #define HOTKEYF_SHIFT           0x01
  1673. #define HOTKEYF_CONTROL         0x02
  1674. #define HOTKEYF_ALT             0x04
  1675. #define HOTKEYF_EXT             0x08
  1676.  
  1677. #define HKCOMB_NONE             0x0001
  1678. #define HKCOMB_S                0x0002
  1679. #define HKCOMB_C                0x0004
  1680. #define HKCOMB_A                0x0008
  1681. #define HKCOMB_SC               0x0010
  1682. #define HKCOMB_SA               0x0020
  1683. #define HKCOMB_CA               0x0040
  1684. #define HKCOMB_SCA              0x0080
  1685.  
  1686.  
  1687. #define HKM_SETHOTKEY           (WM_USER+1)
  1688. #define HKM_GETHOTKEY           (WM_USER+2)
  1689. #define HKM_SETRULES            (WM_USER+3)
  1690.  
  1691. #ifdef _WIN32
  1692.  
  1693. #define HOTKEY_CLASSA           "msctls_hotkey32"
  1694. #define HOTKEY_CLASSW           L"msctls_hotkey32"
  1695.  
  1696. #ifdef UNICODE
  1697. #define HOTKEY_CLASS            HOTKEY_CLASSW
  1698. #else
  1699. #define HOTKEY_CLASS            HOTKEY_CLASSA
  1700. #endif
  1701.  
  1702. #else
  1703. #define HOTKEY_CLASS            "msctls_hotkey"
  1704. #endif
  1705.  
  1706. #endif
  1707.  
  1708.  
  1709. //====== COMMON CONTROL STYLES ================================================
  1710.  
  1711. #define CCS_TOP                 0x00000001L
  1712. #define CCS_NOMOVEY             0x00000002L
  1713. #define CCS_BOTTOM              0x00000003L
  1714. #define CCS_NORESIZE            0x00000004L
  1715. #define CCS_NOPARENTALIGN       0x00000008L
  1716. #define CCS_ADJUSTABLE          0x00000020L
  1717. #define CCS_NODIVIDER           0x00000040L
  1718. #define CCS_VERT                0x00000080L
  1719. #define CCS_LEFT                (CCS_VERT | CCS_TOP)
  1720. #define CCS_RIGHT               (CCS_VERT | CCS_BOTTOM)
  1721. #define CCS_NOMOVEX             (CCS_VERT | CCS_NOMOVEY)
  1722.  
  1723.  
  1724. //====== LISTVIEW CONTROL =====================================================
  1725.  
  1726. #ifndef NOLISTVIEW
  1727.  
  1728. #ifdef _WIN32
  1729.  
  1730. #define WC_LISTVIEWA            "SysListView32"
  1731. #define WC_LISTVIEWW            L"SysListView32"
  1732.  
  1733. #ifdef UNICODE
  1734. #define WC_LISTVIEW             WC_LISTVIEWW
  1735. #else
  1736. #define WC_LISTVIEW             WC_LISTVIEWA
  1737. #endif
  1738.  
  1739. #else
  1740. #define WC_LISTVIEW             "SysListView"
  1741. #endif
  1742.  
  1743. #define LVS_ICON                0x0000
  1744. #define LVS_REPORT              0x0001
  1745. #define LVS_SMALLICON           0x0002
  1746. #define LVS_LIST                0x0003
  1747. #define LVS_TYPEMASK            0x0003
  1748. #define LVS_SINGLESEL           0x0004
  1749. #define LVS_SHOWSELALWAYS       0x0008
  1750. #define LVS_SORTASCENDING       0x0010
  1751. #define LVS_SORTDESCENDING      0x0020
  1752. #define LVS_SHAREIMAGELISTS     0x0040
  1753. #define LVS_NOLABELWRAP         0x0080
  1754. #define LVS_AUTOARRANGE         0x0100
  1755. #define LVS_EDITLABELS          0x0200
  1756. #define LVS_OWNERDATA           0x1000
  1757. #define LVS_NOSCROLL            0x2000
  1758.  
  1759. #define LVS_TYPESTYLEMASK       0xfc00
  1760.  
  1761. #define LVS_ALIGNTOP            0x0000
  1762. #define LVS_ALIGNLEFT           0x0800
  1763. #define LVS_ALIGNMASK           0x0c00
  1764.  
  1765. #define LVS_OWNERDRAWFIXED      0x0400
  1766. #define LVS_NOCOLUMNHEADER      0x4000
  1767. #define LVS_NOSORTHEADER        0x8000
  1768.  
  1769. #define LVM_GETBKCOLOR          (LVM_FIRST + 0)
  1770. #define ListView_GetBkColor(hwnd)  \
  1771.     (COLORREF)SNDMSG((hwnd), LVM_GETBKCOLOR, 0, 0L)
  1772.  
  1773. #define LVM_SETBKCOLOR          (LVM_FIRST + 1)
  1774. #define ListView_SetBkColor(hwnd, clrBk) \
  1775.     (BOOL)SNDMSG((hwnd), LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  1776.  
  1777. #define LVM_GETIMAGELIST        (LVM_FIRST + 2)
  1778. #define ListView_GetImageList(hwnd, iImageList) \
  1779.     (HIMAGELIST)SNDMSG((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
  1780.  
  1781. #define LVSIL_NORMAL            0
  1782. #define LVSIL_SMALL             1
  1783. #define LVSIL_STATE             2
  1784.  
  1785. #define LVM_SETIMAGELIST        (LVM_FIRST + 3)
  1786. #define ListView_SetImageList(hwnd, himl, iImageList) \
  1787.     (HIMAGELIST)(UINT)SNDMSG((hwnd), LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl))
  1788.  
  1789. #define LVM_GETITEMCOUNT        (LVM_FIRST + 4)
  1790. #define ListView_GetItemCount(hwnd) \
  1791.     (int)SNDMSG((hwnd), LVM_GETITEMCOUNT, 0, 0L)
  1792.  
  1793.  
  1794. #define LVIF_TEXT               0x0001
  1795. #define LVIF_IMAGE              0x0002
  1796. #define LVIF_PARAM              0x0004
  1797. #define LVIF_STATE              0x0008
  1798. #define LVIF_INDENT             0x0010
  1799. #define LVIF_NORECOMPUTE        0x0800
  1800.  
  1801. #define LVIS_FOCUSED            0x0001
  1802. #define LVIS_SELECTED           0x0002
  1803. #define LVIS_CUT                0x0004
  1804. #define LVIS_DROPHILITED        0x0008
  1805.  
  1806. #define LVIS_OVERLAYMASK        0x0F00
  1807. #define LVIS_STATEIMAGEMASK     0xF000
  1808.  
  1809. #define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
  1810. #define I_INDENTCALLBACK        (-1)
  1811.  
  1812.  
  1813. typedef struct tagLVITEMA
  1814. {
  1815.     UINT mask;
  1816.     int iItem;
  1817.     int iSubItem;
  1818.     UINT state;
  1819.     UINT stateMask;
  1820.     LPSTR pszText;
  1821.     int cchTextMax;
  1822.     int iImage;
  1823.     LPARAM lParam;
  1824.     int iIndent;
  1825. } LVITEMA, FAR* LPLVITEMA;
  1826.  
  1827. #define LV_ITEMA LVITEMA
  1828.  
  1829. typedef struct tagLVITEMW
  1830. {
  1831.     UINT mask;
  1832.     int iItem;
  1833.     int iSubItem;
  1834.     UINT state;
  1835.     UINT stateMask;
  1836.     LPWSTR pszText;
  1837.     int cchTextMax;
  1838.     int iImage;
  1839.     LPARAM lParam;
  1840.     int iIndent;
  1841. } LVITEMW, FAR* LPLVITEMW;
  1842.  
  1843. #define LV_ITEMW LVITEMW
  1844. #define LV_ITEM LVITEM
  1845.  
  1846.  
  1847. #ifdef UNICODE
  1848. #define LVITEM    LVITEMW
  1849. #define LPLVITEM  LPLVITEMW
  1850. #else
  1851. #define LVITEM    LVITEMA
  1852. #define LPLVITEM  LPLVITEMA
  1853. #endif
  1854.  
  1855.  
  1856.  
  1857. #define LPSTR_TEXTCALLBACKW     ((LPWSTR)-1L)
  1858. #define LPSTR_TEXTCALLBACKA     ((LPSTR)-1L)
  1859. #ifdef UNICODE
  1860. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKW
  1861. #else
  1862. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKA
  1863. #endif
  1864.  
  1865. #define I_IMAGECALLBACK         (-1)
  1866.  
  1867. #define LVM_GETITEMA            (LVM_FIRST + 5)
  1868. #define LVM_GETITEMW            (LVM_FIRST + 75)
  1869. #ifdef UNICODE
  1870. #define LVM_GETITEM             LVM_GETITEMW
  1871. #else
  1872. #define LVM_GETITEM             LVM_GETITEMA
  1873. #endif
  1874.  
  1875. #define ListView_GetItem(hwnd, pitem) \
  1876.     (BOOL)SNDMSG((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM FAR*)(pitem))
  1877.  
  1878.  
  1879. #define LVM_SETITEMA            (LVM_FIRST + 6)
  1880. #define LVM_SETITEMW            (LVM_FIRST + 76)
  1881. #ifdef UNICODE
  1882. #define LVM_SETITEM             LVM_SETITEMW
  1883. #else
  1884. #define LVM_SETITEM             LVM_SETITEMA
  1885. #endif
  1886.  
  1887. #define ListView_SetItem(hwnd, pitem) \
  1888.     (BOOL)SNDMSG((hwnd), LVM_SETITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1889.  
  1890.  
  1891. #define LVM_INSERTITEMA         (LVM_FIRST + 7)
  1892. #define LVM_INSERTITEMW         (LVM_FIRST + 77)
  1893. #ifdef UNICODE
  1894. #define LVM_INSERTITEM          LVM_INSERTITEMW
  1895. #else
  1896. #define LVM_INSERTITEM          LVM_INSERTITEMA
  1897. #endif
  1898. #define ListView_InsertItem(hwnd, pitem)   \
  1899.     (int)SNDMSG((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1900.  
  1901.  
  1902. #define LVM_DELETEITEM          (LVM_FIRST + 8)
  1903. #define ListView_DeleteItem(hwnd, i) \
  1904.     (BOOL)SNDMSG((hwnd), LVM_DELETEITEM, (WPARAM)(int)(i), 0L)
  1905.  
  1906.  
  1907. #define LVM_DELETEALLITEMS      (LVM_FIRST + 9)
  1908. #define ListView_DeleteAllItems(hwnd) \
  1909.     (BOOL)SNDMSG((hwnd), LVM_DELETEALLITEMS, 0, 0L)
  1910.  
  1911.  
  1912. #define LVM_GETCALLBACKMASK     (LVM_FIRST + 10)
  1913. #define ListView_GetCallbackMask(hwnd) \
  1914.     (BOOL)SNDMSG((hwnd), LVM_GETCALLBACKMASK, 0, 0)
  1915.  
  1916.  
  1917. #define LVM_SETCALLBACKMASK     (LVM_FIRST + 11)
  1918. #define ListView_SetCallbackMask(hwnd, mask) \
  1919.     (BOOL)SNDMSG((hwnd), LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0)
  1920.  
  1921.  
  1922. #define LVNI_ALL                0x0000
  1923. #define LVNI_FOCUSED            0x0001
  1924. #define LVNI_SELECTED           0x0002
  1925. #define LVNI_CUT                0x0004
  1926. #define LVNI_DROPHILITED        0x0008
  1927.  
  1928. #define LVNI_ABOVE              0x0100
  1929. #define LVNI_BELOW              0x0200
  1930. #define LVNI_TOLEFT             0x0400
  1931. #define LVNI_TORIGHT            0x0800
  1932.  
  1933.  
  1934. #define LVM_GETNEXTITEM         (LVM_FIRST + 12)
  1935. #define ListView_GetNextItem(hwnd, i, flags) \
  1936.     (int)SNDMSG((hwnd), LVM_GETNEXTITEM, (WPARAM)(int)(i), MAKELPARAM((flags), 0))
  1937.  
  1938.  
  1939. #define LVFI_PARAM              0x0001
  1940. #define LVFI_STRING             0x0002
  1941. #define LVFI_PARTIAL            0x0008
  1942. #define LVFI_WRAP               0x0020
  1943. #define LVFI_NEARESTXY          0x0040
  1944.  
  1945. typedef struct tagLVFINDINFOA
  1946. {
  1947.     UINT flags;
  1948.     LPCSTR psz;
  1949.     LPARAM lParam;
  1950.     POINT pt;
  1951.     UINT vkDirection;
  1952. } LVFINDINFOA, FAR* LPFINDINFOA;
  1953.  
  1954. #define LV_FINDINFOA LVFINDINFOA
  1955.  
  1956. typedef struct tagLVFINDINFOW
  1957. {
  1958.     UINT flags;
  1959.     LPCWSTR psz;
  1960.     LPARAM lParam;
  1961.     POINT pt;
  1962.     UINT vkDirection;
  1963. } LVFINDINFOW, FAR* LPFINDINFOW;
  1964.  
  1965. #define LV_FINDINFOW LVFINDINFOW
  1966. #define LV_FINDINFO  LVFINDINFO
  1967.  
  1968. #ifdef UNICODE
  1969. #define  LVFINDINFO            LVFINDINFOW
  1970. #else
  1971. #define  LVFINDINFO            LVFINDINFOA
  1972. #endif
  1973.  
  1974. #define LVM_FINDITEMA           (LVM_FIRST + 13)
  1975. #define LVM_FINDITEMW           (LVM_FIRST + 83)
  1976. #ifdef UNICODE
  1977. #define  LVM_FINDITEM           LVM_FINDITEMW
  1978. #else
  1979. #define  LVM_FINDITEM           LVM_FINDITEMA
  1980. #endif
  1981.  
  1982. #define ListView_FindItem(hwnd, iStart, plvfi) \
  1983.     (int)SNDMSG((hwnd), LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LV_FINDINFO FAR*)(plvfi))
  1984.  
  1985. #define LVIR_BOUNDS             0
  1986. #define LVIR_ICON               1
  1987. #define LVIR_LABEL              2
  1988. #define LVIR_SELECTBOUNDS       3
  1989.  
  1990.  
  1991. #define LVM_GETITEMRECT         (LVM_FIRST + 14)
  1992. #define ListView_GetItemRect(hwnd, i, prc, code) \
  1993.      (BOOL)SNDMSG((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), \
  1994.            ((prc) ? (((RECT FAR *)(prc))->left = (code),(LPARAM)(RECT FAR*)(prc)) : (LPARAM)(RECT FAR*)NULL))
  1995.  
  1996.  
  1997. #define LVM_SETITEMPOSITION     (LVM_FIRST + 15)
  1998. #define ListView_SetItemPosition(hwndLV, i, x, y) \
  1999.     (BOOL)SNDMSG((hwndLV), LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y)))
  2000.  
  2001.  
  2002. #define LVM_GETITEMPOSITION     (LVM_FIRST + 16)
  2003. #define ListView_GetItemPosition(hwndLV, i, ppt) \
  2004.     (BOOL)SNDMSG((hwndLV), LVM_GETITEMPOSITION, (WPARAM)(int)(i), (LPARAM)(POINT FAR*)(ppt))
  2005.  
  2006.  
  2007. #define LVM_GETSTRINGWIDTHA     (LVM_FIRST + 17)
  2008. #define LVM_GETSTRINGWIDTHW     (LVM_FIRST + 87)
  2009. #ifdef UNICODE
  2010. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHW
  2011. #else
  2012. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHA
  2013. #endif
  2014.  
  2015. #define ListView_GetStringWidth(hwndLV, psz) \
  2016.     (int)SNDMSG((hwndLV), LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCTSTR)(psz))
  2017.  
  2018.  
  2019. #define LVHT_NOWHERE            0x0001
  2020. #define LVHT_ONITEMICON         0x0002
  2021. #define LVHT_ONITEMLABEL        0x0004
  2022. #define LVHT_ONITEMSTATEICON    0x0008
  2023. #define LVHT_ONITEM             (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
  2024.  
  2025. #define LVHT_ABOVE              0x0008
  2026. #define LVHT_BELOW              0x0010
  2027. #define LVHT_TORIGHT            0x0020
  2028. #define LVHT_TOLEFT             0x0040
  2029.  
  2030. typedef struct tagLVHITTESTINFO
  2031. {
  2032.     POINT pt;
  2033.     UINT flags;
  2034.     int iItem;
  2035.  
  2036.     int iSubItem;    // this is was NOT in win95.  valid only for LVM_SUBITEMHITTEST
  2037. } LVHITTESTINFO, FAR* LPLVHITTESTINFO;
  2038. #define LV_HITTESTINFO LVHITTESTINFO
  2039.  
  2040. #define LVM_HITTEST             (LVM_FIRST + 18)
  2041. #define ListView_HitTest(hwndLV, pinfo) \
  2042.     (int)SNDMSG((hwndLV), LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO FAR*)(pinfo))
  2043.  
  2044.  
  2045. #define LVM_ENSUREVISIBLE       (LVM_FIRST + 19)
  2046. #define ListView_EnsureVisible(hwndLV, i, fPartialOK) \
  2047.     (BOOL)SNDMSG((hwndLV), LVM_ENSUREVISIBLE, (WPARAM)(int)(i), MAKELPARAM((fPartialOK), 0))
  2048.  
  2049.  
  2050. #define LVM_SCROLL              (LVM_FIRST + 20)
  2051. #define ListView_Scroll(hwndLV, dx, dy) \
  2052.     (BOOL)SNDMSG((hwndLV), LVM_SCROLL, (WPARAM)(int)dx, (LPARAM)(int)dy)
  2053.  
  2054.  
  2055. #define LVM_REDRAWITEMS         (LVM_FIRST + 21)
  2056. #define ListView_RedrawItems(hwndLV, iFirst, iLast) \
  2057.     (BOOL)SNDMSG((hwndLV), LVM_REDRAWITEMS, (WPARAM)(int)iFirst, (LPARAM)(int)iLast)
  2058.  
  2059.  
  2060. #define LVA_DEFAULT             0x0000
  2061. #define LVA_ALIGNLEFT           0x0001
  2062. #define LVA_ALIGNTOP            0x0002
  2063. #define LVA_SNAPTOGRID          0x0005
  2064.  
  2065.  
  2066. #define LVM_ARRANGE             (LVM_FIRST + 22)
  2067. #define ListView_Arrange(hwndLV, code) \
  2068.     (BOOL)SNDMSG((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0L)
  2069.  
  2070.  
  2071. #define LVM_EDITLABELA          (LVM_FIRST + 23)
  2072. #define LVM_EDITLABELW          (LVM_FIRST + 118)
  2073. #ifdef UNICODE
  2074. #define LVM_EDITLABEL           LVM_EDITLABELW
  2075. #else
  2076. #define LVM_EDITLABEL           LVM_EDITLABELA
  2077. #endif
  2078.  
  2079. #define ListView_EditLabel(hwndLV, i) \
  2080.     (HWND)SNDMSG((hwndLV), LVM_EDITLABEL, (WPARAM)(int)(i), 0L)
  2081.  
  2082.  
  2083. #define LVM_GETEDITCONTROL      (LVM_FIRST + 24)
  2084. #define ListView_GetEditControl(hwndLV) \
  2085.     (HWND)SNDMSG((hwndLV), LVM_GETEDITCONTROL, 0, 0L)
  2086.  
  2087.  
  2088. typedef struct tagLVCOLUMNA
  2089. {
  2090.     UINT mask;
  2091.     int fmt;
  2092.     int cx;
  2093.     LPSTR pszText;
  2094.     int cchTextMax;
  2095.     int iSubItem;
  2096.     int iImage;
  2097.     int iOrder;
  2098. } LVCOLUMNA, FAR* LPLVCOLUMNA;
  2099.  
  2100. typedef struct tagLVCOLUMNW
  2101. {
  2102.     UINT mask;
  2103.     int fmt;
  2104.     int cx;
  2105.     LPWSTR pszText;
  2106.     int cchTextMax;
  2107.     int iSubItem;
  2108.     int iImage;
  2109.     int iOrder;
  2110. } LVCOLUMNW, FAR* LPLVCOLUMNW;
  2111.  
  2112. #ifdef UNICODE
  2113. #define  LVCOLUMN               LVCOLUMNW
  2114. #define  LPLVCOLUMN             LPLVCOLUMNW
  2115. #else
  2116. #define  LVCOLUMN               LVCOLUMNA
  2117. #define  LPLVCOLUMN             LPLVCOLUMNA
  2118. #endif
  2119.  
  2120. #define LV_COLUMN               LVCOLUMN
  2121. #define LV_COLUMNA              LVCOLUMNA
  2122. #define LV_COLUMNW              LVCOLUMNW
  2123.  
  2124.  
  2125. #define LVCF_FMT                0x0001
  2126. #define LVCF_WIDTH              0x0002
  2127. #define LVCF_TEXT               0x0004
  2128. #define LVCF_SUBITEM            0x0008
  2129. #define LVCF_IMAGE              0x0010
  2130. #define LVCF_ORDER              0x0020
  2131.  
  2132. #define LVCFMT_LEFT             0x0000
  2133. #define LVCFMT_RIGHT            0x0001
  2134. #define LVCFMT_CENTER           0x0002
  2135. #define LVCFMT_JUSTIFYMASK      0x0003
  2136. #define LVCFMT_IMAGE            0x0800
  2137. #define LVCFMT_BITMAP_ON_RIGHT  0x1000
  2138. #define LVCFMT_COL_HAS_IMAGES   0x8000
  2139.  
  2140.  
  2141. #define LVM_GETCOLUMNA          (LVM_FIRST + 25)
  2142. #define LVM_GETCOLUMNW          (LVM_FIRST + 95)
  2143. #ifdef UNICODE
  2144. #define  LVM_GETCOLUMN          LVM_GETCOLUMNW
  2145. #else
  2146. #define  LVM_GETCOLUMN          LVM_GETCOLUMNA
  2147. #endif
  2148.  
  2149. #define ListView_GetColumn(hwnd, iCol, pcol) \
  2150.     (BOOL)SNDMSG((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN FAR*)(pcol))
  2151.  
  2152.  
  2153. #define LVM_SETCOLUMNA          (LVM_FIRST + 26)
  2154. #define LVM_SETCOLUMNW          (LVM_FIRST + 96)
  2155. #ifdef UNICODE
  2156. #define  LVM_SETCOLUMN          LVM_SETCOLUMNW
  2157. #else
  2158. #define  LVM_SETCOLUMN          LVM_SETCOLUMNA
  2159. #endif
  2160.  
  2161. #define ListView_SetColumn(hwnd, iCol, pcol) \
  2162.     (BOOL)SNDMSG((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  2163.  
  2164.  
  2165. #define LVM_INSERTCOLUMNA       (LVM_FIRST + 27)
  2166. #define LVM_INSERTCOLUMNW       (LVM_FIRST + 97)
  2167. #ifdef UNICODE
  2168. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNW
  2169. #else
  2170. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNA
  2171. #endif
  2172.  
  2173. #define ListView_InsertColumn(hwnd, iCol, pcol) \
  2174.     (int)SNDMSG((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  2175.  
  2176.  
  2177. #define LVM_DELETECOLUMN        (LVM_FIRST + 28)
  2178. #define ListView_DeleteColumn(hwnd, iCol) \
  2179.     (BOOL)SNDMSG((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0)
  2180.  
  2181.  
  2182. #define LVM_GETCOLUMNWIDTH      (LVM_FIRST + 29)
  2183. #define ListView_GetColumnWidth(hwnd, iCol) \
  2184.     (int)SNDMSG((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0)
  2185.  
  2186.  
  2187. #define LVSCW_AUTOSIZE              -1
  2188. #define LVSCW_AUTOSIZE_USEHEADER    -2
  2189. #define LVM_SETCOLUMNWIDTH          (LVM_FIRST + 30)
  2190.  
  2191. #define ListView_SetColumnWidth(hwnd, iCol, cx) \
  2192.     (BOOL)SNDMSG((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0))
  2193.  
  2194. #define LVM_GETHEADER               (LVM_FIRST + 31)
  2195. #define ListView_GetHeader(hwnd)\
  2196.     (HWND)SNDMSG((hwnd), LVM_GETHEADER, 0, 0L)
  2197.  
  2198.  
  2199. #define LVM_CREATEDRAGIMAGE     (LVM_FIRST + 33)
  2200. #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
  2201.     (HIMAGELIST)SNDMSG((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
  2202.  
  2203.  
  2204. #define LVM_GETVIEWRECT         (LVM_FIRST + 34)
  2205. #define ListView_GetViewRect(hwnd, prc) \
  2206.     (BOOL)SNDMSG((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT FAR*)(prc))
  2207.  
  2208.  
  2209. #define LVM_GETTEXTCOLOR        (LVM_FIRST + 35)
  2210. #define ListView_GetTextColor(hwnd)  \
  2211.     (COLORREF)SNDMSG((hwnd), LVM_GETTEXTCOLOR, 0, 0L)
  2212.  
  2213.  
  2214. #define LVM_SETTEXTCOLOR        (LVM_FIRST + 36)
  2215. #define ListView_SetTextColor(hwnd, clrText) \
  2216.     (BOOL)SNDMSG((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  2217.  
  2218.  
  2219. #define LVM_GETTEXTBKCOLOR      (LVM_FIRST + 37)
  2220. #define ListView_GetTextBkColor(hwnd)  \
  2221.     (COLORREF)SNDMSG((hwnd), LVM_GETTEXTBKCOLOR, 0, 0L)
  2222.  
  2223.  
  2224. #define LVM_SETTEXTBKCOLOR      (LVM_FIRST + 38)
  2225. #define ListView_SetTextBkColor(hwnd, clrTextBk) \
  2226.     (BOOL)SNDMSG((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  2227.  
  2228.  
  2229. #define LVM_GETTOPINDEX         (LVM_FIRST + 39)
  2230. #define ListView_GetTopIndex(hwndLV) \
  2231.     (int)SNDMSG((hwndLV), LVM_GETTOPINDEX, 0, 0)
  2232.  
  2233.  
  2234. #define LVM_GETCOUNTPERPAGE     (LVM_FIRST + 40)
  2235. #define ListView_GetCountPerPage(hwndLV) \
  2236.     (int)SNDMSG((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)
  2237.  
  2238.  
  2239. #define LVM_GETORIGIN           (LVM_FIRST + 41)
  2240. #define ListView_GetOrigin(hwndLV, ppt) \
  2241.     (BOOL)SNDMSG((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT FAR*)(ppt))
  2242.  
  2243.  
  2244. #define LVM_UPDATE              (LVM_FIRST + 42)
  2245. #define ListView_Update(hwndLV, i) \
  2246.     (BOOL)SNDMSG((hwndLV), LVM_UPDATE, (WPARAM)i, 0L)
  2247.  
  2248.  
  2249. #define LVM_SETITEMSTATE        (LVM_FIRST + 43)
  2250. #define ListView_SetItemState(hwndLV, i, data, mask) \
  2251. { LV_ITEM _ms_lvi;\
  2252.   _ms_lvi.stateMask = mask;\
  2253.   _ms_lvi.state = data;\
  2254.   SNDMSG((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  2255. }
  2256.  
  2257.  
  2258. #define LVM_GETITEMSTATE        (LVM_FIRST + 44)
  2259. #define ListView_GetItemState(hwndLV, i, mask) \
  2260.    (UINT)SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask)
  2261.  
  2262. #define ListView_GetCheckState(hwndLV, i) \
  2263.    ((((UINT)(SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, LVIS_STATEIMAGEMASK))) >> 12) -1)
  2264.  
  2265.  
  2266. #define LVM_GETITEMTEXTA        (LVM_FIRST + 45)
  2267. #define LVM_GETITEMTEXTW        (LVM_FIRST + 115)
  2268.  
  2269. #ifdef UNICODE
  2270. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTW
  2271. #else
  2272. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTA
  2273. #endif
  2274.  
  2275. #define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  2276. { LV_ITEM _ms_lvi;\
  2277.   _ms_lvi.iSubItem = iSubItem_;\
  2278.   _ms_lvi.cchTextMax = cchTextMax_;\
  2279.   _ms_lvi.pszText = pszText_;\
  2280.   SNDMSG((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  2281. }
  2282.  
  2283.  
  2284. #define LVM_SETITEMTEXTA        (LVM_FIRST + 46)
  2285. #define LVM_SETITEMTEXTW        (LVM_FIRST + 116)
  2286.  
  2287. #ifdef UNICODE
  2288. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTW
  2289. #else
  2290. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTA
  2291. #endif
  2292.  
  2293. #define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) \
  2294. { LV_ITEM _ms_lvi;\
  2295.   _ms_lvi.iSubItem = iSubItem_;\
  2296.   _ms_lvi.pszText = pszText_;\
  2297.   SNDMSG((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  2298. }
  2299.  
  2300. // these flags only apply to LVS_OWNERDATA listviews in report or list mode
  2301. #define LVSICF_NOINVALIDATEALL  0x00000001
  2302. #define LVSICF_NOSCROLL         0x00000002
  2303.  
  2304. #define LVM_SETITEMCOUNT        (LVM_FIRST + 47)
  2305. #define ListView_SetItemCount(hwndLV, cItems) \
  2306.   SNDMSG((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0)
  2307.  
  2308. #define ListView_SetItemCountEx(hwndLV, cItems, dwFlags) \
  2309.   SNDMSG((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, (LPARAM)dwFlags)
  2310.  
  2311. typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
  2312.  
  2313.  
  2314. #define LVM_SORTITEMS           (LVM_FIRST + 48)
  2315. #define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) \
  2316.   (BOOL)SNDMSG((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, \
  2317.   (LPARAM)(PFNLVCOMPARE)_pfnCompare)
  2318.  
  2319.  
  2320. #define LVM_SETITEMPOSITION32   (LVM_FIRST + 49)
  2321. #define ListView_SetItemPosition32(hwndLV, i, x, y) \
  2322. { POINT ptNewPos = {x,y}; \
  2323.     SNDMSG((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); \
  2324. }
  2325.  
  2326.  
  2327. #define LVM_GETSELECTEDCOUNT    (LVM_FIRST + 50)
  2328. #define ListView_GetSelectedCount(hwndLV) \
  2329.     (UINT)SNDMSG((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
  2330.  
  2331.  
  2332. #define LVM_GETITEMSPACING      (LVM_FIRST + 51)
  2333. #define ListView_GetItemSpacing(hwndLV, fSmall) \
  2334.         (DWORD)SNDMSG((hwndLV), LVM_GETITEMSPACING, fSmall, 0L)
  2335.  
  2336.  
  2337. #define LVM_GETISEARCHSTRINGA   (LVM_FIRST + 52)
  2338. #define LVM_GETISEARCHSTRINGW   (LVM_FIRST + 117)
  2339.  
  2340. #ifdef UNICODE
  2341. #define LVM_GETISEARCHSTRING    LVM_GETISEARCHSTRINGW
  2342. #else
  2343. #define LVM_GETISEARCHSTRING    LVM_GETISEARCHSTRINGA
  2344. #endif
  2345.  
  2346. #define ListView_GetISearchString(hwndLV, lpsz) \
  2347.         (BOOL)SNDMSG((hwndLV), LVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  2348.  
  2349. #define LVM_SETICONSPACING      (LVM_FIRST + 53)
  2350. // -1 for cx and cy means we'll use the default (system settings)
  2351. // 0 for cx or cy means use the current setting (allows you to change just one param)
  2352. #define ListView_SetIconSpacing(hwndLV, cx, cy) \
  2353.         (DWORD)SNDMSG((hwndLV), LVM_SETICONSPACING, 0, MAKELONG(cx,cy))
  2354.  
  2355.  
  2356. #define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54)
  2357. #define ListView_SetExtendedListViewStyle(hwndLV, dw)\
  2358.         (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dw)
  2359.  
  2360. #define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 55)
  2361. #define ListView_GetExtendedListViewStyle(hwndLV)\
  2362.         (DWORD)SNDMSG((hwndLV), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
  2363.  
  2364. #define LVS_EX_GRIDLINES        0x00000001
  2365. #define LVS_EX_SUBITEMIMAGES    0x00000002
  2366. #define LVS_EX_CHECKBOXES       0x00000004
  2367. #define LVS_EX_TRACKSELECT      0x00000008
  2368. #define LVS_EX_HEADERDRAGDROP   0x00000010
  2369. #define LVS_EX_FULLROWSELECT    0x00000020 // applies to report mode only
  2370. #define LVS_EX_ONECLICKACTIVATE 0x00000040
  2371. #define LVS_EX_TWOCLICKACTIVATE 0x00000080
  2372.  
  2373.  
  2374. #define LVM_GETSUBITEMRECT      (LVM_FIRST + 56)
  2375. #define ListView_GetSubItemRect(hwnd, iItem, iSubItem, code, prc) \
  2376.         (BOOL)SNDMSG((hwnd), LVM_GETSUBITEMRECT, (WPARAM)(int)(iItem), \
  2377.                 ((prc) ? ((((LPRECT)(prc))->top = iSubItem), (((LPRECT)(prc))->left = code), (LPARAM)(prc)) : (LPARAM)(LPRECT)NULL))
  2378.  
  2379. #define LVM_SUBITEMHITTEST      (LVM_FIRST + 57)
  2380. #define ListView_SubItemHitTest(hwnd, plvhti) \
  2381.         (int)SNDMSG((hwnd), LVM_SUBITEMHITTEST, 0, (LPARAM)(LPLVHITTESTINFO)(plvhti))
  2382.  
  2383. #define LVM_SETCOLUMNORDERARRAY (LVM_FIRST + 58)
  2384. #define ListView_SetColumnOrderArray(hwnd, iCount, pi) \
  2385.         (BOOL)SNDMSG((hwnd), LVM_SETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi)
  2386.  
  2387. #define LVM_GETCOLUMNORDERARRAY (LVM_FIRST + 59)
  2388. #define ListView_GetColumnOrderArray(hwnd, iCount, pi) \
  2389.         (BOOL)SNDMSG((hwnd), LVM_GETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi)
  2390.  
  2391. #define LVM_SETHOTITEM  (LVM_FIRST + 60)
  2392. #define ListView_SetHotItem(hwnd, i) \
  2393.         (int)SNDMSG((hwnd), LVM_SETHOTITEM, (WPARAM)i, 0)
  2394.  
  2395. #define LVM_GETHOTITEM  (LVM_FIRST + 61)
  2396. #define ListView_GetHotItem(hwnd) \
  2397.         (int)SNDMSG((hwnd), LVM_GETHOTITEM, 0, 0)
  2398.  
  2399. #define LVM_SETHOTCURSOR  (LVM_FIRST + 62)
  2400. #define ListView_SetHotCursor(hwnd, hcur) \
  2401.         (HCURSOR)SNDMSG((hwnd), LVM_SETHOTCURSOR, 0, (LPARAM)hcur)
  2402.  
  2403. #define LVM_GETHOTCURSOR  (LVM_FIRST + 63)
  2404. #define ListView_GetHotCursor(hwnd) \
  2405.         (HCURSOR)SNDMSG((hwnd), LVM_GETHOTCURSOR, 0, 0)
  2406.  
  2407. #define LVM_APPROXIMATEVIEWRECT (LVM_FIRST + 64)
  2408. #define ListView_ApproximateViewRect(hwnd, iWidth, iHeight, iCount) \
  2409.         (DWORD)SNDMSG((hwnd), LVM_APPROXIMATEVIEWRECT, iCount, MAKELPARAM(iWidth, iHeight))
  2410.  
  2411. #define LVM_SETWORKAREA         (LVM_FIRST + 65)
  2412. #define ListView_SetWorkArea(hwnd, prc) \
  2413.     (BOOL)SNDMSG((hwnd), LVM_SETWORKAREA, 0, (LPARAM)(RECT FAR*)(prc))
  2414.  
  2415. typedef struct tagNMLISTVIEW
  2416. {
  2417.     NMHDR   hdr;
  2418.     int     iItem;
  2419.     int     iSubItem;
  2420.     UINT    uNewState;
  2421.     UINT    uOldState;
  2422.     UINT    uChanged;
  2423.     POINT   ptAction;
  2424.     LPARAM  lParam;
  2425. } NMLISTVIEW, FAR *LPNMLISTVIEW;
  2426.  
  2427. #define LPNM_LISTVIEW   LPNMLISTVIEW
  2428. #define NM_LISTVIEW     NMLISTVIEW
  2429.  
  2430. typedef struct tagNMLVCUSTOMDRAW
  2431. {
  2432.     NMCUSTOMDRAW nmcd;
  2433.     COLORREF clrText;
  2434.     COLORREF clrTextBk;
  2435. } NMLVCUSTOMDRAW, *LPNMLVCUSTOMDRAW;
  2436.  
  2437. typedef struct tagNMLVCACHEHINT
  2438. {
  2439.     NMHDR   hdr;
  2440.     int     iFrom;
  2441.     int     iTo;
  2442. } NMLVCACHEHINT, FAR *LPNMLVCACHEHINT;
  2443.  
  2444. #define LPNM_CACHEHINT  LPNMLVCACHEHINT
  2445. #define PNM_CACHEHINT   LPNMLVCACHEHINT
  2446. #define NM_CACHEHINT    NMLVCACHEHINT
  2447.  
  2448. typedef struct tagNMLVFINDITEM
  2449. {
  2450.     NMHDR   hdr;
  2451.     int     iStart;
  2452.     LVFINDINFO lvfi;
  2453. } NMLVFINDITEM, FAR *LPNMLVFINDITEM;
  2454.  
  2455. #define PNM_FINDITEM    LPNMLVFINDITEM
  2456. #define LPNM_FINDITEM   LPNMLVFINDITEM
  2457. #define NM_FINDITEM     NMLVFINDITEM
  2458.  
  2459. typedef struct tagNMLVODSTATECHANGE
  2460. {
  2461.     NMHDR hdr;
  2462.     int iFrom;
  2463.     int iTo;
  2464.     UINT uNewState;
  2465.     UINT uOldState;
  2466. } NMLVODSTATECHANGE, FAR *LPNMLVODSTATECHANGE;
  2467.  
  2468. #define PNM_ODSTATECHANGE   LPNMLVODSTATECHANGE
  2469. #define LPNM_ODSTATECHANGE  LPNMLVODSTATECHANGE
  2470. #define NM_ODSTATECHANGE    NMLVODSTATECHANGE  
  2471.  
  2472.  
  2473. #define LVN_ITEMCHANGING        (LVN_FIRST-0)
  2474. #define LVN_ITEMCHANGED         (LVN_FIRST-1)
  2475. #define LVN_INSERTITEM          (LVN_FIRST-2)
  2476. #define LVN_DELETEITEM          (LVN_FIRST-3)
  2477. #define LVN_DELETEALLITEMS      (LVN_FIRST-4)
  2478. #define LVN_BEGINLABELEDITA     (LVN_FIRST-5)
  2479. #define LVN_BEGINLABELEDITW     (LVN_FIRST-75)
  2480. #define LVN_ENDLABELEDITA       (LVN_FIRST-6)
  2481. #define LVN_ENDLABELEDITW       (LVN_FIRST-76)
  2482. #define LVN_COLUMNCLICK         (LVN_FIRST-8)
  2483. #define LVN_BEGINDRAG           (LVN_FIRST-9)
  2484. #define LVN_BEGINRDRAG          (LVN_FIRST-11)
  2485.  
  2486. #define LVN_ODCACHEHINT         (LVN_FIRST-13)
  2487. #define LVN_ODFINDITEMA         (LVN_FIRST-52)
  2488. #define LVN_ODFINDITEMW         (LVN_FIRST-79)
  2489.  
  2490. #define LVN_ITEMACTIVATE        (LVN_FIRST-14)
  2491. #define LVN_ODSTATECHANGED      (LVN_FIRST-15)
  2492.  
  2493. #ifdef UNICODE
  2494. #define LVN_ODFINDITEM          LVN_ODFINDITEMW
  2495. #else
  2496. #define LVN_ODFINDITEM          LVN_ODFINDITEMA
  2497. #endif
  2498.  
  2499.  
  2500.  
  2501. #define LVN_GETDISPINFOA        (LVN_FIRST-50)
  2502. #define LVN_GETDISPINFOW        (LVN_FIRST-77)
  2503. #define LVN_SETDISPINFOA        (LVN_FIRST-51)
  2504. #define LVN_SETDISPINFOW        (LVN_FIRST-78)
  2505.  
  2506. #ifdef UNICODE
  2507. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITW
  2508. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITW
  2509. #define LVN_GETDISPINFO         LVN_GETDISPINFOW
  2510. #define LVN_SETDISPINFO         LVN_SETDISPINFOW
  2511. #else
  2512. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITA
  2513. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITA
  2514. #define LVN_GETDISPINFO         LVN_GETDISPINFOA
  2515. #define LVN_SETDISPINFO         LVN_SETDISPINFOA
  2516. #endif
  2517.  
  2518.  
  2519.  
  2520.  
  2521. #define LVIF_DI_SETITEM         0x1000
  2522.  
  2523. typedef struct tagLVDISPINFO {
  2524.     NMHDR hdr;
  2525.     LVITEMA item;
  2526. } NMLVDISPINFOA, FAR *LPNMLVDISPINFOA;
  2527.  
  2528. typedef struct tagLVDISPINFOW {
  2529.     NMHDR hdr;
  2530.     LVITEMW item;
  2531. } NMLVDISPINFOW, FAR * LPNMLVDISPINFOW;
  2532.  
  2533. #define LV_DISPINFOA    NMLVDISPINFOA
  2534. #define LV_DISPINFOW    NMLVDISPINFOW
  2535. #define LV_DISPINFO     NMLVDISPINFO
  2536.  
  2537. #ifdef UNICODE
  2538. #define  NMLVDISPINFO           NMLVDISPINFOW
  2539. #else
  2540. #define  NMLVDISPINFO           NMLVDISPINFOA
  2541. #endif
  2542.  
  2543. #define LVN_KEYDOWN             (LVN_FIRST-55)
  2544.  
  2545. typedef struct tagLVKEYDOWN
  2546. {
  2547.     NMHDR hdr;
  2548.     WORD wVKey;
  2549.     UINT flags;
  2550. } NMLVKEYDOWN, FAR *LPNMLVKEYDOWN;
  2551. #define LV_KEYDOWN              NMLVKEYDOWN
  2552.  
  2553. #define LVN_MARQUEEBEGIN        (LVN_FIRST-56)
  2554.  
  2555. #endif
  2556.  
  2557. //====== TREEVIEW CONTROL =====================================================
  2558.  
  2559. #ifndef NOTREEVIEW
  2560.  
  2561. #ifdef _WIN32
  2562. #define WC_TREEVIEWA            "SysTreeView32"
  2563. #define WC_TREEVIEWW            L"SysTreeView32"
  2564.  
  2565. #ifdef UNICODE
  2566. #define  WC_TREEVIEW            WC_TREEVIEWW
  2567. #else
  2568. #define  WC_TREEVIEW            WC_TREEVIEWA
  2569. #endif
  2570.  
  2571. #else
  2572. #define WC_TREEVIEW             "SysTreeView"
  2573. #endif
  2574.  
  2575. #define TVS_HASBUTTONS          0x0001
  2576. #define TVS_HASLINES            0x0002
  2577. #define TVS_LINESATROOT         0x0004
  2578. #define TVS_EDITLABELS          0x0008
  2579. #define TVS_DISABLEDRAGDROP     0x0010
  2580. #define TVS_SHOWSELALWAYS       0x0020
  2581. #define TVS_RTLREADING          0x0040
  2582.  
  2583. #define TVS_NOTOOLTIPS          0x0080
  2584. #define TVS_CHECKBOXES          0x0100
  2585. #define TVS_TRACKSELECT         0x0200
  2586.  
  2587. #define TVS_SHAREDIMAGELISTS    0x0000
  2588. #define TVS_PRIVATEIMAGELISTS   0x0400
  2589.  
  2590. typedef struct _TREEITEM FAR* HTREEITEM;
  2591.  
  2592. #define TVIF_TEXT               0x0001
  2593. #define TVIF_IMAGE              0x0002
  2594. #define TVIF_PARAM              0x0004
  2595. #define TVIF_STATE              0x0008
  2596. #define TVIF_HANDLE             0x0010
  2597. #define TVIF_SELECTEDIMAGE      0x0020
  2598. #define TVIF_CHILDREN           0x0040
  2599.  
  2600. #define TVIS_SELECTED           0x0002
  2601. #define TVIS_CUT                0x0004
  2602. #define TVIS_DROPHILITED        0x0008
  2603. #define TVIS_BOLD               0x0010
  2604. #define TVIS_EXPANDED           0x0020
  2605. #define TVIS_EXPANDEDONCE       0x0040
  2606. #define TVIS_EXPANDPARTIAL      0x0080
  2607.  
  2608. #define TVIS_OVERLAYMASK        0x0F00
  2609. #define TVIS_STATEIMAGEMASK     0xF000
  2610. #define TVIS_USERMASK           0xF000
  2611.  
  2612.  
  2613. #define I_CHILDRENCALLBACK  (-1)
  2614.  
  2615. typedef struct tagTVITEMA {
  2616.     UINT      mask;
  2617.     HTREEITEM hItem;
  2618.     UINT      state;
  2619.     UINT      stateMask;
  2620.     LPSTR     pszText;
  2621.     int       cchTextMax;
  2622.     int       iImage;
  2623.     int       iSelectedImage;
  2624.     int       cChildren;
  2625.     LPARAM    lParam;
  2626. } TVITEMA, FAR *LPTVITEMA;
  2627.  
  2628. typedef struct tagTVITEMW {
  2629.     UINT      mask;
  2630.     HTREEITEM hItem;
  2631.     UINT      state;
  2632.     UINT      stateMask;
  2633.     LPWSTR    pszText;
  2634.     int       cchTextMax;
  2635.     int       iImage;
  2636.     int       iSelectedImage;
  2637.     int       cChildren;
  2638.     LPARAM    lParam;
  2639. } TVITEMW, FAR *LPTVITEMW;
  2640.  
  2641. #define LPTV_ITEMW              LPTVITEMW
  2642. #define LPTV_ITEMA              LPTVITEMA
  2643. #define LPTV_ITEM               LPTVITEM
  2644. #define TV_ITEMW                TVITEMW
  2645. #define TV_ITEMA                TVITEMA
  2646. #define TV_ITEM                 TVITEM
  2647.  
  2648. #ifdef UNICODE
  2649. #define  TVITEM                 TVITEMW
  2650. #define  LPTVITEM               LPTVITEMW
  2651. #else
  2652. #define  TVITEM                 TVITEMA
  2653. #define  LPTVITEM               LPTVITEMA
  2654. #endif
  2655.  
  2656.  
  2657. #define TVI_ROOT                ((HTREEITEM)0xFFFF0000)
  2658. #define TVI_FIRST               ((HTREEITEM)0xFFFF0001)
  2659. #define TVI_LAST                ((HTREEITEM)0xFFFF0002)
  2660. #define TVI_SORT                ((HTREEITEM)0xFFFF0003)
  2661.  
  2662. typedef struct tagTVINSERTSTRUCTA {
  2663.     HTREEITEM hParent;
  2664.     HTREEITEM hInsertAfter;
  2665.     TV_ITEMA item;
  2666. } TVINSERTSTRUCTA, FAR *LPTVINSERTSTRUCTA;
  2667.  
  2668. typedef struct tagTVINSERTSTRUCTW {
  2669.     HTREEITEM hParent;
  2670.     HTREEITEM hInsertAfter;
  2671.     TV_ITEMW item;
  2672. } TVINSERTSTRUCTW, FAR *LPTVINSERTSTRUCTW;
  2673.  
  2674. #define LPTV_INSERTSTRUCTA      LPTVINSERTSTRUCTA
  2675. #define LPTV_INSERTSTRUCTW      LPTVINSERTSTRUCTW
  2676. #define LPTV_INSERTSTRUCT       LPTVINSERTSTRUCT
  2677. #define TV_INSERTSTRUCTA        TVINSERTSTRUCTA
  2678. #define TV_INSERTSTRUCTW        TVINSERTSTRUCTW
  2679. #define TV_INSERTSTRUCT         TVINSERTSTRUCT
  2680.  
  2681. #ifdef UNICODE
  2682. #define  TVINSERTSTRUCT         TVINSERTSTRUCTW
  2683. #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTW
  2684. #else
  2685. #define  TVINSERTSTRUCT         TVINSERTSTRUCTA
  2686. #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTA
  2687. #endif
  2688.  
  2689. #define TVM_INSERTITEMA         (TV_FIRST + 0)
  2690. #define TVM_INSERTITEMW         (TV_FIRST + 50)
  2691. #ifdef UNICODE
  2692. #define  TVM_INSERTITEM         TVM_INSERTITEMW
  2693. #else
  2694. #define  TVM_INSERTITEM         TVM_INSERTITEMA
  2695. #endif
  2696.  
  2697. #define TreeView_InsertItem(hwnd, lpis) \
  2698.     (HTREEITEM)SNDMSG((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis))
  2699.  
  2700.  
  2701. #define TVM_DELETEITEM          (TV_FIRST + 1)
  2702. #define TreeView_DeleteItem(hwnd, hitem) \
  2703.     (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem))
  2704.  
  2705.  
  2706. #define TreeView_DeleteAllItems(hwnd) \
  2707.     (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT)
  2708.  
  2709.  
  2710. #define TVM_EXPAND              (TV_FIRST + 2)
  2711. #define TreeView_Expand(hwnd, hitem, code) \
  2712.     (BOOL)SNDMSG((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2713.  
  2714.  
  2715. #define TVE_COLLAPSE            0x0001
  2716. #define TVE_EXPAND              0x0002
  2717. #define TVE_TOGGLE              0x0003
  2718. #define TVE_EXPANDPARTIAL       0x4000
  2719. #define TVE_COLLAPSERESET       0x8000
  2720.  
  2721.  
  2722. #define TVM_GETITEMRECT         (TV_FIRST + 4)
  2723. #define TreeView_GetItemRect(hwnd, hitem, prc, code) \
  2724.     (*(HTREEITEM FAR *)prc = (hitem), (BOOL)SNDMSG((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT FAR*)(prc)))
  2725.  
  2726.  
  2727. #define TVM_GETCOUNT            (TV_FIRST + 5)
  2728. #define TreeView_GetCount(hwnd) \
  2729.     (UINT)SNDMSG((hwnd), TVM_GETCOUNT, 0, 0)
  2730.  
  2731.  
  2732. #define TVM_GETINDENT           (TV_FIRST + 6)
  2733. #define TreeView_GetIndent(hwnd) \
  2734.     (UINT)SNDMSG((hwnd), TVM_GETINDENT, 0, 0)
  2735.  
  2736.  
  2737. #define TVM_SETINDENT           (TV_FIRST + 7)
  2738. #define TreeView_SetIndent(hwnd, indent) \
  2739.     (BOOL)SNDMSG((hwnd), TVM_SETINDENT, (WPARAM)indent, 0)
  2740.  
  2741.  
  2742. #define TVM_GETIMAGELIST        (TV_FIRST + 8)
  2743. #define TreeView_GetImageList(hwnd, iImage) \
  2744.     (HIMAGELIST)SNDMSG((hwnd), TVM_GETIMAGELIST, iImage, 0)
  2745.  
  2746.  
  2747. #define TVSIL_NORMAL            0
  2748. #define TVSIL_STATE             2
  2749.  
  2750.  
  2751. #define TVM_SETIMAGELIST        (TV_FIRST + 9)
  2752. #define TreeView_SetImageList(hwnd, himl, iImage) \
  2753.     (HIMAGELIST)SNDMSG((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl))
  2754.  
  2755.  
  2756. #define TVM_GETNEXTITEM         (TV_FIRST + 10)
  2757. #define TreeView_GetNextItem(hwnd, hitem, code) \
  2758.     (HTREEITEM)SNDMSG((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2759.  
  2760.  
  2761. #define TVGN_ROOT               0x0000
  2762. #define TVGN_NEXT               0x0001
  2763. #define TVGN_PREVIOUS           0x0002
  2764. #define TVGN_PARENT             0x0003
  2765. #define TVGN_CHILD              0x0004
  2766. #define TVGN_FIRSTVISIBLE       0x0005
  2767. #define TVGN_NEXTVISIBLE        0x0006
  2768. #define TVGN_PREVIOUSVISIBLE    0x0007
  2769. #define TVGN_DROPHILITE         0x0008
  2770. #define TVGN_CARET              0x0009
  2771.  
  2772. #define TreeView_GetChild(hwnd, hitem)          TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)
  2773. #define TreeView_GetNextSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)
  2774. #define TreeView_GetPrevSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)
  2775. #define TreeView_GetParent(hwnd, hitem)         TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)
  2776. #define TreeView_GetFirstVisible(hwnd)          TreeView_GetNextItem(hwnd, NULL,  TVGN_FIRSTVISIBLE)
  2777. #define TreeView_GetNextVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE)
  2778. #define TreeView_GetPrevVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE)
  2779. #define TreeView_GetSelection(hwnd)             TreeView_GetNextItem(hwnd, NULL,  TVGN_CARET)
  2780. #define TreeView_GetDropHilight(hwnd)           TreeView_GetNextItem(hwnd, NULL,  TVGN_DROPHILITE)
  2781. #define TreeView_GetRoot(hwnd)                  TreeView_GetNextItem(hwnd, NULL,  TVGN_ROOT)
  2782.  
  2783.  
  2784. #define TVM_SELECTITEM          (TV_FIRST + 11)
  2785. #define TreeView_Select(hwnd, hitem, code) \
  2786.     (HTREEITEM)SNDMSG((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2787.  
  2788.  
  2789. #define TreeView_SelectItem(hwnd, hitem)            TreeView_Select(hwnd, hitem, TVGN_CARET)
  2790. #define TreeView_SelectDropTarget(hwnd, hitem)      TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
  2791. #define TreeView_SelectSetFirstVisible(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
  2792.  
  2793.  
  2794. #define TVM_GETITEMA            (TV_FIRST + 12)
  2795. #define TVM_GETITEMW            (TV_FIRST + 62)
  2796.  
  2797. #ifdef UNICODE
  2798. #define  TVM_GETITEM            TVM_GETITEMW
  2799. #else
  2800. #define  TVM_GETITEM            TVM_GETITEMA
  2801. #endif
  2802.  
  2803. #define TreeView_GetItem(hwnd, pitem) \
  2804.     (BOOL)SNDMSG((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM FAR*)(pitem))
  2805.  
  2806.  
  2807. #define TVM_SETITEMA            (TV_FIRST + 13)
  2808. #define TVM_SETITEMW            (TV_FIRST + 63)
  2809.  
  2810. #ifdef UNICODE
  2811. #define  TVM_SETITEM            TVM_SETITEMW
  2812. #else
  2813. #define  TVM_SETITEM            TVM_SETITEMA
  2814. #endif
  2815.  
  2816. #define TreeView_SetItem(hwnd, pitem) \
  2817.     (BOOL)SNDMSG((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM FAR*)(pitem))
  2818.  
  2819.  
  2820. #define TVM_EDITLABELA          (TV_FIRST + 14)
  2821. #define TVM_EDITLABELW          (TV_FIRST + 65)
  2822. #ifdef UNICODE
  2823. #define TVM_EDITLABEL           TVM_EDITLABELW
  2824. #else
  2825. #define TVM_EDITLABEL           TVM_EDITLABELA
  2826. #endif
  2827.  
  2828. #define TreeView_EditLabel(hwnd, hitem) \
  2829.     (HWND)SNDMSG((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
  2830.  
  2831.  
  2832. #define TVM_GETEDITCONTROL      (TV_FIRST + 15)
  2833. #define TreeView_GetEditControl(hwnd) \
  2834.     (HWND)SNDMSG((hwnd), TVM_GETEDITCONTROL, 0, 0)
  2835.  
  2836.  
  2837. #define TVM_GETVISIBLECOUNT     (TV_FIRST + 16)
  2838. #define TreeView_GetVisibleCount(hwnd) \
  2839.     (UINT)SNDMSG((hwnd), TVM_GETVISIBLECOUNT, 0, 0)
  2840.  
  2841.  
  2842. #define TVM_HITTEST             (TV_FIRST + 17)
  2843. #define TreeView_HitTest(hwnd, lpht) \
  2844.     (HTREEITEM)SNDMSG((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
  2845.  
  2846.  
  2847. typedef struct tagTVHITTESTINFO {
  2848.     POINT       pt;
  2849.     UINT        flags;
  2850.     HTREEITEM   hItem;
  2851. } TVHITTESTINFO, FAR *LPTVHITTESTINFO;
  2852. #define LPTV_HITTESTINFO        LPTVHITTESTINFO
  2853. #define TV_HITTESTINFO  TVHITTESTINFO
  2854.  
  2855. #define TVHT_NOWHERE            0x0001
  2856. #define TVHT_ONITEMICON         0x0002
  2857. #define TVHT_ONITEMLABEL        0x0004
  2858. #define TVHT_ONITEM             (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
  2859. #define TVHT_ONITEMINDENT       0x0008
  2860. #define TVHT_ONITEMBUTTON       0x0010
  2861. #define TVHT_ONITEMRIGHT        0x0020
  2862. #define TVHT_ONITEMSTATEICON    0x0040
  2863.  
  2864. #define TVHT_ABOVE              0x0100
  2865. #define TVHT_BELOW              0x0200
  2866. #define TVHT_TORIGHT            0x0400
  2867. #define TVHT_TOLEFT             0x0800
  2868.  
  2869.  
  2870. #define TVM_CREATEDRAGIMAGE     (TV_FIRST + 18)
  2871. #define TreeView_CreateDragImage(hwnd, hitem) \
  2872.     (HIMAGELIST)SNDMSG((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem))
  2873.  
  2874.  
  2875. #define TVM_SORTCHILDREN        (TV_FIRST + 19)
  2876. #define TreeView_SortChildren(hwnd, hitem, recurse) \
  2877.     (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem))
  2878.  
  2879.  
  2880. #define TVM_ENSUREVISIBLE       (TV_FIRST + 20)
  2881. #define TreeView_EnsureVisible(hwnd, hitem) \
  2882.     (BOOL)SNDMSG((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem))
  2883.  
  2884.  
  2885. #define TVM_SORTCHILDRENCB      (TV_FIRST + 21)
  2886. #define TreeView_SortChildrenCB(hwnd, psort, recurse) \
  2887.     (BOOL)SNDMSG((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \
  2888.     (LPARAM)(LPTV_SORTCB)(psort))
  2889.  
  2890.  
  2891. #define TVM_ENDEDITLABELNOW     (TV_FIRST + 22)
  2892. #define TreeView_EndEditLabelNow(hwnd, fCancel) \
  2893.     (BOOL)SNDMSG((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0)
  2894.  
  2895.  
  2896. #define TVM_GETISEARCHSTRINGA   (TV_FIRST + 23)
  2897. #define TVM_GETISEARCHSTRINGW   (TV_FIRST + 64)
  2898.  
  2899. #ifdef UNICODE
  2900. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGW
  2901. #else
  2902. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGA
  2903. #endif
  2904.  
  2905. #define TVM_SETTOOLTIPS         (TV_FIRST + 24)
  2906. #define TVM_GETTOOLTIPS         (TV_FIRST + 25)
  2907.  
  2908. #define TreeView_GetISearchString(hwndTV, lpsz) \
  2909.         (BOOL)SNDMSG((hwndTV), TVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  2910.  
  2911.  
  2912. typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  2913. typedef struct tagTVSORTCB
  2914. {
  2915.         HTREEITEM       hParent;
  2916.         PFNTVCOMPARE    lpfnCompare;
  2917.         LPARAM          lParam;
  2918. } TVSORTCB, FAR *LPTVSORTCB;
  2919. #define LPTV_SORTCB             LPTVSORTCB
  2920. #define TV_SORTCB               TVSORTCB
  2921.  
  2922.  
  2923. typedef struct tagNMTREEVIEWA {
  2924.     NMHDR       hdr;
  2925.     UINT        action;
  2926.     TVITEMA    itemOld;
  2927.     TVITEMA    itemNew;
  2928.     POINT       ptDrag;
  2929. } NMTREEVIEWA, FAR *LPNMTREEVIEWA;
  2930.  
  2931.  
  2932. typedef struct tagNMTREEVIEWW {
  2933.     NMHDR       hdr;
  2934.     UINT        action;
  2935.     TVITEMW    itemOld;
  2936.     TVITEMW    itemNew;
  2937.     POINT       ptDrag;
  2938. } NMTREEVIEWW, FAR *LPNMTREEVIEWW;
  2939.  
  2940. #define LPNM_TREEVIEWA          LPNMTREEVIEWA
  2941. #define LPNM_TREEVIEWW          LPNMTREEVIEWW
  2942. #define LPNM_TREEVIEW           LPNMTREEVIEW
  2943. #define NM_TREEVIEWW            NMTREEVIEWW
  2944. #define NM_TREEVIEWA            NMTREEVIEWA
  2945. #define NM_TREEVIEW             NMTREEVIEW
  2946.  
  2947. #ifdef UNICODE
  2948. #define  NMTREEVIEW             NMTREEVIEWW
  2949. #define  LPNMTREEVIEW           LPNMTREEVIEWW
  2950. #else
  2951. #define  NMTREEVIEW             NMTREEVIEWA
  2952. #define  LPNMTREEVIEW           LPNMTREEVIEWA
  2953. #endif
  2954.  
  2955.  
  2956. #define TVN_SELCHANGINGA        (TVN_FIRST-1)
  2957. #define TVN_SELCHANGINGW        (TVN_FIRST-50)
  2958. #define TVN_SELCHANGEDA         (TVN_FIRST-2)
  2959. #define TVN_SELCHANGEDW         (TVN_FIRST-51)
  2960.  
  2961. #define TVC_UNKNOWN             0x0000
  2962. #define TVC_BYMOUSE             0x0001
  2963. #define TVC_BYKEYBOARD          0x0002
  2964.  
  2965. #define TVN_GETDISPINFOA        (TVN_FIRST-3)
  2966. #define TVN_GETDISPINFOW        (TVN_FIRST-52)
  2967. #define TVN_SETDISPINFOA        (TVN_FIRST-4)
  2968. #define TVN_SETDISPINFOW        (TVN_FIRST-53)
  2969.  
  2970. #define TVIF_DI_SETITEM         0x1000
  2971.  
  2972. typedef struct tagTVDISPINFOA {
  2973.     NMHDR hdr;
  2974.     TVITEMA item;
  2975. } NMTVDISPINFOA, FAR *LPNMTVDISPINFOA;
  2976.  
  2977. typedef struct tagTVDISPINFOW {
  2978.     NMHDR hdr;
  2979.     TVITEMW item;
  2980. } NMTVDISPINFOW, FAR *LPNMTVDISPINFOW;
  2981.  
  2982. #define TV_DISPINFOA            NMTVDISPINFOA
  2983. #define TV_DISPINFOW            NMTVDISPINFOW
  2984. #define TV_DISPINFO             NMTVDISPINFO
  2985.  
  2986. #ifdef UNICODE
  2987. #define NMTVDISPINFO            NMTVDISPINFOW
  2988. #define LPNMTVDISPINFO          LPNMTVDISPINFOW
  2989. #else
  2990. #define NMTVDISPINFO            NMTVDISPINFOA
  2991. #define LPNMTVDISPINFO          LPNMTVDISPINFOA
  2992. #endif
  2993.  
  2994. #define TVN_ITEMEXPANDINGA      (TVN_FIRST-5)
  2995. #define TVN_ITEMEXPANDINGW      (TVN_FIRST-54)
  2996. #define TVN_ITEMEXPANDEDA       (TVN_FIRST-6)
  2997. #define TVN_ITEMEXPANDEDW       (TVN_FIRST-55)
  2998. #define TVN_BEGINDRAGA          (TVN_FIRST-7)
  2999. #define TVN_BEGINDRAGW          (TVN_FIRST-56)
  3000. #define TVN_BEGINRDRAGA         (TVN_FIRST-8)
  3001. #define TVN_BEGINRDRAGW         (TVN_FIRST-57)
  3002. #define TVN_DELETEITEMA         (TVN_FIRST-9)
  3003. #define TVN_DELETEITEMW         (TVN_FIRST-58)
  3004. #define TVN_BEGINLABELEDITA     (TVN_FIRST-10)
  3005. #define TVN_BEGINLABELEDITW     (TVN_FIRST-59)
  3006. #define TVN_ENDLABELEDITA       (TVN_FIRST-11)
  3007. #define TVN_ENDLABELEDITW       (TVN_FIRST-60)
  3008. #define TVN_KEYDOWN             (TVN_FIRST-12)
  3009.  
  3010. typedef struct tagTVKEYDOWN {
  3011.     NMHDR hdr;
  3012.     WORD wVKey;
  3013.     UINT flags;
  3014. } NMTVKEYDOWN, FAR *LPNMTVKEYDOWN;
  3015.  
  3016. #define TV_KEYDOWN      NMTVKEYDOWN
  3017.  
  3018. #ifdef UNICODE
  3019. #define TVN_SELCHANGING         TVN_SELCHANGINGW
  3020. #define TVN_SELCHANGED          TVN_SELCHANGEDW
  3021. #define TVN_GETDISPINFO         TVN_GETDISPINFOW
  3022. #define TVN_SETDISPINFO         TVN_SETDISPINFOW
  3023. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGW
  3024. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDW
  3025. #define TVN_BEGINDRAG           TVN_BEGINDRAGW
  3026. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGW
  3027. #define TVN_DELETEITEM          TVN_DELETEITEMW
  3028. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITW
  3029. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITW
  3030. #else
  3031. #define TVN_SELCHANGING         TVN_SELCHANGINGA
  3032. #define TVN_SELCHANGED          TVN_SELCHANGEDA
  3033. #define TVN_GETDISPINFO         TVN_GETDISPINFOA
  3034. #define TVN_SETDISPINFO         TVN_SETDISPINFOA
  3035. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGA
  3036. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDA
  3037. #define TVN_BEGINDRAG           TVN_BEGINDRAGA
  3038. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGA
  3039. #define TVN_DELETEITEM          TVN_DELETEITEMA
  3040. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITA
  3041. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITA
  3042. #endif
  3043.  
  3044. typedef struct tagNMTVCUSTOMDRAW
  3045. {
  3046.     NMCUSTOMDRAW nmcd;
  3047.     COLORREF     clrText;
  3048.     COLORREF     clrTextBk;
  3049. } NMTVCUSTOMDRAW, *LPNMTVCUSTOMDRAW;
  3050.  
  3051. #endif
  3052.  
  3053.  
  3054. #ifndef NOUSEREXCONTROLS
  3055.  
  3056. ////////////////////  ComboBoxEx ////////////////////////////////
  3057.  
  3058.  
  3059. #define WC_COMBOBOXEXW         L"ComboBoxEx32"
  3060. #define WC_COMBOBOXEXA         "ComboBoxEx32"
  3061.  
  3062. #ifdef UNICODE
  3063. #define WC_COMBOBOXEX          WC_COMBOBOXEXW
  3064. #else
  3065. #define WC_COMBOBOXEX          WC_COMBOBOXEXA
  3066. #endif
  3067.  
  3068.  
  3069. #define CBEIF_TEXT              0x00000001
  3070. #define CBEIF_IMAGE             0x00000002
  3071. #define CBEIF_SELECTEDIMAGE     0x00000004
  3072. #define CBEIF_OVERLAY           0x00000008
  3073. #define CBEIF_INDENT            0x00000010
  3074. #define CBEIF_LPARAM            0x00000020
  3075.  
  3076. #define CBEIF_DI_SETITEM        0x10000000
  3077.  
  3078. typedef struct tagCOMBOBOXEXITEMA
  3079. {
  3080.     UINT mask;
  3081.     int iItem;
  3082.     LPSTR pszText;
  3083.     int cchTextMax;
  3084.     int iImage;
  3085.     int iSelectedImage;
  3086.     int iOverlay;
  3087.     int iIndent;
  3088.     LPARAM lParam;
  3089. } COMBOBOXEXITEMA, *PCOMBOBOXEXITEMA;
  3090. typedef COMBOBOXEXITEMA CONST *PCCOMBOEXITEMA;
  3091.  
  3092.  
  3093. typedef struct tagCOMBOBOXEXITEMW
  3094. {
  3095.     UINT mask;
  3096.     int iItem;
  3097.     LPWSTR pszText;
  3098.     int cchTextMax;
  3099.     int iImage;
  3100.     int iSelectedImage;
  3101.     int iOverlay;
  3102.     int iIndent;
  3103.     LPARAM lParam;
  3104. } COMBOBOXEXITEMW, *PCOMBOBOXEXITEMW;
  3105. typedef COMBOBOXEXITEMW CONST *PCCOMBOEXITEMW;
  3106.  
  3107. #ifdef UNICODE
  3108. #define COMBOBOXEXITEM            COMBOBOXEXITEMW
  3109. #define PCOMBOBOXEXITEM           PCOMBOBOXEXITEMW
  3110. #define PCCOMBOBOXEXITEM          PCCOMBOBOXEXITEMW
  3111. #else
  3112. #define COMBOBOXEXITEM            COMBOBOXEXITEMA
  3113. #define PCOMBOBOXEXITEM           PCOMBOBOXEXITEMA
  3114. #define PCCOMBOBOXEXITEM          PCCOMBOBOXEXITEMA
  3115. #endif
  3116.  
  3117. #define CBEM_INSERTITEMA        (WM_USER + 1)
  3118. #define CBEM_SETIMAGELIST       (WM_USER + 2)
  3119. #define CBEM_GETIMAGELIST       (WM_USER + 3)
  3120. #define CBEM_GETITEMA           (WM_USER + 4)
  3121. #define CBEM_SETITEMA           (WM_USER + 5)
  3122. #define CBEM_DELETEITEM         CB_DELETESTRING
  3123. #define CBEM_GETCOMBOCONTROL    (WM_USER + 6)
  3124. #define CBEM_GETEDITCONTROL     (WM_USER + 7)
  3125. #define CBEM_SETEXSTYLE         (WM_USER + 8)
  3126. #define CBEM_GETEXSTYLE         (WM_USER + 9)
  3127. #define CBEM_HASEDITCHANGED     (WM_USER + 10)
  3128. #define CBEM_INSERTITEMW        (WM_USER + 11)
  3129. #define CBEM_SETITEMW           (WM_USER + 12)
  3130. #define CBEM_GETITEMW           (WM_USER + 13)
  3131.  
  3132. #ifdef UNICODE
  3133. #define CBEM_INSERTITEM         CBEM_INSERTITEMW
  3134. #define CBEM_SETITEM            CBEM_SETITEMW
  3135. #define CBEM_GETITEM            CBEM_GETITEMW
  3136. #else
  3137. #define CBEM_INSERTITEM         CBEM_INSERTITEMA
  3138. #define CBEM_SETITEM            CBEM_SETITEMA
  3139. #define CBEM_GETITEM            CBEM_GETITEMA
  3140. #endif
  3141.  
  3142. #define CBES_EX_NOEDITIMAGE          0x00000001
  3143. #define CBES_EX_NOEDITIMAGEINDENT    0x00000002
  3144. #define CBES_EX_PATHWORDBREAKPROC    0x00000004
  3145.  
  3146.  
  3147. typedef struct {
  3148.     NMHDR hdr;
  3149.     COMBOBOXEXITEM ceItem;
  3150. } NMCOMBOBOXEX, *PNMCOMBOBOXEX;
  3151.  
  3152.  
  3153. #define CBEN_GETDISPINFO        (CBEN_FIRST - 0)
  3154. #define CBEN_INSERTITEM         (CBEN_FIRST - 1)
  3155. #define CBEN_DELETEITEM         (CBEN_FIRST - 2)
  3156. #define CBEN_BEGINEDIT          (CBEN_FIRST - 4)
  3157. #define CBEN_ENDEDITA            (CBEN_FIRST - 5)
  3158. #define CBEN_ENDEDITW            (CBEN_FIRST - 6)
  3159.         // lParam specifies why the endedit is happening
  3160. #ifdef UNICODE
  3161. #define CBEN_ENDEDIT CBEN_ENDEDITW
  3162. #else
  3163. #define CBEN_ENDEDIT CBEN_ENDEDITA
  3164. #endif
  3165. #define CBENF_KILLFOCUS         1
  3166. #define CBENF_RETURN            2
  3167. #define CBENF_ESCAPE            3
  3168. #define CBENF_DROPDOWN          4
  3169.  
  3170. #define CBEMAXSTRLEN 260
  3171.  
  3172. // CBEN_ENDEDIT sends this information...
  3173. // fChanged if the user actually did anything
  3174. // iNewSelection gives what would be the new selection unless the notify is failed
  3175. //                      iNewSelection may be CB_ERR if there's no match
  3176. typedef struct {
  3177.         NMHDR hdr;
  3178.         BOOL fChanged;
  3179.         int iNewSelection;
  3180.         WCHAR szText[CBEMAXSTRLEN];
  3181.         int iWhy;
  3182. } NMCBEENDEDITW, *PNMCBEENDEDITW;
  3183.  
  3184. typedef struct {
  3185.         NMHDR hdr;
  3186.         BOOL fChanged;
  3187.         int iNewSelection;
  3188.         char szText[CBEMAXSTRLEN];
  3189.         int iWhy;
  3190. } NMCBEENDEDITA, *PNMCBEENDEDITA;
  3191.  
  3192. #ifdef UNICODE
  3193. #define  NMCBEENDEDIT NMCBEENDEDITW
  3194. #define  PNMCBEENDEDIT PNMCBEENDEDITW
  3195. #else
  3196. #define  NMCBEENDEDIT NMCBEENDEDITA
  3197. #define  PNMCBEENDEDIT PNMCBEENDEDITA
  3198. #endif
  3199.  
  3200. #endif
  3201.  
  3202.  
  3203.  
  3204. //====== TAB CONTROL ==========================================================
  3205.  
  3206. #ifndef NOTABCONTROL
  3207.  
  3208. #ifdef _WIN32
  3209.  
  3210. #define WC_TABCONTROLA          "SysTabControl32"
  3211. #define WC_TABCONTROLW          L"SysTabControl32"
  3212.  
  3213. #ifdef UNICODE
  3214. #define  WC_TABCONTROL          WC_TABCONTROLW
  3215. #else
  3216. #define  WC_TABCONTROL          WC_TABCONTROLA
  3217. #endif
  3218.  
  3219. #else
  3220. #define WC_TABCONTROL           "SysTabControl"
  3221. #endif
  3222.  
  3223.  
  3224. #define TCS_SCROLLOPPOSITE      0x0001   // assumes multiline tab
  3225. #define TCS_BOTTOM              0x0002
  3226. #define TCS_RIGHT               0x0002
  3227. #define TCS_MULTISELECT         0x0004  // allow multi-select in button mode
  3228. #define TCS_FORCEICONLEFT       0x0010
  3229. #define TCS_FORCELABELLEFT      0x0020
  3230. #define TCS_HOTTRACK            0x0040
  3231. #define TCS_VERTICAL            0x0080   
  3232. #define TCS_TABS                0x0000
  3233. #define TCS_BUTTONS             0x0100
  3234. #define TCS_SINGLELINE          0x0000
  3235. #define TCS_MULTILINE           0x0200
  3236. #define TCS_RIGHTJUSTIFY        0x0000
  3237. #define TCS_FIXEDWIDTH          0x0400
  3238. #define TCS_RAGGEDRIGHT         0x0800
  3239. #define TCS_FOCUSONBUTTONDOWN   0x1000
  3240. #define TCS_OWNERDRAWFIXED      0x2000
  3241. #define TCS_TOOLTIPS            0x4000
  3242. #define TCS_FOCUSNEVER          0x8000
  3243.  
  3244. #define TCM_FIRST               0x1300
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250. #define TCM_GETIMAGELIST        (TCM_FIRST + 2)
  3251. #define TabCtrl_GetImageList(hwnd) \
  3252.     (HIMAGELIST)SNDMSG((hwnd), TCM_GETIMAGELIST, 0, 0L)
  3253.  
  3254.  
  3255. #define TCM_SETIMAGELIST        (TCM_FIRST + 3)
  3256. #define TabCtrl_SetImageList(hwnd, himl) \
  3257.     (HIMAGELIST)SNDMSG((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl))
  3258.  
  3259.  
  3260. #define TCM_GETITEMCOUNT        (TCM_FIRST + 4)
  3261. #define TabCtrl_GetItemCount(hwnd) \
  3262.     (int)SNDMSG((hwnd), TCM_GETITEMCOUNT, 0, 0L)
  3263.  
  3264.  
  3265.  
  3266. #define TCIF_TEXT               0x0001
  3267. #define TCIF_IMAGE              0x0002
  3268. #define TCIF_RTLREADING         0x0004
  3269. #define TCIF_PARAM              0x0008
  3270. #define TCIF_STATE              0x0010
  3271.  
  3272.  
  3273. #define TCIS_BUTTONPRESSED      0x0001
  3274.  
  3275. typedef struct tagTCITEMHEADERA
  3276. {
  3277.     UINT mask;
  3278.     UINT lpReserved1;
  3279.     UINT lpReserved2;
  3280.     LPSTR pszText;
  3281.     int cchTextMax;
  3282.     int iImage;
  3283. } TCITEMHEADERA, FAR *LPTCITEMHEADERA;
  3284.  
  3285. typedef struct tagTCITEMHEADERW
  3286. {
  3287.     UINT mask;
  3288.     UINT lpReserved1;
  3289.     UINT lpReserved2;
  3290.     LPWSTR pszText;
  3291.     int cchTextMax;
  3292.     int iImage;
  3293. } TCITEMHEADERW, FAR *LPTCITEMHEADERW;
  3294.  
  3295. #define TC_ITEMHEADERA         TCITEMHEADERA
  3296. #define TC_ITEMHEADERW         TCITEMHEADERW
  3297. #define TC_ITEMHEADER          TCITEMHEADER
  3298.  
  3299. #ifdef UNICODE
  3300. #define  TCITEMHEADER          TCITEMHEADERW
  3301. #define  LPTCITEMHEADER        LPTCITEMHEADERW
  3302. #else
  3303. #define  TCITEMHEADER          TCITEMHEADERA
  3304. #define  LPTCITEMHEADER        LPTCITEMHEADERA
  3305. #endif
  3306.  
  3307.  
  3308. typedef struct tagTCITEMA
  3309. {
  3310.     UINT mask;
  3311.     DWORD dwState;
  3312.     DWORD dwStateMask;
  3313.     LPSTR pszText;
  3314.     int cchTextMax;
  3315.     int iImage;
  3316.  
  3317.     LPARAM lParam;
  3318. } TCITEMA, FAR *LPTCITEMA;
  3319.  
  3320. typedef struct tagTCITEMW
  3321. {
  3322.     UINT mask;
  3323.     DWORD dwState;
  3324.     DWORD dwStateMask;
  3325.     LPWSTR pszText;
  3326.     int cchTextMax;
  3327.     int iImage;
  3328.  
  3329.     LPARAM lParam;
  3330. } TCITEMW, FAR *LPTCITEMW;
  3331.  
  3332. #define TC_ITEMA                TCITEMA
  3333. #define TC_ITEMW                TCITEMW
  3334. #define TC_ITEM                 TCITEM
  3335.  
  3336. #ifdef UNICODE
  3337. #define  TCITEM                 TCITEMW
  3338. #define  LPTCITEM               LPTCITEMW
  3339. #else
  3340. #define  TCITEM                 TCITEMA
  3341. #define  LPTCITEM               LPTCITEMA
  3342. #endif
  3343.  
  3344.  
  3345. #define TCM_GETITEMA            (TCM_FIRST + 5)
  3346. #define TCM_GETITEMW            (TCM_FIRST + 60)
  3347.  
  3348. #ifdef UNICODE
  3349. #define TCM_GETITEM             TCM_GETITEMW
  3350. #else
  3351. #define TCM_GETITEM             TCM_GETITEMA
  3352. #endif
  3353.  
  3354. #define TabCtrl_GetItem(hwnd, iItem, pitem) \
  3355.     (BOOL)SNDMSG((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  3356.  
  3357.  
  3358. #define TCM_SETITEMA            (TCM_FIRST + 6)
  3359. #define TCM_SETITEMW            (TCM_FIRST + 61)
  3360.  
  3361. #ifdef UNICODE
  3362. #define TCM_SETITEM             TCM_SETITEMW
  3363. #else
  3364. #define TCM_SETITEM             TCM_SETITEMA
  3365. #endif
  3366.  
  3367. #define TabCtrl_SetItem(hwnd, iItem, pitem) \
  3368.     (BOOL)SNDMSG((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  3369.  
  3370.  
  3371. #define TCM_INSERTITEMA         (TCM_FIRST + 7)
  3372. #define TCM_INSERTITEMW         (TCM_FIRST + 62)
  3373.  
  3374. #ifdef UNICODE
  3375. #define TCM_INSERTITEM          TCM_INSERTITEMW
  3376. #else
  3377. #define TCM_INSERTITEM          TCM_INSERTITEMA
  3378. #endif
  3379.  
  3380. #define TabCtrl_InsertItem(hwnd, iItem, pitem)   \
  3381.     (int)SNDMSG((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem))
  3382.  
  3383.  
  3384. #define TCM_DELETEITEM          (TCM_FIRST + 8)
  3385. #define TabCtrl_DeleteItem(hwnd, i) \
  3386.     (BOOL)SNDMSG((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L)
  3387.  
  3388.  
  3389. #define TCM_DELETEALLITEMS      (TCM_FIRST + 9)
  3390. #define TabCtrl_DeleteAllItems(hwnd) \
  3391.     (BOOL)SNDMSG((hwnd), TCM_DELETEALLITEMS, 0, 0L)
  3392.  
  3393.  
  3394. #define TCM_GETITEMRECT         (TCM_FIRST + 10)
  3395. #define TabCtrl_GetItemRect(hwnd, i, prc) \
  3396.     (BOOL)SNDMSG((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc))
  3397.  
  3398.  
  3399. #define TCM_GETCURSEL           (TCM_FIRST + 11)
  3400. #define TabCtrl_GetCurSel(hwnd) \
  3401.     (int)SNDMSG((hwnd), TCM_GETCURSEL, 0, 0)
  3402.  
  3403.  
  3404. #define TCM_SETCURSEL           (TCM_FIRST + 12)
  3405. #define TabCtrl_SetCurSel(hwnd, i) \
  3406.     (int)SNDMSG((hwnd), TCM_SETCURSEL, (WPARAM)i, 0)
  3407.  
  3408.  
  3409. #define TCHT_NOWHERE            0x0001
  3410. #define TCHT_ONITEMICON         0x0002
  3411. #define TCHT_ONITEMLABEL        0x0004
  3412. #define TCHT_ONITEM             (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
  3413.  
  3414.  
  3415. typedef struct tagTCHITTESTINFO
  3416. {
  3417.     POINT pt;
  3418.     UINT flags;
  3419. } TCHITTESTINFO, FAR * LPTCHITTESTINFO;
  3420. #define LPTC_HITTESTINFO        LPTCHITTESTINFO
  3421. #define TC_HITTESTINFO          TCHITTESTINFO
  3422.  
  3423.  
  3424. #define TCM_HITTEST             (TCM_FIRST + 13)
  3425. #define TabCtrl_HitTest(hwndTC, pinfo) \
  3426.     (int)SNDMSG((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
  3427.  
  3428.  
  3429. #define TCM_SETITEMEXTRA        (TCM_FIRST + 14)
  3430. #define TabCtrl_SetItemExtra(hwndTC, cb) \
  3431.     (BOOL)SNDMSG((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L)
  3432.  
  3433.  
  3434. #define TCM_ADJUSTRECT          (TCM_FIRST + 40)
  3435. #define TabCtrl_AdjustRect(hwnd, bLarger, prc) \
  3436.     (int)SNDMSG(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT FAR *)prc)
  3437.  
  3438.  
  3439. #define TCM_SETITEMSIZE         (TCM_FIRST + 41)
  3440. #define TabCtrl_SetItemSize(hwnd, x, y) \
  3441.     (DWORD)SNDMSG((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y))
  3442.  
  3443.  
  3444. #define TCM_REMOVEIMAGE         (TCM_FIRST + 42)
  3445. #define TabCtrl_RemoveImage(hwnd, i) \
  3446.         (void)SNDMSG((hwnd), TCM_REMOVEIMAGE, i, 0L)
  3447.  
  3448.  
  3449. #define TCM_SETPADDING          (TCM_FIRST + 43)
  3450. #define TabCtrl_SetPadding(hwnd,  cx, cy) \
  3451.         (void)SNDMSG((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy))
  3452.  
  3453.  
  3454. #define TCM_GETROWCOUNT         (TCM_FIRST + 44)
  3455. #define TabCtrl_GetRowCount(hwnd) \
  3456.         (int)SNDMSG((hwnd), TCM_GETROWCOUNT, 0, 0L)
  3457.  
  3458.  
  3459. #define TCM_GETTOOLTIPS         (TCM_FIRST + 45)
  3460. #define TabCtrl_GetToolTips(hwnd) \
  3461.         (HWND)SNDMSG((hwnd), TCM_GETTOOLTIPS, 0, 0L)
  3462.  
  3463.  
  3464. #define TCM_SETTOOLTIPS         (TCM_FIRST + 46)
  3465. #define TabCtrl_SetToolTips(hwnd, hwndTT) \
  3466.         (void)SNDMSG((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0L)
  3467.  
  3468.  
  3469. #define TCM_GETCURFOCUS         (TCM_FIRST + 47)
  3470. #define TabCtrl_GetCurFocus(hwnd) \
  3471.     (int)SNDMSG((hwnd), TCM_GETCURFOCUS, 0, 0)
  3472.  
  3473. #define TCM_SETCURFOCUS         (TCM_FIRST + 48)
  3474. #define TabCtrl_SetCurFocus(hwnd, i) \
  3475.     SNDMSG((hwnd),TCM_SETCURFOCUS, i, 0)
  3476.  
  3477. #define TCM_SETMINTABWIDTH      (TCM_FIRST + 49)
  3478. #define TabCtrl_SetMinTabWidth(hwnd, x) \
  3479.         (int)SNDMSG((hwnd), TCM_SETMINTABWIDTH, 0, x)
  3480.  
  3481.  
  3482. #define TCM_DESELECTALL         (TCM_FIRST + 50)
  3483. #define TabCtrl_DeselectAll(hwnd, fExcludeFocus)\
  3484.         (void)SNDMSG((hwnd), TCM_DESELECTALL, fExcludeFocus, 0)
  3485.  
  3486. #define TCN_KEYDOWN             (TCN_FIRST - 0)
  3487. typedef struct tagTCKEYDOWN
  3488. {
  3489.     NMHDR hdr;
  3490.     WORD wVKey;
  3491.     UINT flags;
  3492. } NMTCKEYDOWN;
  3493. #define TC_KEYDOWN              NMTCKEYDOWN
  3494.  
  3495. #define TCN_SELCHANGE           (TCN_FIRST - 1)
  3496. #define TCN_SELCHANGING         (TCN_FIRST - 2)
  3497.  
  3498. #endif
  3499.  
  3500.  
  3501.  
  3502.  
  3503. //====== ANIMATE CONTROL ======================================================
  3504.  
  3505. #ifndef NOANIMATE
  3506.  
  3507. #ifdef _WIN32
  3508.  
  3509. #define ANIMATE_CLASSW          L"SysAnimate32"
  3510. #define ANIMATE_CLASSA          "SysAnimate32"
  3511.  
  3512. #ifdef UNICODE
  3513. #define ANIMATE_CLASS           ANIMATE_CLASSW
  3514. #else
  3515. #define ANIMATE_CLASS           ANIMATE_CLASSA
  3516. #endif
  3517.  
  3518. #define ACS_CENTER              0x0001
  3519. #define ACS_TRANSPARENT         0x0002
  3520. #define ACS_AUTOPLAY            0x0004
  3521. #define ACS_TIMER               0x0008  // don't use threads... use timers
  3522.  
  3523.  
  3524. #define ACM_OPENA               (WM_USER+100)
  3525. #define ACM_OPENW               (WM_USER+103)
  3526.  
  3527. #ifdef UNICODE
  3528. #define ACM_OPEN                ACM_OPENW
  3529. #else
  3530. #define ACM_OPEN                ACM_OPENA
  3531. #endif
  3532.  
  3533. #define ACM_PLAY                (WM_USER+101)
  3534. #define ACM_STOP                (WM_USER+102)
  3535.  
  3536.  
  3537. #define ACN_START               1
  3538. #define ACN_STOP                2
  3539.  
  3540.  
  3541. #define Animate_Create(hwndP, id, dwStyle, hInstance)   \
  3542.             CreateWindow(ANIMATE_CLASS, NULL,           \
  3543.                 dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), hInstance, NULL)
  3544.  
  3545. #define Animate_Open(hwnd, szName)          (BOOL)SNDMSG(hwnd, ACM_OPEN, 0, (LPARAM)(LPTSTR)(szName))
  3546. #define Animate_Play(hwnd, from, to, rep)   (BOOL)SNDMSG(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), (LPARAM)MAKELONG(from, to))
  3547. #define Animate_Stop(hwnd)                  (BOOL)SNDMSG(hwnd, ACM_STOP, 0, 0)
  3548. #define Animate_Close(hwnd)                 Animate_Open(hwnd, NULL)
  3549. #define Animate_Seek(hwnd, frame)           Animate_Play(hwnd, frame, frame, 1)
  3550. #endif
  3551.  
  3552. #endif
  3553.  
  3554.  
  3555. //====== MONTHCAL CONTROL ======================================================
  3556.  
  3557. #ifndef NOMONTHCAL
  3558. #ifdef _WIN32
  3559.  
  3560. #define MONTHCAL_CLASSW          L"SysMonthCal32"
  3561. #define MONTHCAL_CLASSA          "SysMonthCal32"
  3562.  
  3563. #ifdef UNICODE
  3564. #define MONTHCAL_CLASS           MONTHCAL_CLASSW
  3565. #else
  3566. #define MONTHCAL_CLASS           MONTHCAL_CLASSA
  3567. #endif
  3568.  
  3569. // bit-packed array of "bold" info for a month
  3570. // if a bit is on, that day is drawn bold
  3571. typedef DWORD MONTHDAYSTATE, FAR * LPMONTHDAYSTATE;
  3572.  
  3573.  
  3574. #define MCM_FIRST           0x1000
  3575.  
  3576. // BOOL MonthCal_GetCurSel(HWND hmc, LPSYSTEMTIME pst)
  3577. //   returns FALSE if MCS_MULTISELECT
  3578. //   returns TRUE and sets *pst to the currently selected date otherwise
  3579. #define MCM_GETCURSEL       (MCM_FIRST + 1)
  3580. #define MonthCal_GetCurSel(hmc, pst)    (BOOL)SNDMSG(hmc, MCM_GETCURSEL, 0, (LPARAM)(pst))
  3581.  
  3582. // BOOL MonthCal_SetCurSel(HWND hmc, LPSYSTEMTIME pst)
  3583. //   returns FALSE if MCS_MULTISELECT
  3584. //   returns TURE and sets the currently selected date to *pst otherwise
  3585. #define MCM_SETCURSEL       (MCM_FIRST + 2)
  3586. #define MonthCal_SetCurSel(hmc, pst)    (BOOL)SNDMSG(hmc, MCM_SETCURSEL, 0, (LPARAM)(pst))
  3587.  
  3588. // DWORD MonthCal_GetMaxSelCount(HWND hmc)
  3589. //   returns the maximum number of selectable days allowed
  3590. #define MCM_GETMAXSELCOUNT  (MCM_FIRST + 3)
  3591. #define MonthCal_GetMaxSelCount(hmc)    (DWORD)SNDMSG(hmc, MCM_GETMAXSELCOUNT, 0, 0L)
  3592.  
  3593. // BOOL MonthCal_SetMaxSelCount(HWND hmc, UINT n)
  3594. //   sets the max number days that can be selected iff MCS_MULTISELECT
  3595. #define MCM_SETMAXSELCOUNT  (MCM_FIRST + 4)
  3596. #define MonthCal_SetMaxSelCount(hmc, n) (BOOL)SNDMSG(hmc, MCM_SETMAXSELCOUNT, (WPARAM)(n), 0L)
  3597.  
  3598. // BOOL MonthCal_GetSelRange(HWND hmc, LPSYSTEMTIME rgst)
  3599. //   sets rgst[0] to the first day of the selection range
  3600. //   sets rgst[1] to the last day of the selection range
  3601. #define MCM_GETSELRANGE     (MCM_FIRST + 5)
  3602. #define MonthCal_GetSelRange(hmc, rgst) SNDMSG(hmc, MCM_GETSELRANGE, 0, (LPARAM)(rgst))
  3603.  
  3604. // BOOL MonthCal_SetSelRange(HWND hmc, LPSYSTEMTIME rgst)
  3605. //   selects the range of days from rgst[0] to rgst[1]
  3606. #define MCM_SETSELRANGE     (MCM_FIRST + 6)
  3607. #define MonthCal_SetSelRange(hmc, rgst) SNDMSG(hmc, MCM_SETSELRANGE, 0, (LPARAM)(rgst))
  3608.  
  3609. // DWORD MonthCal_GetMonthRange(HWND hmc, DWORD gmr, LPSYSTEMTIME rgst)
  3610. //   if rgst specified, sets rgst[0] to the starting date and
  3611. //      and rgst[1] to the ending date of the the selectable (non-grayed)
  3612. //      days if GMR_VISIBLE or all the displayed days (including grayed)
  3613. //      if GMR_DAYSTATE.
  3614. //   returns the number of months spanned by the above range.
  3615. #define MCM_GETMONTHRANGE   (MCM_FIRST + 7)
  3616. #define MonthCal_GetMonthRange(hmc, gmr, rgst)  (DWORD)SNDMSG(hmc, MCM_GETMONTHRANGE, (WPARAM)(gmr), (LPARAM)(rgst))
  3617.  
  3618. // BOOL MonthCal_SetDayState(HWND hmc, int cbds, DAYSTATE *rgds)
  3619. //   cbds is the count of DAYSTATE items in rgds and it must be equal
  3620. //   to the value returned from MonthCal_GetMonthRange(hmc, GMR_DAYSTATE, NULL)
  3621. //   This sets the DAYSTATE bits for each month (grayed and non-grayed
  3622. //   days) displayed in the calendar. The first bit in a month's DAYSTATE
  3623. //   corresponts to bolding day 1, the second bit affects day 2, etc.
  3624. #define MCM_SETDAYSTATE     (MCM_FIRST + 8)
  3625. #define MonthCal_SetDayState(hmc, cbds, rgds)   SNDMSG(hmc, MCM_SETDAYSTATE, (WPARAM)(cbds), (LPARAM)(rgds))
  3626.  
  3627. // BOOL MonthCal_GetMinReqRect(HWND hmc, LPRECT prc)
  3628. //   sets *prc the minimal size needed to display one month
  3629. #define MCM_GETMINREQRECT   (MCM_FIRST + 9)
  3630. #define MonthCal_GetMinReqRect(hmc, prc)        SNDMSG(hmc, MCM_GETMINREQRECT, 0, (LPARAM)(prc))
  3631.  
  3632. // set what day is "today"   send NULL to revert back to real date
  3633. #define MCM_SETTODAY    (MCM_FIRST + 12)
  3634. #define MonthCal_SetToday(hmc, pst)             SNDMSG(hmc, MCM_SETTODAY, 0, (LPARAM)pst)
  3635.  
  3636. // get what day is "today"
  3637. // returns BOOL for success/failure
  3638. #define MCM_GETTODAY    (MCM_FIRST + 13)
  3639. #define MonthCal_GetToday(hmc, pst)             (BOOL)SNDMSG(hmc, MCM_GETTODAY, 0, (LPARAM)pst)
  3640.  
  3641. // determine what pinfo->pt is over
  3642. #define MCM_HITTEST          (MCM_FIRST + 14)
  3643. #define MonthCal_HitTest(hmc, pinfo) \
  3644.         SNDMSG(hmc, MCM_HITTEST, 0, (LPARAM)(PMCHITTESTINFO)pinfo)
  3645.  
  3646. typedef struct {
  3647.         UINT cbSize;
  3648.         POINT pt;
  3649.  
  3650.         UINT uHit;   // out param
  3651.         SYSTEMTIME st;
  3652. } MCHITTESTINFO, *PMCHITTESTINFO;
  3653.  
  3654. #define MCHT_TITLE                      0x00010000
  3655. #define MCHT_CALENDAR                   0x00020000
  3656. #define MCHT_TODAYLINK                  0x00030000
  3657.  
  3658. #define MCHT_NEXT                       0x01000000   // these indicate that hitting
  3659. #define MCHT_PREV                       0x02000000  // here will go to the next/prev month
  3660.  
  3661. #define MCHT_NOWHERE                    0x00000000
  3662.  
  3663. #define MCHT_TITLEBK                    (MCHT_TITLE)
  3664. #define MCHT_TITLEMONTH                 (MCHT_TITLE | 0x0001)
  3665. #define MCHT_TITLEYEAR                  (MCHT_TITLE | 0x0002)
  3666. #define MCHT_TITLEBTNNEXT               (MCHT_TITLE | MCHT_NEXT | 0x0003)
  3667. #define MCHT_TITLEBTNPREV               (MCHT_TITLE | MCHT_PREV | 0x0003)
  3668.  
  3669. #define MCHT_CALENDARBK                 (MCHT_CALENDAR)
  3670. #define MCHT_CALENDARDATE               (MCHT_CALENDAR | 0x0001)
  3671. #define MCHT_CALENDARDATENEXT           (MCHT_CALENDARDATE | MCHT_NEXT)
  3672. #define MCHT_CALENDARDATEPREV           (MCHT_CALENDARDATE | MCHT_PREV)
  3673. #define MCHT_CALENDARDAY                (MCHT_CALENDAR | 0x0002)
  3674. #define MCHT_CALENDARWEEKNUM            (MCHT_CALENDAR | 0x0003)
  3675.  
  3676. // set colors to draw control with -- see MCSC_ bits below
  3677. #define MCM_SETCOLOR            (MCM_FIRST + 10)
  3678. #define MonthCal_SetColor(hmc, iColor, clr) SNDMSG(hmc, MCM_SETCOLOR, iColor, clr)
  3679.  
  3680. #define MCM_GETCOLOR            (MCM_FIRST + 11)
  3681. #define MonthCal_GetColor(hmc, iColor) SNDMSG(hmc, MCM_SETCOLOR, iColor, 0)
  3682.  
  3683. #define MCSC_BACKGROUND   0   // the background color (between months)
  3684. #define MCSC_TEXT         1   // the dates
  3685. #define MCSC_TITLEBK      2   // background of the title
  3686. #define MCSC_TITLETEXT    3
  3687. #define MCSC_MONTHBK      4   // background within the month cal
  3688. #define MCSC_TRAILINGTEXT 5   // the text color of header & trailing days
  3689.  
  3690. // set first day of week to iDay:
  3691. // 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
  3692. // -1 for means use locale info
  3693. #define MCM_SETFIRSTDAYOFWEEK (MCM_FIRST + 15)
  3694. #define MonthCal_SetFirstDayOfWeek(hmc, iDay) \
  3695.         SNDMSG(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay)
  3696.  
  3697. // DWORD result...  low word has the day.  high word is bool if this is app set
  3698. // or not (FALSE == using locale info)
  3699. #define MCM_GETFIRSTDAYOFWEEK (MCM_FIRST + 16)
  3700. #define MonthCal_GetFirstDayOfWeek(hmc) \
  3701.         (DWORD)SNDMSG(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0)
  3702.  
  3703. // DWORD MonthCal_GetRange(HWND hmc, LPSYSTEMTIME rgst)
  3704. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  3705. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  3706. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  3707. #define MCM_GETRANGE (MCM_FIRST + 17)
  3708. #define MonthCal_GetRange(hmc, rgst) \
  3709.         (DWORD)SNDMSG(hmc, MCM_GETRANGE, 0, (LPARAM)(rgst))
  3710.  
  3711. // BOOL MonthCal_SetRange(HWND hmc, DWORD gdtr, LPSYSTEMTIME rgst)
  3712. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  3713. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  3714. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  3715. #define MCM_SETRANGE (MCM_FIRST + 18)
  3716. #define MonthCal_SetRange(hmc, gd, rgst) \
  3717.         (BOOL)SNDMSG(hmc, MCM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
  3718.  
  3719. // int MonthCal_GetMonthDelta(HWND hmc)
  3720. //   returns the number of months one click on a next/prev button moves by
  3721. #define MCM_GETMONTHDELTA (MCM_FIRST + 19)
  3722. #define MonthCal_GetMonthDelta(hmc) \
  3723.         (int)SNDMSG(hmc, MCM_GETMONTHDELTA, 0, 0)
  3724.  
  3725. // int MonthCal_SetMonthDelta(HWND hmc, int n)
  3726. //   sets the month delta to n. n==0 reverts to moving by a page of months
  3727. //   returns the previous value of n.
  3728. #define MCM_SETMONTHDELTA (MCM_FIRST + 20)
  3729. #define MonthCal_SetMonthDelta(hmc, n) \
  3730.         (int)SNDMSG(hmc, MCM_SETMONTHDELTA, n, 0)
  3731.  
  3732.  
  3733. // MCN_SELCHANGE is sent whenever the currently displayed date changes
  3734. // via month change, year change, keyboard navigation, prev/next button
  3735. //
  3736. typedef struct tagNMSELCHANGE
  3737. {
  3738.     NMHDR           nmhdr;  // this must be first, so we don't break WM_NOTIFY
  3739.  
  3740.     SYSTEMTIME      stSelStart;
  3741.     SYSTEMTIME      stSelEnd;
  3742. } NMSELCHANGE, FAR * LPNMSELCHANGE;
  3743.  
  3744. #define MCN_SELCHANGE       (MCN_FIRST + 1)
  3745.  
  3746. // MCN_GETDAYSTATE is sent for MCS_DAYSTATE controls whenever new daystate
  3747. // information is needed (month or year scroll) to draw bolding information.
  3748. // The app must fill in cDayState months worth of information starting from
  3749. // stStart date. The app may fill in the array at prgDayState or change
  3750. // prgDayState to point to a different array out of which the information
  3751. // will be copied. (similar to tooltips)
  3752. //
  3753. typedef struct tagNMDAYSTATE
  3754. {
  3755.     NMHDR           nmhdr;  // this must be first, so we don't break WM_NOTIFY
  3756.  
  3757.     SYSTEMTIME      stStart;
  3758.     int             cDayState;
  3759.  
  3760.     LPMONTHDAYSTATE prgDayState; // points to cDayState MONTHDAYSTATEs
  3761. } NMDAYSTATE, FAR * LPNMDAYSTATE;
  3762.  
  3763. #define MCN_GETDAYSTATE     (MCN_FIRST + 3)
  3764.  
  3765. // MCN_SELECT is sent whenever a selection has occured (via mouse or keyboard)
  3766. //
  3767. typedef NMSELCHANGE NMSELECT, FAR * LPNMSELECT;
  3768.  
  3769.  
  3770. #define MCN_SELECT          (MCN_FIRST + 4)
  3771.  
  3772.  
  3773. #define MCS_DAYSTATE        0x0001
  3774. #define MCS_MULTISELECT     0x0002
  3775. #define MCS_WEEKNUMBERS     0x0004
  3776. #define MCS_NOTODAY         0x0008
  3777.  
  3778.  
  3779. #define GMR_VISIBLE     0       // visible portion of display
  3780. #define GMR_DAYSTATE    1       // above plus the grayed out parts of
  3781.                                 // partially displayed months
  3782.  
  3783.  
  3784. #endif // _WIN32
  3785. #endif // NOMONTHCAL
  3786.  
  3787.  
  3788. //====== DATETIMEPICK CONTROL ==================================================
  3789.  
  3790. #ifndef NODATETIMEPICK
  3791. #ifdef _WIN32
  3792.  
  3793. #define DATETIMEPICK_CLASSW          L"SysDateTimePick32"
  3794. #define DATETIMEPICK_CLASSA          "SysDateTimePick32"
  3795.  
  3796. #ifdef UNICODE
  3797. #define DATETIMEPICK_CLASS           DATETIMEPICK_CLASSW
  3798. #else
  3799. #define DATETIMEPICK_CLASS           DATETIMEPICK_CLASSA
  3800. #endif
  3801.  
  3802. #define DTM_FIRST        0x1000
  3803.  
  3804. // DWORD DateTimePick_GetSystemtime(HWND hdp, LPSYSTEMTIME pst)
  3805. //   returns GDT_NONE if "none" is selected (DTS_SHOWNONE only)
  3806. //   returns GDT_VALID and modifies *pst to be the currently selected value
  3807. #define DTM_GETSYSTEMTIME   (DTM_FIRST + 1)
  3808. #define DateTime_GetSystemtime(hdp, pst)    (DWORD)SNDMSG(hdp, DTM_GETSYSTEMTIME, 0, (LPARAM)(pst))
  3809.  
  3810. // BOOL DateTime_SetSystemtime(HWND hdp, DWORD gd, LPSYSTEMTIME pst)
  3811. //   if gd==GDT_NONE, sets datetimepick to None (DTS_SHOWNONE only)
  3812. //   if gd==GDT_VALID, sets datetimepick to *pst
  3813. //   returns TRUE on success, FALSE on error (such as bad params)
  3814. #define DTM_SETSYSTEMTIME   (DTM_FIRST + 2)
  3815. #define DateTime_SetSystemtime(hdp, gd, pst)    (BOOL)SNDMSG(hdp, DTM_SETSYSTEMTIME, (LPARAM)(gd), (LPARAM)(pst))
  3816.  
  3817. // DWORD DateTime_GetRange(HWND hdp, LPSYSTEMTIME rgst)
  3818. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  3819. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  3820. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  3821. #define DTM_GETRANGE (DTM_FIRST + 3)
  3822. #define DateTime_GetRange(hdp, rgst)  (DWORD)SNDMSG(hdp, DTM_GETRANGE, 0, (LPARAM)(rgst))
  3823.  
  3824. // BOOL DateTime_SetRange(HWND hdp, DWORD gdtr, LPSYSTEMTIME rgst)
  3825. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  3826. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  3827. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  3828. #define DTM_SETRANGE (DTM_FIRST + 4)
  3829. #define DateTime_SetRange(hdp, gd, rgst)  (BOOL)SNDMSG(hdp, DTM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
  3830.  
  3831. // BOOL DateTime_SetFormat(HWND hdp, LPCTSTR sz)
  3832. //   sets the display formatting string to sz (see GetDateFormat and GetTimeFormat for valid formatting chars)
  3833. //   NOTE: 'X' is a valid formatting character which indicates that the application
  3834. //   will determine how to display information. Such apps must support DTN_WMKEYDOWN,
  3835. //   DTN_FORMAT, and DTN_FORMATQUERY.
  3836. #define DTM_SETFORMATA (DTM_FIRST + 5)
  3837. #define DTM_SETFORMATW (DTM_FIRST + 50)
  3838.  
  3839. #ifdef UNICODE
  3840. #define DTM_SETFORMAT       DTM_SETFORMATW
  3841. #else
  3842. #define DTM_SETFORMAT       DTM_SETFORMATA
  3843. #endif
  3844.  
  3845. #define DateTime_SetFormat(hdp, sz)  (BOOL)SNDMSG(hdp, DTM_SETFORMAT, 0, (LPARAM)(sz))
  3846.  
  3847.  
  3848. #define DTM_SETMCCOLOR    (DTM_FIRST + 6)
  3849. #define DateTime_SetMonthCalColor(hdp, iColor, clr) SNDMSG(hdp, DTM_SETMCCOLOR, iColor, clr)
  3850.  
  3851. #define DTM_GETMCCOLOR    (DTM_FIRST + 7)
  3852. #define DateTime_GetMonthCalColor(hdp, iColor) SNDMSG(hdp, DTM_GETMCCOLOR, iColor, 0)
  3853.  
  3854. // HWND DateTime_GetMonthCal(HWND hdp)
  3855. //   returns the HWND of the MonthCal popup window. Only valid
  3856. // between DTN_DROPDOWN and DTN_CLOSEUP notifications.
  3857. #define DTM_GETMONTHCAL   (DTM_FIRST + 8)
  3858. #define DateTime_GetMonthCal(hdp) (HWND)SNDMSG(hdp, DTM_GETMONTHCAL, 0, 0)
  3859.  
  3860. #define DTM_SETMCFONT     (DTM_FIRST + 9)
  3861. #define DateTime_SetMonthCalFont(hdp, hfont, fRedraw) SNDMSG(hdp, DTM_SETMCFONT, (WPARAM)hfont, (LPARAM)fRedraw)
  3862.  
  3863. #define DTM_GETMCFONT     (DTM_FIRST + 10)
  3864. #define DateTime_GetMonthCalFont(hdp) SNDMSG(hdp, DTM_GETMCFONT, 0, 0)
  3865.  
  3866. #define DTS_UPDOWN          0x0001 // use UPDOWN instead of MONTHCAL
  3867. #define DTS_SHOWNONE        0x0002 // allow a NONE selection
  3868. #define DTS_SHORTDATEFORMAT 0x0000 // use the short date format (app must forward WM_WININICHANGE messages)
  3869. #define DTS_LONGDATEFORMAT  0x0004 // use the long date format (app must forward WM_WININICHANGE messages)
  3870. #define DTS_TIMEFORMAT      0x0009 // use the time format (app must forward WM_WININICHANGE messages)
  3871. #define DTS_APPCANPARSE     0x0010 // allow user entered strings (app MUST respond to DTN_USERSTRING)
  3872. #define DTS_RIGHTALIGN      0x0020 // right-align popup instead of left-align it
  3873.  
  3874. #define DTN_DATETIMECHANGE  (DTN_FIRST + 1) // the systemtime has changed
  3875. typedef struct tagNMDATETIMECHANGE
  3876. {
  3877.     NMHDR       nmhdr;
  3878.     DWORD       dwFlags;    // GDT_VALID or GDT_NONE
  3879.     SYSTEMTIME  st;         // valid iff dwFlags==GDT_VALID
  3880. } NMDATETIMECHANGE, FAR * LPNMDATETIMECHANGE;
  3881.  
  3882. #define DTN_USERSTRINGA  (DTN_FIRST + 2) // the user has entered a string
  3883. #define DTN_USERSTRINGW  (DTN_FIRST + 15)
  3884. typedef struct tagNMDATETIMESTRINGA
  3885. {
  3886.     NMHDR      nmhdr;
  3887.     LPCSTR     pszUserString;  // string user entered
  3888.     SYSTEMTIME st;             // app fills this in
  3889.     DWORD      dwFlags;        // GDT_VALID or GDT_NONE
  3890. } NMDATETIMESTRINGA, FAR * LPNMDATETIMESTRINGA;
  3891.  
  3892. typedef struct tagNMDATETIMESTRINGW
  3893. {
  3894.     NMHDR      nmhdr;
  3895.     LPCWSTR    pszUserString;  // string user entered
  3896.     SYSTEMTIME st;             // app fills this in
  3897.     DWORD      dwFlags;        // GDT_VALID or GDT_NONE
  3898. } NMDATETIMESTRINGW, FAR * LPNMDATETIMESTRINGW;
  3899.  
  3900. #ifdef UNICODE
  3901. #define DTN_USERSTRING          DTN_USERSTRINGW
  3902. #define NMDATETIMESTRING        NMDATETIMESTRINGW
  3903. #define LPNMDATETIMESTRING      LPNMDATETIMESTRINGW
  3904. #else
  3905. #define DTN_USERSTRING          DTN_USERSTRINGA
  3906. #define NMDATETIMESTRING        NMDATETIMESTRINGA
  3907. #define LPNMDATETIMESTRING      LPNMDATETIMESTRINGA
  3908. #endif
  3909.  
  3910.  
  3911. #define DTN_WMKEYDOWNA  (DTN_FIRST + 3) // modify keydown on app format field (X)
  3912. #define DTN_WMKEYDOWNW  (DTN_FIRST + 16)
  3913. typedef struct tagNMDATETIMEWMKEYDOWNA
  3914. {
  3915.     NMHDR      nmhdr;
  3916.     int        nVirtKey;  // virtual key code of WM_KEYDOWN which MODIFIES an X field
  3917.     LPCSTR     pszFormat; // format substring
  3918.     SYSTEMTIME st;        // current systemtime, app should modify based on key
  3919. } NMDATETIMEWMKEYDOWNA, FAR * LPNMDATETIMEWMKEYDOWNA;
  3920.  
  3921. typedef struct tagNMDATETIMEWMKEYDOWNW
  3922. {
  3923.     NMHDR      nmhdr;
  3924.     int        nVirtKey;  // virtual key code of WM_KEYDOWN which MODIFIES an X field
  3925.     LPCWSTR    pszFormat; // format substring
  3926.     SYSTEMTIME st;        // current systemtime, app should modify based on key
  3927. } NMDATETIMEWMKEYDOWNW, FAR * LPNMDATETIMEWMKEYDOWNW;
  3928.  
  3929. #ifdef UNICODE
  3930. #define DTN_WMKEYDOWN           DTN_WMKEYDOWNW
  3931. #define NMDATETIMEWMKEYDOWN     NMDATETIMEWMKEYDOWNW
  3932. #define LPNMDATETIMEWMKEYDOWN   LPNMDATETIMEWMKEYDOWNW
  3933. #else
  3934. #define DTN_WMKEYDOWN           DTN_WMKEYDOWNA
  3935. #define NMDATETIMEWMKEYDOWN     NMDATETIMEWMKEYDOWNA
  3936. #define LPNMDATETIMEWMKEYDOWN   LPNMDATETIMEWMKEYDOWNA
  3937. #endif
  3938.  
  3939.  
  3940. #define DTN_FORMATA  (DTN_FIRST + 4) // query display for app format field (X)
  3941. #define DTN_FORMATW  (DTN_FIRST + 17)
  3942. typedef struct tagNMDATETIMEFORMATA
  3943. {
  3944.     NMHDR nmhdr;
  3945.     LPCSTR  pszFormat;   // format substring
  3946.     SYSTEMTIME st;       // current systemtime
  3947.     LPCSTR pszDisplay;   // string to display
  3948.     CHAR szDisplay[64];  // buffer pszDisplay originally points at
  3949. } NMDATETIMEFORMATA, FAR * LPNMDATETIMEFORMATA;
  3950.  
  3951. typedef struct tagNMDATETIMEFORMATW
  3952. {
  3953.     NMHDR nmhdr;
  3954.     LPCWSTR pszFormat;   // format substring
  3955.     SYSTEMTIME st;       // current systemtime
  3956.     LPCWSTR pszDisplay;  // string to display
  3957.     WCHAR szDisplay[64]; // buffer pszDisplay originally points at
  3958. } NMDATETIMEFORMATW, FAR * LPNMDATETIMEFORMATW;
  3959.  
  3960. #ifdef UNICODE
  3961. #define DTN_FORMAT             DTN_FORMATW
  3962. #define NMDATETIMEFORMAT        NMDATETIMEFORMATW
  3963. #define LPNMDATETIMEFORMAT      LPNMDATETIMEFORMATW
  3964. #else
  3965. #define DTN_FORMAT             DTN_FORMATA
  3966. #define NMDATETIMEFORMAT        NMDATETIMEFORMATA
  3967. #define LPNMDATETIMEFORMAT      LPNMDATETIMEFORMATA
  3968. #endif
  3969.  
  3970.  
  3971. #define DTN_FORMATQUERYA  (DTN_FIRST + 5) // query formatting info for app format field (X)
  3972. #define DTN_FORMATQUERYW (DTN_FIRST + 18)
  3973. typedef struct tagNMDATETIMEFORMATQUERYA
  3974. {
  3975.     NMHDR nmhdr;
  3976.     LPCSTR pszFormat;  // format substring
  3977.     SIZE szMax;        // max bounding rectangle app will use for this format string
  3978. } NMDATETIMEFORMATQUERYA, FAR * LPNMDATETIMEFORMATQUERYA;
  3979.  
  3980. typedef struct tagNMDATETIMEFORMATQUERYW
  3981. {
  3982.     NMHDR nmhdr;
  3983.     LPCWSTR pszFormat; // format substring
  3984.     SIZE szMax;        // max bounding rectangle app will use for this format string
  3985. } NMDATETIMEFORMATQUERYW, FAR * LPNMDATETIMEFORMATQUERYW;
  3986.  
  3987. #ifdef UNICODE
  3988. #define DTN_FORMATQUERY         DTN_FORMATQUERYW
  3989. #define NMDATETIMEFORMATQUERY   NMDATETIMEFORMATQUERYW
  3990. #define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYW
  3991. #else
  3992. #define DTN_FORMATQUERY         DTN_FORMATQUERYA
  3993. #define NMDATETIMEFORMATQUERY   NMDATETIMEFORMATQUERYA
  3994. #define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYA
  3995. #endif
  3996.  
  3997.  
  3998. #define DTN_DROPDOWN    (DTN_FIRST + 6) // MonthCal has dropped down
  3999. #define DTN_CLOSEUP     (DTN_FIRST + 7) // MonthCal is popping up
  4000.  
  4001.  
  4002. #define GDTR_MIN     0x0001
  4003. #define GDTR_MAX     0x0002
  4004.  
  4005. #define GDT_ERROR    -1
  4006. #define GDT_VALID    0
  4007. #define GDT_NONE     1
  4008.  
  4009.  
  4010. #endif // _WIN32
  4011. #endif // NODATETIMEPICK
  4012.  
  4013.  
  4014.  
  4015.  
  4016. #ifdef _WIN32
  4017. //====== TrackMouseEvent  =====================================================
  4018.  
  4019. #ifndef NOTRACKMOUSEEVENT
  4020.  
  4021. //
  4022. // If the messages for TrackMouseEvent have not been defined then define them
  4023. // now.
  4024. //
  4025. #ifndef WM_MOUSEHOVER
  4026. #define WM_MOUSEHOVER                   0x02A1
  4027. #define WM_MOUSELEAVE                   0x02A3
  4028. #endif
  4029.  
  4030. //
  4031. // If the TRACKMOUSEEVENT structure and associated flags havent been declared
  4032. // then declare them now.
  4033. //
  4034. #ifndef TME_HOVER
  4035.  
  4036. #define TME_HOVER       0x00000001
  4037. #define TME_LEAVE       0x00000002
  4038. #define TME_QUERY       0x40000000
  4039. #define TME_CANCEL      0x80000000
  4040.  
  4041.  
  4042. #define HOVER_DEFAULT   0xFFFFFFFF
  4043.  
  4044. typedef struct tagTRACKMOUSEEVENT {
  4045.     DWORD cbSize;
  4046.     DWORD dwFlags;
  4047.     HWND  hwndTrack;
  4048.     DWORD dwHoverTime;
  4049. } TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT;
  4050.  
  4051. #endif // !TME_HOVER
  4052.  
  4053. //
  4054. // Declare _TrackMouseEvent.  This API tries to use the window manager's
  4055. // implementation of TrackMouseEvent if it is present, otherwise it emulates.
  4056. //
  4057. WINCOMMCTRLAPI
  4058. BOOL
  4059. WINAPI
  4060. _TrackMouseEvent(
  4061.     LPTRACKMOUSEEVENT lpEventTrack);
  4062.  
  4063. #endif // !NOTRACKMOUSEEVENT
  4064.  
  4065.  
  4066. #endif /* _WIN32 */
  4067.  
  4068.  
  4069. #ifdef __cplusplus
  4070. }
  4071. #endif
  4072.  
  4073. #ifdef _WIN32
  4074. #include <poppack.h>
  4075. #endif
  4076.  
  4077. #endif
  4078.  
  4079.  
  4080. #endif  // _INC_COMMCTRL
  4081.