home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / commctrl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  130.9 KB  |  4,175 lines

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