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