home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / commctrl.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  190KB  |  5,912 lines

  1.  
  2. /*****************************************************************************\
  3. *                                                                             *
  4. * commctrl.h - - Interface for the Windows Common Controls                    *
  5. *                                                                             *
  6. * Version 1.2                                                                 *
  7. *                                                                             *
  8. * Copyright 1991-1998, Microsoft Corp.      All rights reserved.          *
  9. *                                                                             *
  10. \*****************************************************************************/
  11.  
  12.  
  13. #ifndef _INC_COMMCTRL
  14. #define _INC_COMMCTRL
  15.  
  16. #ifndef _WIN32_IE
  17. #define _WIN32_IE 0x0400
  18. #else
  19. #if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
  20. #error _WIN32_IE setting conflicts with _WIN32_WINNT setting
  21. #endif
  22. #endif
  23.  
  24. #ifndef _HRESULT_DEFINED
  25. #define _HRESULT_DEFINED
  26. typedef LONG HRESULT;
  27. #endif // _HRESULT_DEFINED
  28.  
  29. #ifndef NOUSER
  30.  
  31.  
  32. //
  33. // Define API decoration for direct importing of DLL references.
  34. //
  35. #ifndef WINCOMMCTRLAPI
  36. #if !defined(_COMCTL32_) && defined(_WIN32)
  37. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  38. #else
  39. #define WINCOMMCTRLAPI
  40. #endif
  41. #endif // WINCOMMCTRLAPI
  42.  
  43. //
  44. // For compilers that don't support nameless unions
  45. //
  46. #ifndef DUMMYUNIONNAME
  47. #ifdef NONAMELESSUNION
  48. #define DUMMYUNIONNAME          u
  49. #define DUMMYUNIONNAME2         u2
  50. #define DUMMYUNIONNAME3         u3
  51. #define DUMMYUNIONNAME4         u4
  52. #define DUMMYUNIONNAME5         u5
  53. #else
  54. #define DUMMYUNIONNAME
  55. #define DUMMYUNIONNAME2
  56. #define DUMMYUNIONNAME3
  57. #define DUMMYUNIONNAME4
  58. #define DUMMYUNIONNAME5
  59. #endif
  60. #endif // DUMMYUNIONNAME
  61.  
  62. #ifdef _WIN32
  63. #include <pshpack1.h>
  64. #endif
  65.  
  66. #ifdef __cplusplus
  67. extern "C" {
  68. #endif
  69.  
  70. //
  71. // Users of this header may define any number of these constants to avoid
  72. // the definitions of each functional group.
  73. //
  74. //    NOTOOLBAR    Customizable bitmap-button toolbar control.
  75. //    NOUPDOWN     Up and Down arrow increment/decrement control.
  76. //    NOSTATUSBAR  Status bar control.
  77. //    NOMENUHELP   APIs to help manage menus, especially with a status bar.
  78. //    NOTRACKBAR   Customizable column-width tracking control.
  79. //    NODRAGLIST   APIs to make a listbox source and sink drag&drop actions.
  80. //    NOPROGRESS   Progress gas gauge.
  81. //    NOHOTKEY     HotKey control
  82. //    NOHEADER     Header bar control.
  83. //    NOIMAGEAPIS  ImageList apis.
  84. //    NOLISTVIEW   ListView control.
  85. //    NOTREEVIEW   TreeView control.
  86. //    NOTABCONTROL Tab control.
  87. //    NOANIMATE    Animate control.
  88. //
  89. //=============================================================================
  90.  
  91. #include <prsht.h>
  92.  
  93. #ifndef SNDMSG
  94. #ifdef __cplusplus
  95. #ifndef _MAC
  96. #define SNDMSG ::SendMessage
  97. #else
  98. #define SNDMSG ::AfxSendMessage
  99. #endif
  100. #else
  101. #ifndef _MAC
  102. #define SNDMSG SendMessage
  103. #else
  104. #define SNDMSG AfxSendMessage
  105. #endif //_MAC
  106. #endif
  107. #endif // ifndef SNDMSG
  108.  
  109. #ifdef _MAC
  110. #ifndef RC_INVOKED
  111. #ifndef _WLM_NOFORCE_LIBS
  112.  
  113. #ifndef _WLMDLL
  114.     #ifdef _DEBUG
  115.         #pragma comment(lib, "comctld.lib")
  116.     #else
  117.         #pragma comment(lib, "comctl.lib")
  118.     #endif
  119.     #pragma comment(linker, "/macres:comctl.rsc")
  120.     #else
  121.     #ifdef _DEBUG
  122.         #pragma comment(lib, "msvcctld.lib")
  123.     #else
  124.         #pragma comment(lib, "msvcctl.lib")
  125.     #endif
  126. #endif // _WLMDLL
  127.  
  128. #endif // _WLM_NOFORCE_LIBS
  129. #endif // RC_INVOKED
  130. #endif //_MAC
  131.  
  132. WINCOMMCTRLAPI void WINAPI InitCommonControls(void);
  133.  
  134. #if (_WIN32_IE >= 0x0300)
  135. typedef struct tagINITCOMMONCONTROLSEX {
  136.     DWORD dwSize;             // size of this structure
  137.     DWORD dwICC;              // flags indicating which classes to be initialized
  138. } INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
  139. #define ICC_LISTVIEW_CLASSES 0x00000001 // listview, header
  140. #define ICC_TREEVIEW_CLASSES 0x00000002 // treeview, tooltips
  141. #define ICC_BAR_CLASSES      0x00000004 // toolbar, statusbar, trackbar, tooltips
  142. #define ICC_TAB_CLASSES      0x00000008 // tab, tooltips
  143. #define ICC_UPDOWN_CLASS     0x00000010 // updown
  144. #define ICC_PROGRESS_CLASS   0x00000020 // progress
  145. #define ICC_HOTKEY_CLASS     0x00000040 // hotkey
  146. #define ICC_ANIMATE_CLASS    0x00000080 // animate
  147. #define ICC_WIN95_CLASSES    0x000000FF
  148. #define ICC_DATE_CLASSES     0x00000100 // month picker, date picker, time picker, updown
  149. #define ICC_USEREX_CLASSES   0x00000200 // comboex
  150. #define ICC_COOL_CLASSES     0x00000400 // rebar (coolbar) control
  151. #if (_WIN32_IE >= 0x0400)
  152. #define ICC_INTERNET_CLASSES 0x00000800
  153. #define ICC_PAGESCROLLER_CLASS 0x00001000   // page scroller
  154. #define ICC_NATIVEFNTCTL_CLASS 0x00002000   // native font control
  155. #endif
  156. WINCOMMCTRLAPI BOOL WINAPI InitCommonControlsEx(LPINITCOMMONCONTROLSEX);
  157. #endif      // _WIN32_IE >= 0x0300
  158.  
  159. #define ODT_HEADER              100
  160. #define ODT_TAB                 101
  161. #define ODT_LISTVIEW            102
  162.  
  163.  
  164. //====== Ranges for control message IDs =======================================
  165.  
  166. #define LVM_FIRST               0x1000      // ListView messages
  167. #define TV_FIRST                0x1100      // TreeView messages
  168. #define HDM_FIRST               0x1200      // Header messages
  169. #define TCM_FIRST               0x1300      // Tab control messages
  170.  
  171. #if (_WIN32_IE >= 0x0400)
  172. #define PGM_FIRST               0x1400      // Pager control messages
  173. #define CCM_FIRST               0x2000      // Common control shared messages
  174.  
  175.  
  176. #define CCM_SETBKCOLOR          (CCM_FIRST + 1) // lParam is bkColor
  177.  
  178. typedef struct tagCOLORSCHEME {
  179.    DWORD            dwSize;
  180.    COLORREF         clrBtnHighlight;       // highlight color
  181.    COLORREF         clrBtnShadow;          // shadow color
  182. } COLORSCHEME, *LPCOLORSCHEME;
  183.  
  184. #define CCM_SETCOLORSCHEME      (CCM_FIRST + 2) // lParam is color scheme
  185. #define CCM_GETCOLORSCHEME      (CCM_FIRST + 3) // fills in COLORSCHEME pointed to by lParam
  186. #define CCM_GETDROPTARGET       (CCM_FIRST + 4)
  187. #define CCM_SETUNICODEFORMAT    (CCM_FIRST + 5)
  188. #define CCM_GETUNICODEFORMAT    (CCM_FIRST + 6)
  189.  
  190. #endif
  191.  
  192. #if (_WIN32_IE >= 0x0400)
  193. // for tooltips
  194. #define INFOTIPSIZE 1024
  195. #endif
  196.  
  197. //====== WM_NOTIFY Macros =====================================================
  198.  
  199. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  200.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  201. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
  202.     (LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR FAR*)(pnmhdr))
  203.  
  204.  
  205. //====== Generic WM_NOTIFY notification codes =================================
  206.  
  207. #define NM_OUTOFMEMORY          (NM_FIRST-1)
  208. #define NM_CLICK                (NM_FIRST-2)    // uses NMCLICK struct
  209. #define NM_DBLCLK               (NM_FIRST-3)
  210. #define NM_RETURN               (NM_FIRST-4)
  211. #define NM_RCLICK               (NM_FIRST-5)    // uses NMCLICK struct
  212. #define NM_RDBLCLK              (NM_FIRST-6)
  213. #define NM_SETFOCUS             (NM_FIRST-7)
  214. #define NM_KILLFOCUS            (NM_FIRST-8)
  215. #if (_WIN32_IE >= 0x0300)
  216. #define NM_CUSTOMDRAW           (NM_FIRST-12)
  217. #define NM_HOVER                (NM_FIRST-13)
  218. #endif
  219. #if (_WIN32_IE >= 0x0400)
  220. #define NM_NCHITTEST            (NM_FIRST-14)   // uses NMMOUSE struct
  221. #define NM_KEYDOWN              (NM_FIRST-15)   // uses NMKEY struct
  222. #define NM_RELEASEDCAPTURE      (NM_FIRST-16)
  223. #define NM_SETCURSOR            (NM_FIRST-17)   // uses NMMOUSE struct
  224. #define NM_CHAR                 (NM_FIRST-18)   // uses NMCHAR struct
  225. #endif
  226.  
  227.  
  228. #ifndef CCSIZEOF_STRUCT
  229. #define CCSIZEOF_STRUCT(structname, member)  (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
  230. #endif
  231.  
  232. #if (_WIN32_IE >= 0x0400)
  233. //====== Generic WM_NOTIFY notification structures ============================
  234.  
  235. typedef struct tagNMMOUSE {
  236.     NMHDR   hdr;
  237.     DWORD   dwItemSpec;
  238.     DWORD   dwItemData;
  239.     POINT   pt;
  240.     DWORD   dwHitInfo; // any specifics about where on the item or control the mouse is
  241. } NMMOUSE, FAR* LPNMMOUSE;
  242.  
  243. typedef NMMOUSE NMCLICK;
  244. typedef LPNMMOUSE LPNMCLICK;
  245.  
  246. // Generic structure to request an object of a specific type.
  247.  
  248. typedef struct tagNMOBJECTNOTIFY {
  249.     NMHDR   hdr;
  250.     int     iItem;
  251. #ifdef __IID_DEFINED__
  252.     const IID *piid;
  253. #else
  254.     const void *piid;
  255. #endif
  256.     void *pObject;
  257.     HRESULT hResult;
  258.     DWORD dwFlags;    // control specific flags (hints as to where in iItem it hit)
  259. } NMOBJECTNOTIFY, *LPNMOBJECTNOTIFY;
  260.  
  261. // Generic structure for a key
  262.  
  263. typedef struct tagNMKEY
  264. {
  265.     NMHDR hdr;
  266.     UINT  nVKey;
  267.     UINT  uFlags;
  268. } NMKEY, FAR *LPNMKEY;
  269.  
  270. // Generic structure for a character
  271.  
  272. typedef struct tagNMCHAR {
  273.     NMHDR   hdr;
  274.     UINT    ch;
  275.     DWORD   dwItemPrev;     // Item previously selected 
  276.     DWORD   dwItemNext;     // Item to be selected
  277. } NMCHAR, FAR* LPNMCHAR;
  278.  
  279. #endif           // _WIN32_IE >= 0x0400
  280.  
  281. //====== WM_NOTIFY codes (NMHDR.code values) ==================================
  282.  
  283. #define NM_FIRST                (0U-  0U)       // generic to all controls
  284. #define NM_LAST                 (0U- 99U)
  285.  
  286. #define LVN_FIRST               (0U-100U)       // listview
  287. #define LVN_LAST                (0U-199U)
  288.  
  289. #define HDN_FIRST               (0U-300U)       // header
  290. #define HDN_LAST                (0U-399U)
  291.  
  292. #define TVN_FIRST               (0U-400U)       // treeview
  293. #define TVN_LAST                (0U-499U)
  294.  
  295. #define TTN_FIRST               (0U-520U)       // tooltips
  296. #define TTN_LAST                (0U-549U)
  297.  
  298. #define TCN_FIRST               (0U-550U)       // tab control
  299. #define TCN_LAST                (0U-580U)
  300.  
  301. // Shell reserved               (0U-580U) -  (0U-589U)
  302.  
  303. #define CDN_FIRST               (0U-601U)       // common dialog (new)
  304. #define CDN_LAST                (0U-699U)
  305.  
  306. #define TBN_FIRST               (0U-700U)       // toolbar
  307. #define TBN_LAST                (0U-720U)
  308.  
  309. #define UDN_FIRST               (0U-721)        // updown
  310. #define UDN_LAST                (0U-740)
  311. #if (_WIN32_IE >= 0x0300)
  312. #define MCN_FIRST               (0U-750U)       // monthcal
  313. #define MCN_LAST                (0U-759U)
  314.  
  315. #define DTN_FIRST               (0U-760U)       // datetimepick
  316. #define DTN_LAST                (0U-799U)
  317.  
  318. #define CBEN_FIRST              (0U-800U)       // combo box ex
  319. #define CBEN_LAST               (0U-830U)
  320.  
  321. #define RBN_FIRST               (0U-831U)       // rebar
  322. #define RBN_LAST                (0U-859U)
  323. #endif
  324.  
  325. #if (_WIN32_IE >= 0x0400)
  326. #define IPN_FIRST               (0U-860U)       // internet address
  327. #define IPN_LAST                (0U-879U)       // internet address
  328.  
  329. #define SBN_FIRST               (0U-880U)       // status bar
  330. #define SBN_LAST                (0U-899U)
  331.  
  332. #define PGN_FIRST               (0U-900U)       // Pager Control
  333. #define PGN_LAST                (0U-950U)
  334.  
  335. #endif
  336.  
  337. #define MSGF_COMMCTRL_BEGINDRAG     0x4200
  338. #define MSGF_COMMCTRL_SIZEHEADER    0x4201
  339. #define MSGF_COMMCTRL_DRAGSELECT    0x4202
  340. #define MSGF_COMMCTRL_TOOLBARCUST   0x4203
  341.  
  342. #if (_WIN32_IE >= 0x0300)
  343. //==================== CUSTOM DRAW ==========================================
  344.  
  345.  
  346. // custom draw return flags
  347. // values under 0x00010000 are reserved for global custom draw values.
  348. // above that are for specific controls
  349. #define CDRF_DODEFAULT          0x00000000
  350. #define CDRF_NEWFONT            0x00000002
  351. #define CDRF_SKIPDEFAULT        0x00000004
  352.  
  353.  
  354. #define CDRF_NOTIFYPOSTPAINT    0x00000010
  355. #define CDRF_NOTIFYITEMDRAW     0x00000020
  356. #if (_WIN32_IE >= 0x0400)
  357. #define CDRF_NOTIFYSUBITEMDRAW  0x00000020  // flags are the same, we can distinguish by context
  358. #endif
  359. #define CDRF_NOTIFYPOSTERASE    0x00000040
  360.  
  361. // drawstage flags
  362. // values under 0x00010000 are reserved for global custom draw values.
  363. // above that are for specific controls
  364. #define CDDS_PREPAINT           0x00000001
  365. #define CDDS_POSTPAINT          0x00000002
  366. #define CDDS_PREERASE           0x00000003
  367. #define CDDS_POSTERASE          0x00000004
  368. // the 0x000010000 bit means it's individual item specific
  369. #define CDDS_ITEM               0x00010000
  370. #define CDDS_ITEMPREPAINT       (CDDS_ITEM | CDDS_PREPAINT)
  371. #define CDDS_ITEMPOSTPAINT      (CDDS_ITEM | CDDS_POSTPAINT)
  372. #define CDDS_ITEMPREERASE       (CDDS_ITEM | CDDS_PREERASE)
  373. #define CDDS_ITEMPOSTERASE      (CDDS_ITEM | CDDS_POSTERASE)
  374. #if (_WIN32_IE >= 0x0400)
  375. #define CDDS_SUBITEM            0x00020000
  376. #endif
  377.  
  378.  
  379. // itemState flags
  380. #define CDIS_SELECTED       0x0001
  381. #define CDIS_GRAYED         0x0002
  382. #define CDIS_DISABLED       0x0004
  383. #define CDIS_CHECKED        0x0008
  384. #define CDIS_FOCUS          0x0010
  385. #define CDIS_DEFAULT        0x0020
  386. #define CDIS_HOT            0x0040
  387. #define CDIS_MARKED         0x0080
  388. #define CDIS_INDETERMINATE  0x0100
  389.  
  390. typedef struct tagNMCUSTOMDRAWINFO
  391. {
  392.     NMHDR hdr;
  393.     DWORD dwDrawStage;
  394.     HDC hdc;
  395.     RECT rc;
  396.     DWORD dwItemSpec;  // this is control specific, but it's how to specify an item.  valid only with CDDS_ITEM bit set
  397.     UINT  uItemState;
  398.     LPARAM lItemlParam;
  399. } NMCUSTOMDRAW, FAR * LPNMCUSTOMDRAW;
  400.  
  401.  
  402.  
  403. typedef struct tagNMTTCUSTOMDRAW
  404. {
  405.     NMCUSTOMDRAW nmcd;
  406.     UINT uDrawFlags;
  407. } NMTTCUSTOMDRAW, FAR * LPNMTTCUSTOMDRAW;
  408.  
  409. #endif      // _WIN32_IE >= 0x0300
  410.  
  411.  
  412. //====== IMAGE APIS ===========================================================
  413.  
  414. #ifndef NOIMAGEAPIS
  415.  
  416. #define CLR_NONE                0xFFFFFFFFL
  417. #define CLR_DEFAULT             0xFF000000L
  418.  
  419. struct _IMAGELIST;
  420. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  421.  
  422. #if (_WIN32_IE >= 0x0300)
  423. typedef struct _IMAGELISTDRAWPARAMS {
  424.     DWORD       cbSize;
  425.     HIMAGELIST  himl;
  426.     int         i;
  427.     HDC         hdcDst;
  428.     int         x;
  429.     int         y;
  430.     int         cx;
  431.     int         cy;
  432.     int         xBitmap;        // x offest from the upperleft of bitmap
  433.     int         yBitmap;        // y offset from the upperleft of bitmap
  434.     COLORREF    rgbBk;
  435.     COLORREF    rgbFg;
  436.     UINT        fStyle;
  437.     DWORD       dwRop;
  438. } IMAGELISTDRAWPARAMS, FAR * LPIMAGELISTDRAWPARAMS;
  439. #endif      // _WIN32_IE >= 0x0300
  440.  
  441. #define ILC_MASK                0x0001
  442. #define ILC_COLOR               0x0000
  443. #define ILC_COLORDDB            0x00FE
  444. #define ILC_COLOR4              0x0004
  445. #define ILC_COLOR8              0x0008
  446. #define ILC_COLOR16             0x0010
  447. #define ILC_COLOR24             0x0018
  448. #define ILC_COLOR32             0x0020
  449. #define ILC_PALETTE             0x0800      // (not implemented)
  450.  
  451. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
  452. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Destroy(HIMAGELIST himl);
  453. WINCOMMCTRLAPI int         WINAPI ImageList_GetImageCount(HIMAGELIST himl);
  454. #if (_WIN32_IE >= 0x0300)
  455. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetImageCount(HIMAGELIST himl, UINT uNewCount);
  456. #endif
  457. WINCOMMCTRLAPI int         WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  458. WINCOMMCTRLAPI int         WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  459. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  460. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_GetBkColor(HIMAGELIST himl);
  461. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  462.  
  463. #define     ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon)
  464.  
  465. #define ILD_NORMAL              0x0000
  466. #define ILD_TRANSPARENT         0x0001
  467. #define ILD_MASK                0x0010
  468. #define ILD_IMAGE               0x0020
  469. #if (_WIN32_IE >= 0x0300)
  470. #define ILD_ROP                 0x0040
  471. #endif
  472. #define ILD_BLEND25             0x0002
  473. #define ILD_BLEND50             0x0004
  474. #define ILD_OVERLAYMASK         0x0F00
  475. #define INDEXTOOVERLAYMASK(i)   ((i) << 8)
  476.  
  477. #define ILD_SELECTED            ILD_BLEND50
  478. #define ILD_FOCUS               ILD_BLEND25
  479. #define ILD_BLEND               ILD_BLEND50
  480. #define CLR_HILIGHT             CLR_DEFAULT
  481.  
  482. WINCOMMCTRLAPI BOOL WINAPI ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle);
  483.  
  484.  
  485. #ifdef _WIN32
  486.  
  487. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask);
  488. WINCOMMCTRLAPI int         WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask);
  489. 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);
  490. #if (_WIN32_IE >= 0x0300)
  491. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS* pimldp);
  492. #endif
  493. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Remove(HIMAGELIST himl, int i);
  494. WINCOMMCTRLAPI HICON       WINAPI ImageList_GetIcon(HIMAGELIST himl, int i, UINT flags);
  495. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageA(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  496. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  497.  
  498. #ifdef UNICODE
  499. #define ImageList_LoadImage     ImageList_LoadImageW
  500. #else
  501. #define ImageList_LoadImage     ImageList_LoadImageA
  502. #endif
  503.  
  504. #if (_WIN32_IE >= 0x0300)
  505. #define ILCF_MOVE   (0x00000000)
  506. #define ILCF_SWAP   (0x00000001)
  507. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Copy(HIMAGELIST himlDst, int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags);
  508. #endif
  509.  
  510. WINCOMMCTRLAPI BOOL        WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot);
  511. WINCOMMCTRLAPI void        WINAPI ImageList_EndDrag();
  512. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragEnter(HWND hwndLock, int x, int y);
  513. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragLeave(HWND hwndLock);
  514. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragMove(int x, int y);
  515. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot);
  516.  
  517. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragShowNolock(BOOL fShow);
  518. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_GetDragImage(POINT FAR* ppt,POINT FAR* pptHotspot);
  519.  
  520. #define     ImageList_RemoveAll(himl) ImageList_Remove(himl, -1)
  521. #define     ImageList_ExtractIcon(hi, himl, i) ImageList_GetIcon(himl, i, 0)
  522. #define     ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask) ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)
  523.  
  524. #ifdef __IStream_INTERFACE_DEFINED__
  525. WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm);
  526. WINCOMMCTRLAPI BOOL       WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
  527. #endif
  528.  
  529. typedef struct _IMAGEINFO
  530. {
  531.     HBITMAP hbmImage;
  532.     HBITMAP hbmMask;
  533.     int     Unused1;
  534.     int     Unused2;
  535.     RECT    rcImage;
  536. } IMAGEINFO, FAR *LPIMAGEINFO;
  537.  
  538. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetIconSize(HIMAGELIST himl, int FAR *cx, int FAR *cy);
  539. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetIconSize(HIMAGELIST himl, int cx, int cy);
  540. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO FAR* pImageInfo);
  541. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
  542. #if (_WIN32_IE >= 0x0400)
  543. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Duplicate(HIMAGELIST himl);
  544. #endif
  545.  
  546.  
  547. #endif
  548.  
  549. #endif
  550.  
  551.  
  552. //====== HEADER CONTROL =======================================================
  553.  
  554. #ifndef NOHEADER
  555.  
  556. #ifdef _WIN32
  557. #define WC_HEADERA              "SysHeader32"
  558. #define WC_HEADERW              L"SysHeader32"
  559.  
  560. #ifdef UNICODE
  561. #define WC_HEADER               WC_HEADERW
  562. #else
  563. #define WC_HEADER               WC_HEADERA
  564. #endif
  565.  
  566. #else
  567. #define WC_HEADER               "SysHeader"
  568. #endif
  569.  
  570. // begin_r_commctrl
  571.  
  572. #define HDS_HORZ                0x0000
  573. #define HDS_BUTTONS             0x0002
  574. #if (_WIN32_IE >= 0x0300)
  575. #define HDS_HOTTRACK            0x0004
  576. #endif
  577. #define HDS_HIDDEN              0x0008
  578.  
  579. #if (_WIN32_IE >= 0x0300)
  580. #define HDS_DRAGDROP            0x0040
  581. #define HDS_FULLDRAG            0x0080
  582. #endif
  583.  
  584. // end_r_commctrl
  585.  
  586. #if (_WIN32_IE >= 0x0300)
  587. #define HD_ITEMA HDITEMA
  588. #define HD_ITEMW HDITEMW
  589. #else
  590. #define HDITEMW  HD_ITEMW
  591. #define HDITEMA  HD_ITEMA
  592. #endif
  593. #define HD_ITEM HDITEM
  594.  
  595. typedef struct _HD_ITEMA
  596. {
  597.     UINT    mask;
  598.     int     cxy;
  599.     LPSTR   pszText;
  600.     HBITMAP hbm;
  601.     int     cchTextMax;
  602.     int     fmt;
  603.     LPARAM  lParam;
  604. #if (_WIN32_IE >= 0x0300)
  605.     int     iImage;        // index of bitmap in ImageList
  606.     int     iOrder;        // where to draw this item
  607. #endif
  608. } HDITEMA, FAR * LPHDITEMA;
  609.  
  610. #define HDITEMA_V1_SIZE CCSIZEOF_STRUCT(HDITEMA, lParam)
  611. #define HDITEMW_V1_SIZE CCSIZEOF_STRUCT(HDITEMW, lParam)
  612.  
  613.  
  614. typedef struct _HD_ITEMW
  615. {
  616.     UINT    mask;
  617.     int     cxy;
  618.     LPWSTR   pszText;
  619.     HBITMAP hbm;
  620.     int     cchTextMax;
  621.     int     fmt;
  622.     LPARAM  lParam;
  623. #if (_WIN32_IE >= 0x0300)
  624.     int     iImage;        // index of bitmap in ImageList
  625.     int     iOrder;
  626. #endif
  627. } HDITEMW, FAR * LPHDITEMW;
  628.  
  629. #ifdef UNICODE
  630. #define HDITEM HDITEMW
  631. #define LPHDITEM LPHDITEMW
  632. #define HDITEM_V1_SIZE HDITEMW_V1_SIZE
  633. #else
  634. #define HDITEM HDITEMA
  635. #define LPHDITEM LPHDITEMA
  636. #define HDITEM_V1_SIZE HDITEMA_V1_SIZE
  637. #endif
  638.  
  639.  
  640. #define HDI_WIDTH               0x0001
  641. #define HDI_HEIGHT              HDI_WIDTH
  642. #define HDI_TEXT                0x0002
  643. #define HDI_FORMAT              0x0004
  644. #define HDI_LPARAM              0x0008
  645. #define HDI_BITMAP              0x0010
  646. #if (_WIN32_IE >= 0x0300)
  647. #define HDI_IMAGE               0x0020
  648. #define HDI_DI_SETITEM          0x0040
  649. #define HDI_ORDER               0x0080
  650. #endif
  651.  
  652. #define HDF_LEFT                0
  653. #define HDF_RIGHT               1
  654. #define HDF_CENTER              2
  655. #define HDF_JUSTIFYMASK         0x0003
  656. #define HDF_RTLREADING          4
  657.  
  658. #define HDF_OWNERDRAW           0x8000
  659. #define HDF_STRING              0x4000
  660. #define HDF_BITMAP              0x2000
  661. #if (_WIN32_IE >= 0x0300)
  662. #define HDF_BITMAP_ON_RIGHT     0x1000
  663. #define HDF_IMAGE               0x0800
  664. #endif
  665.  
  666. #define HDM_GETITEMCOUNT        (HDM_FIRST + 0)
  667. #define Header_GetItemCount(hwndHD) \
  668.     (int)SNDMSG((hwndHD), HDM_GETITEMCOUNT, 0, 0L)
  669.  
  670.  
  671. #define HDM_INSERTITEMA         (HDM_FIRST + 1)
  672. #define HDM_INSERTITEMW         (HDM_FIRST + 10)
  673.  
  674. #ifdef UNICODE
  675. #define HDM_INSERTITEM          HDM_INSERTITEMW
  676. #else
  677. #define HDM_INSERTITEM          HDM_INSERTITEMA
  678. #endif
  679.  
  680. #define Header_InsertItem(hwndHD, i, phdi) \
  681.     (int)SNDMSG((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  682.  
  683.  
  684. #define HDM_DELETEITEM          (HDM_FIRST + 2)
  685. #define Header_DeleteItem(hwndHD, i) \
  686.     (BOOL)SNDMSG((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(i), 0L)
  687.  
  688.  
  689. #define HDM_GETITEMA            (HDM_FIRST + 3)
  690. #define HDM_GETITEMW            (HDM_FIRST + 11)
  691.  
  692. #ifdef UNICODE
  693. #define HDM_GETITEM             HDM_GETITEMW
  694. #else
  695. #define HDM_GETITEM             HDM_GETITEMA
  696. #endif
  697.  
  698. #define Header_GetItem(hwndHD, i, phdi) \
  699.     (BOOL)SNDMSG((hwndHD), HDM_GETITEM, (WPARAM)(int)(i), (LPARAM)(HD_ITEM FAR*)(phdi))
  700.  
  701.  
  702. #define HDM_SETITEMA            (HDM_FIRST + 4)
  703. #define HDM_SETITEMW            (HDM_FIRST + 12)
  704.  
  705. #ifdef UNICODE
  706. #define HDM_SETITEM             HDM_SETITEMW
  707. #else
  708. #define HDM_SETITEM             HDM_SETITEMA
  709. #endif
  710.  
  711. #define Header_SetItem(hwndHD, i, phdi) \
  712.     (BOOL)SNDMSG((hwndHD), HDM_SETITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  713.  
  714. #if (_WIN32_IE >= 0x0300)
  715. #define HD_LAYOUT  HDLAYOUT
  716. #else
  717. #define HDLAYOUT   HD_LAYOUT
  718. #endif
  719.  
  720. typedef struct _HD_LAYOUT
  721. {
  722.     RECT FAR* prc;
  723.     WINDOWPOS FAR* pwpos;
  724. } HDLAYOUT, FAR *LPHDLAYOUT;
  725.  
  726.  
  727. #define HDM_LAYOUT              (HDM_FIRST + 5)
  728. #define Header_Layout(hwndHD, playout) \
  729.     (BOOL)SNDMSG((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout))
  730.  
  731.  
  732. #define HHT_NOWHERE             0x0001
  733. #define HHT_ONHEADER            0x0002
  734. #define HHT_ONDIVIDER           0x0004
  735. #define HHT_ONDIVOPEN           0x0008
  736. #define HHT_ABOVE               0x0100
  737. #define HHT_BELOW               0x0200
  738. #define HHT_TORIGHT             0x0400
  739. #define HHT_TOLEFT              0x0800
  740.  
  741. #if (_WIN32_IE >= 0x0300)
  742. #define HD_HITTESTINFO HDHITTESTINFO
  743. #else
  744. #define HDHITTESTINFO  HD_HITTESTINFO
  745. #endif
  746.  
  747. typedef struct _HD_HITTESTINFO
  748. {
  749.     POINT pt;
  750.     UINT flags;
  751.     int iItem;
  752. } HDHITTESTINFO, FAR *LPHDHITTESTINFO;
  753.  
  754.  
  755. #define HDM_HITTEST             (HDM_FIRST + 6)
  756.  
  757. #if (_WIN32_IE >= 0x0300)
  758.  
  759. #define HDM_GETITEMRECT         (HDM_FIRST + 7)
  760. #define Header_GetItemRect(hwnd, iItem, lprc) \
  761.         (BOOL)SNDMSG((hwnd), HDM_GETITEMRECT, (WPARAM)iItem, (LPARAM)lprc)
  762.  
  763. #define HDM_SETIMAGELIST        (HDM_FIRST + 8)
  764. #define Header_SetImageList(hwnd, himl) \
  765.         (HIMAGELIST)SNDMSG((hwnd), HDM_SETIMAGELIST, 0, (LPARAM)himl)
  766.  
  767. #define HDM_GETIMAGELIST        (HDM_FIRST + 9)
  768. #define Header_GetImageList(hwnd) \
  769.         (HIMAGELIST)SNDMSG((hwnd), HDM_GETIMAGELIST, 0, 0)
  770.  
  771.  
  772. #define HDM_ORDERTOINDEX        (HDM_FIRST + 15)
  773. #define Header_OrderToIndex(hwnd, i) \
  774.         (int)SNDMSG((hwnd), HDM_ORDERTOINDEX, (WPARAM)i, 0)
  775.  
  776. #define HDM_CREATEDRAGIMAGE     (HDM_FIRST + 16)  // wparam = which item (by index)
  777. #define Header_CreateDragImage(hwnd, i) \
  778.         (HIMAGELIST)SNDMSG((hwnd), HDM_CREATEDRAGIMAGE, (WPARAM)i, 0)
  779.  
  780. #define HDM_GETORDERARRAY       (HDM_FIRST + 17)
  781. #define Header_GetOrderArray(hwnd, iCount, lpi) \
  782.         (BOOL)SNDMSG((hwnd), HDM_GETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)
  783.  
  784. #define HDM_SETORDERARRAY       (HDM_FIRST + 18)
  785. #define Header_SetOrderArray(hwnd, iCount, lpi) \
  786.         (BOOL)SNDMSG((hwnd), HDM_SETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)
  787. // lparam = int array of size HDM_GETITEMCOUNT
  788. // the array specifies the order that all items should be displayed.
  789. // e.g.  { 2, 0, 1}
  790. // says the index 2 item should be shown in the 0ths position
  791. //      index 0 should be shown in the 1st position
  792. //      index 1 should be shown in the 2nd position
  793.  
  794.  
  795. #define HDM_SETHOTDIVIDER          (HDM_FIRST + 19)
  796. #define Header_SetHotDivider(hwnd, fPos, dw) \
  797.         (int)SNDMSG((hwnd), HDM_SETHOTDIVIDER, (WPARAM)fPos, (LPARAM)dw)
  798. // convenience message for external dragdrop
  799. // wParam = BOOL  specifying whether the lParam is a dwPos of the cursor
  800. //              position or the index of which divider to hotlight
  801. // lParam = depends on wParam  (-1 and wParm = FALSE turns off hotlight)
  802. #endif      // _WIN32_IE >= 0x0300
  803.  
  804. #if (_WIN32_IE >= 0x0400)
  805. #define HDM_SETUNICODEFORMAT   CCM_SETUNICODEFORMAT
  806. #define Header_SetUnicodeFormat(hwnd, fUnicode)  \
  807.     (BOOL)SNDMSG((hwnd), HDM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0)
  808.  
  809. #define HDM_GETUNICODEFORMAT   CCM_GETUNICODEFORMAT
  810. #define Header_GetUnicodeFormat(hwnd)  \
  811.     (BOOL)SNDMSG((hwnd), HDM_GETUNICODEFORMAT, 0, 0)
  812. #endif
  813.  
  814. #define HDN_ITEMCHANGINGA       (HDN_FIRST-0)
  815. #define HDN_ITEMCHANGINGW       (HDN_FIRST-20)
  816. #define HDN_ITEMCHANGEDA        (HDN_FIRST-1)
  817. #define HDN_ITEMCHANGEDW        (HDN_FIRST-21)
  818. #define HDN_ITEMCLICKA          (HDN_FIRST-2)
  819. #define HDN_ITEMCLICKW          (HDN_FIRST-22)
  820. #define HDN_ITEMDBLCLICKA       (HDN_FIRST-3)
  821. #define HDN_ITEMDBLCLICKW       (HDN_FIRST-23)
  822. #define HDN_DIVIDERDBLCLICKA    (HDN_FIRST-5)
  823. #define HDN_DIVIDERDBLCLICKW    (HDN_FIRST-25)
  824. #define HDN_BEGINTRACKA         (HDN_FIRST-6)
  825. #define HDN_BEGINTRACKW         (HDN_FIRST-26)
  826. #define HDN_ENDTRACKA           (HDN_FIRST-7)
  827. #define HDN_ENDTRACKW           (HDN_FIRST-27)
  828. #define HDN_TRACKA              (HDN_FIRST-8)
  829. #define HDN_TRACKW              (HDN_FIRST-28)
  830. #if (_WIN32_IE >= 0x0300)
  831. #define HDN_GETDISPINFOA        (HDN_FIRST-9)
  832. #define HDN_GETDISPINFOW        (HDN_FIRST-29)
  833. #define HDN_BEGINDRAG           (HDN_FIRST-10)
  834. #define HDN_ENDDRAG             (HDN_FIRST-11)
  835. #endif
  836.  
  837. #ifdef UNICODE
  838. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGW
  839. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDW
  840. #define HDN_ITEMCLICK            HDN_ITEMCLICKW
  841. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKW
  842. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKW
  843. #define HDN_BEGINTRACK           HDN_BEGINTRACKW
  844. #define HDN_ENDTRACK             HDN_ENDTRACKW
  845. #define HDN_TRACK                HDN_TRACKW
  846. #if (_WIN32_IE >= 0x0300)
  847. #define HDN_GETDISPINFO          HDN_GETDISPINFOW
  848. #endif
  849. #else
  850. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGA
  851. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDA
  852. #define HDN_ITEMCLICK            HDN_ITEMCLICKA
  853. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKA
  854. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKA
  855. #define HDN_BEGINTRACK           HDN_BEGINTRACKA
  856. #define HDN_ENDTRACK             HDN_ENDTRACKA
  857. #define HDN_TRACK                HDN_TRACKA
  858. #if (_WIN32_IE >= 0x0300)
  859. #define HDN_GETDISPINFO          HDN_GETDISPINFOA
  860. #endif
  861. #endif
  862.  
  863.  
  864.  
  865. #if (_WIN32_IE >= 0x0300)
  866. #define HD_NOTIFYA              NMHEADERA
  867. #define HD_NOTIFYW              NMHEADERW
  868. #else
  869. #define tagNMHEADERA            _HD_NOTIFY
  870. #define NMHEADERA               HD_NOTIFYA
  871. #define tagHMHEADERW            _HD_NOTIFYW
  872. #define NMHEADERW               HD_NOTIFYW
  873. #endif
  874. #define HD_NOTIFY               NMHEADER
  875.  
  876. typedef struct tagNMHEADERA
  877. {
  878.     NMHDR   hdr;
  879.     int     iItem;
  880.     int     iButton;
  881.     HDITEMA FAR* pitem;
  882. }  NMHEADERA, FAR* LPNMHEADERA;
  883.  
  884.  
  885. typedef struct tagNMHEADERW
  886. {
  887.     NMHDR   hdr;
  888.     int     iItem;
  889.     int     iButton;
  890.     HDITEMW FAR* pitem;
  891. } NMHEADERW, FAR* LPNMHEADERW;
  892.  
  893. #ifdef UNICODE
  894. #define NMHEADER                NMHEADERW
  895. #define LPNMHEADER              LPNMHEADERW
  896. #else
  897. #define NMHEADER                NMHEADERA
  898. #define LPNMHEADER              LPNMHEADERA
  899. #endif
  900.  
  901. typedef struct tagNMHDDISPINFOW
  902. {
  903.     NMHDR   hdr;
  904.     int     iItem;
  905.     UINT    mask;
  906.     LPWSTR  pszText;
  907.     int     cchTextMax;
  908.     int     iImage;
  909.     LPARAM  lParam;
  910. } NMHDDISPINFOW, FAR* LPNMHDDISPINFOW;
  911.  
  912. typedef struct tagNMHDDISPINFOA
  913. {
  914.     NMHDR   hdr;
  915.     int     iItem;
  916.     UINT    mask;
  917.     LPSTR   pszText;
  918.     int     cchTextMax;
  919.     int     iImage;
  920.     LPARAM  lParam;
  921. } NMHDDISPINFOA, FAR* LPNMHDDISPINFOA;
  922.  
  923.  
  924. #ifdef UNICODE
  925. #define NMHDDISPINFO            NMHDDISPINFOW
  926. #define LPNMHDDISPINFO          LPNMHDDISPINFOW
  927. #else
  928. #define NMHDDISPINFO            NMHDDISPINFOA
  929. #define LPNMHDDISPINFO          LPNMHDDISPINFOA
  930. #endif
  931.  
  932. #endif      // NOHEADER
  933.  
  934.  
  935. //====== TOOLBAR CONTROL ======================================================
  936.  
  937. #ifndef NOTOOLBAR
  938.  
  939. #ifdef _WIN32
  940. #define TOOLBARCLASSNAMEW       L"ToolbarWindow32"
  941. #define TOOLBARCLASSNAMEA       "ToolbarWindow32"
  942.  
  943. #ifdef  UNICODE
  944. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEW
  945. #else
  946. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEA
  947. #endif
  948.  
  949. #else
  950. #define TOOLBARCLASSNAME        "ToolbarWindow"
  951. #endif
  952.  
  953. typedef struct _TBBUTTON {
  954.     int iBitmap;
  955.     int idCommand;
  956.     BYTE fsState;
  957.     BYTE fsStyle;
  958. #ifdef _WIN32
  959.     BYTE bReserved[2];
  960. #endif
  961.     DWORD dwData;
  962.     int iString;
  963. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  964. typedef const TBBUTTON FAR* LPCTBBUTTON;
  965.  
  966.  
  967. typedef struct _COLORMAP {
  968.     COLORREF from;
  969.     COLORREF to;
  970. } COLORMAP, FAR* LPCOLORMAP;
  971.  
  972. WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  973.                         HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  974.                         int iNumButtons, int dxButton, int dyButton,
  975.                         int dxBitmap, int dyBitmap, UINT uStructSize);
  976.  
  977. WINCOMMCTRLAPI HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, int idBitmap,
  978.                                   UINT wFlags, LPCOLORMAP lpColorMap,
  979.                                   int iNumMaps);
  980.  
  981. #define CMB_MASKED              0x02
  982.  
  983. #define TBSTATE_CHECKED         0x01
  984. #define TBSTATE_PRESSED         0x02
  985. #define TBSTATE_ENABLED         0x04
  986. #define TBSTATE_HIDDEN          0x08
  987. #define TBSTATE_INDETERMINATE   0x10
  988. #define TBSTATE_WRAP            0x20
  989. #if (_WIN32_IE >= 0x0300)
  990. #define TBSTATE_ELLIPSES        0x40
  991. #endif
  992. #if (_WIN32_IE >= 0x0400)
  993. #define TBSTATE_MARKED          0x80
  994. #endif
  995.  
  996. #define TBSTYLE_BUTTON          0x0000
  997. #define TBSTYLE_SEP             0x0001
  998. #define TBSTYLE_CHECK           0x0002
  999. #define TBSTYLE_GROUP           0x0004
  1000. #define TBSTYLE_CHECKGROUP      (TBSTYLE_GROUP | TBSTYLE_CHECK)
  1001. #if (_WIN32_IE >= 0x0300)
  1002. #define TBSTYLE_DROPDOWN        0x0008
  1003. #endif
  1004. #if (_WIN32_IE >= 0x0400)
  1005. #define TBSTYLE_AUTOSIZE        0x0010 // automatically calculate the cx of the button
  1006. #define TBSTYLE_NOPREFIX        0x0020 // if this button should not have accel prefix
  1007. #endif
  1008.  
  1009. #define TBSTYLE_TOOLTIPS        0x0100
  1010. #define TBSTYLE_WRAPABLE        0x0200
  1011. #define TBSTYLE_ALTDRAG         0x0400
  1012. #if (_WIN32_IE >= 0x0300)
  1013. #define TBSTYLE_FLAT            0x0800
  1014. #define TBSTYLE_LIST            0x1000
  1015. #define TBSTYLE_CUSTOMERASE     0x2000
  1016. #endif
  1017. #if (_WIN32_IE >= 0x0400)
  1018. #define TBSTYLE_REGISTERDROP    0x4000
  1019. #define TBSTYLE_TRANSPARENT     0x8000
  1020. #define TBSTYLE_EX_DRAWDDARROWS 0x00000001
  1021. #endif
  1022.  
  1023. #if (_WIN32_IE >= 0x0400)
  1024. // Custom Draw Structure
  1025. typedef struct _NMTBCUSTOMDRAW {
  1026.     NMCUSTOMDRAW nmcd;
  1027.     HBRUSH hbrMonoDither;
  1028.     HBRUSH hbrLines;                // For drawing lines on buttons
  1029.     HPEN hpenLines;                 // For drawing lines on buttons
  1030.  
  1031.     COLORREF clrText;               // Color of text
  1032.     COLORREF clrMark;               // Color of text bk when marked. (only if TBSTATE_MARKED)
  1033.     COLORREF clrTextHighlight;      // Color of text when highlighted
  1034.     COLORREF clrBtnFace;            // Background of the button
  1035.     COLORREF clrBtnHighlight;       // 3D highlight
  1036.     COLORREF clrHighlightHotTrack;  // In conjunction with fHighlightHotTrack
  1037.                                     // will cause button to highlight like a menu
  1038.     RECT rcText;                    // Rect for text
  1039.  
  1040.     int nStringBkMode;
  1041.     int nHLStringBkMode;
  1042. } NMTBCUSTOMDRAW, * LPNMTBCUSTOMDRAW;
  1043.  
  1044. // Toolbar custom draw return flags
  1045. #define TBCDRF_NOEDGES              0x00010000  // Don't draw button edges
  1046. #define TBCDRF_HILITEHOTTRACK       0x00020000  // Use color of the button bk when hottracked
  1047. #define TBCDRF_NOOFFSET             0x00040000  // Don't offset button if pressed
  1048. #define TBCDRF_NOMARK               0x00080000  // Don't draw default highlight of image/text for TBSTATE_MARKED
  1049. #define TBCDRF_NOETCHEDEFFECT       0x00100000  // Don't draw etched effect for disabled items
  1050.  
  1051. #endif
  1052.  
  1053. #define TB_ENABLEBUTTON         (WM_USER + 1)
  1054. #define TB_CHECKBUTTON          (WM_USER + 2)
  1055. #define TB_PRESSBUTTON          (WM_USER + 3)
  1056. #define TB_HIDEBUTTON           (WM_USER + 4)
  1057. #define TB_INDETERMINATE        (WM_USER + 5)
  1058. #if (_WIN32_IE >= 0x0400)
  1059. #define TB_MARKBUTTON           (WM_USER + 6)
  1060. #endif
  1061. #define TB_ISBUTTONENABLED      (WM_USER + 9)
  1062. #define TB_ISBUTTONCHECKED      (WM_USER + 10)
  1063. #define TB_ISBUTTONPRESSED      (WM_USER + 11)
  1064. #define TB_ISBUTTONHIDDEN       (WM_USER + 12)
  1065. #define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
  1066. #if (_WIN32_IE >= 0x0400)
  1067. #define TB_ISBUTTONHIGHLIGHTED  (WM_USER + 14)
  1068. #endif
  1069. #define TB_SETSTATE             (WM_USER + 17)
  1070. #define TB_GETSTATE             (WM_USER + 18)
  1071. #define TB_ADDBITMAP            (WM_USER + 19)
  1072.  
  1073. #ifdef _WIN32
  1074. typedef struct tagTBADDBITMAP {
  1075.         HINSTANCE       hInst;
  1076.         UINT            nID;
  1077. } TBADDBITMAP, *LPTBADDBITMAP;
  1078.  
  1079. #define HINST_COMMCTRL          ((HINSTANCE)-1)
  1080. #define IDB_STD_SMALL_COLOR     0
  1081. #define IDB_STD_LARGE_COLOR     1
  1082. #define IDB_VIEW_SMALL_COLOR    4
  1083. #define IDB_VIEW_LARGE_COLOR    5
  1084. #if (_WIN32_IE >= 0x0300)
  1085. #define IDB_HIST_SMALL_COLOR    8
  1086. #define IDB_HIST_LARGE_COLOR    9
  1087. #endif
  1088.  
  1089. // icon indexes for standard bitmap
  1090.  
  1091. #define STD_CUT                 0
  1092. #define STD_COPY                1
  1093. #define STD_PASTE               2
  1094. #define STD_UNDO                3
  1095. #define STD_REDOW               4
  1096. #define STD_DELETE              5
  1097. #define STD_FILENEW             6
  1098. #define STD_FILEOPEN            7
  1099. #define STD_FILESAVE            8
  1100. #define STD_PRINTPRE            9
  1101. #define STD_PROPERTIES          10
  1102. #define STD_HELP                11
  1103. #define STD_FIND                12
  1104. #define STD_REPLACE             13
  1105. #define STD_PRINT               14
  1106.  
  1107. // icon indexes for standard view bitmap
  1108.  
  1109. #define VIEW_LARGEICONS         0
  1110. #define VIEW_SMALLICONS         1
  1111. #define VIEW_LIST               2
  1112. #define VIEW_DETAILS            3
  1113. #define VIEW_SORTNAME           4
  1114. #define VIEW_SORTSIZE           5
  1115. #define VIEW_SORTDATE           6
  1116. #define VIEW_SORTTYPE           7
  1117. #define VIEW_PARENTFOLDER       8
  1118. #define VIEW_NETCONNECT         9
  1119. #define VIEW_NETDISCONNECT      10
  1120. #define VIEW_NEWFOLDER          11
  1121. #if (_WIN32_IE >= 0x0400)
  1122. #define VIEW_VIEWMENU           12
  1123. #endif
  1124.  
  1125. #if (_WIN32_IE >= 0x0300)
  1126. #define HIST_BACK               0
  1127. #define HIST_FORWARD            1
  1128. #define HIST_FAVORITES          2
  1129. #define HIST_ADDTOFAVORITES     3
  1130. #define HIST_VIEWTREE           4
  1131. #endif
  1132.  
  1133. #endif
  1134.  
  1135. #if (_WIN32_IE >= 0x0400)
  1136. #define TB_ADDBUTTONSA          (WM_USER + 20)
  1137. #define TB_INSERTBUTTONA        (WM_USER + 21)
  1138. #else
  1139. #define TB_ADDBUTTONS           (WM_USER + 20)
  1140. #define TB_INSERTBUTTON         (WM_USER + 21)
  1141. #endif
  1142.  
  1143. #define TB_DELETEBUTTON         (WM_USER + 22)
  1144. #define TB_GETBUTTON            (WM_USER + 23)
  1145. #define TB_BUTTONCOUNT          (WM_USER + 24)
  1146. #define TB_COMMANDTOINDEX       (WM_USER + 25)
  1147.  
  1148. #ifdef _WIN32
  1149.  
  1150. typedef struct tagTBSAVEPARAMSA {
  1151.     HKEY hkr;
  1152.     LPCSTR pszSubKey;
  1153.     LPCSTR pszValueName;
  1154. } TBSAVEPARAMSA, FAR* LPTBSAVEPARAMSA;
  1155.  
  1156. typedef struct tagTBSAVEPARAMSW {
  1157.     HKEY hkr;
  1158.     LPCWSTR pszSubKey;
  1159.     LPCWSTR pszValueName;
  1160. } TBSAVEPARAMSW, FAR *LPTBSAVEPARAMW;
  1161.  
  1162. #ifdef UNICODE
  1163. #define TBSAVEPARAMS            TBSAVEPARAMSW
  1164. #define LPTBSAVEPARAMS          LPTBSAVEPARAMSW
  1165. #else
  1166. #define TBSAVEPARAMS            TBSAVEPARAMSA
  1167. #define LPTBSAVEPARAMS          LPTBSAVEPARAMSA
  1168. #endif
  1169.  
  1170. #endif  // _WIN32
  1171.  
  1172. #define TB_SAVERESTOREA         (WM_USER + 26)
  1173. #define TB_SAVERESTOREW         (WM_USER + 76)
  1174. #define TB_CUSTOMIZE            (WM_USER + 27)
  1175. #define TB_ADDSTRINGA           (WM_USER + 28)
  1176. #define TB_ADDSTRINGW           (WM_USER + 77)
  1177. #define TB_GETITEMRECT          (WM_USER + 29)
  1178. #define TB_BUTTONSTRUCTSIZE     (WM_USER + 30)
  1179. #define TB_SETBUTTONSIZE        (WM_USER + 31)
  1180. #define TB_SETBITMAPSIZE        (WM_USER + 32)
  1181. #define TB_AUTOSIZE             (WM_USER + 33)
  1182. #define TB_GETTOOLTIPS          (WM_USER + 35)
  1183. #define TB_SETTOOLTIPS          (WM_USER + 36)
  1184. #define TB_SETPARENT            (WM_USER + 37)
  1185. #define TB_SETROWS              (WM_USER + 39)
  1186. #define TB_GETROWS              (WM_USER + 40)
  1187. #define TB_SETCMDID             (WM_USER + 42)
  1188. #define TB_CHANGEBITMAP         (WM_USER + 43)
  1189. #define TB_GETBITMAP            (WM_USER + 44)
  1190. #define TB_GETBUTTONTEXTA       (WM_USER + 45)
  1191. #define TB_GETBUTTONTEXTW       (WM_USER + 75)
  1192. #define TB_REPLACEBITMAP        (WM_USER + 46)
  1193. #if (_WIN32_IE >= 0x0300)
  1194. #define TB_SETINDENT            (WM_USER + 47)
  1195. #define TB_SETIMAGELIST         (WM_USER + 48)
  1196. #define TB_GETIMAGELIST         (WM_USER + 49)
  1197. #define TB_LOADIMAGES           (WM_USER + 50)
  1198. #define TB_GETRECT              (WM_USER + 51) // wParam is the Cmd instead of index
  1199. #define TB_SETHOTIMAGELIST      (WM_USER + 52)
  1200. #define TB_GETHOTIMAGELIST      (WM_USER + 53)
  1201. #define TB_SETDISABLEDIMAGELIST (WM_USER + 54)
  1202. #define TB_GETDISABLEDIMAGELIST (WM_USER + 55)
  1203. #define TB_SETSTYLE             (WM_USER + 56)
  1204. #define TB_GETSTYLE             (WM_USER + 57)
  1205. #define TB_GETBUTTONSIZE        (WM_USER + 58)
  1206. #define TB_SETBUTTONWIDTH       (WM_USER + 59)
  1207. #define TB_SETMAXTEXTROWS       (WM_USER + 60)
  1208. #define TB_GETTEXTROWS          (WM_USER + 61)
  1209. #endif      // _WIN32_IE >= 0x0300
  1210.  
  1211. #ifdef UNICODE
  1212. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTW
  1213. #define TB_SAVERESTORE          TB_SAVERESTOREW
  1214. #define TB_ADDSTRING            TB_ADDSTRINGW
  1215. #else
  1216. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTA
  1217. #define TB_SAVERESTORE          TB_SAVERESTOREA
  1218. #define TB_ADDSTRING            TB_ADDSTRINGA
  1219. #endif
  1220. #if (_WIN32_IE >= 0x0400)
  1221. #define TB_GETOBJECT            (WM_USER + 62)  // wParam == IID, lParam void **ppv
  1222. #define TB_GETHOTITEM           (WM_USER + 71)
  1223. #define TB_SETHOTITEM           (WM_USER + 72)  // wParam == iHotItem
  1224. #define TB_SETANCHORHIGHLIGHT   (WM_USER + 73)  // wParam == TRUE/FALSE
  1225. #define TB_GETANCHORHIGHLIGHT   (WM_USER + 74)
  1226. #define TB_MAPACCELERATORA      (WM_USER + 78)  // wParam == ch, lParam int * pidBtn
  1227.  
  1228. typedef struct {
  1229.     int   iButton;
  1230.     DWORD dwFlags;
  1231. } TBINSERTMARK, * LPTBINSERTMARK;
  1232. #define TBIMHT_AFTER      0x00000001 // TRUE = insert After iButton, otherwise before
  1233. #define TBIMHT_BACKGROUND 0x00000002 // TRUE iff missed buttons completely
  1234.  
  1235. #define TB_GETINSERTMARK        (WM_USER + 79)  // lParam == LPTBINSERTMARK
  1236. #define TB_SETINSERTMARK        (WM_USER + 80)  // lParam == LPTBINSERTMARK
  1237. #define TB_INSERTMARKHITTEST    (WM_USER + 81)  // wParam == LPPOINT lParam == LPTBINSERTMARK
  1238. #define TB_MOVEBUTTON           (WM_USER + 82)
  1239. #define TB_GETMAXSIZE           (WM_USER + 83)  // lParam == LPSIZE
  1240. #define TB_SETEXTENDEDSTYLE     (WM_USER + 84)  // For TBSTYLE_EX_*
  1241. #define TB_GETEXTENDEDSTYLE     (WM_USER + 85)  // For TBSTYLE_EX_*
  1242. #define TB_GETPADDING           (WM_USER + 86)
  1243. #define TB_SETPADDING           (WM_USER + 87)
  1244. #define TB_SETINSERTMARKCOLOR   (WM_USER + 88)
  1245. #define TB_GETINSERTMARKCOLOR   (WM_USER + 89)
  1246.  
  1247. #define TB_SETCOLORSCHEME       CCM_SETCOLORSCHEME  // lParam is color scheme
  1248. #define TB_GETCOLORSCHEME       CCM_GETCOLORSCHEME    // fills in COLORSCHEME pointed to by lParam
  1249.  
  1250. #define TB_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  1251. #define TB_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  1252.  
  1253. #define TB_MAPACCELERATORW      (WM_USER + 90)  // wParam == ch, lParam int * pidBtn
  1254. #ifdef UNICODE
  1255. #define TB_MAPACCELERATOR       TB_MAPACCELERATORW      
  1256. #else
  1257. #define TB_MAPACCELERATOR       TB_MAPACCELERATORA
  1258. #endif
  1259. #endif  // _WIN32_IE >= 0x0400
  1260.  
  1261. typedef struct {
  1262.     HINSTANCE       hInstOld;
  1263.     UINT            nIDOld;
  1264.     HINSTANCE       hInstNew;
  1265.     UINT            nIDNew;
  1266.     int             nButtons;
  1267. } TBREPLACEBITMAP, *LPTBREPLACEBITMAP;
  1268.  
  1269. #ifdef _WIN32
  1270.  
  1271. #define TBBF_LARGE              0x0001
  1272.  
  1273. #define TB_GETBITMAPFLAGS       (WM_USER + 41)
  1274.  
  1275. #if (_WIN32_IE >= 0x0400)
  1276. #define TBIF_IMAGE              0x00000001
  1277. #define TBIF_TEXT               0x00000002
  1278. #define TBIF_STATE              0x00000004
  1279. #define TBIF_STYLE              0x00000008
  1280. #define TBIF_LPARAM             0x00000010
  1281. #define TBIF_COMMAND            0x00000020
  1282. #define TBIF_SIZE               0x00000040
  1283.  
  1284. typedef struct {
  1285.     UINT cbSize;
  1286.     DWORD dwMask;
  1287.     int idCommand;
  1288.     int iImage;
  1289.     BYTE fsState;
  1290.     BYTE fsStyle;
  1291.     WORD cx;
  1292.     DWORD lParam;
  1293.     LPSTR pszText;
  1294.     int cchText;
  1295. } TBBUTTONINFOA, *LPTBBUTTONINFOA;
  1296.  
  1297. typedef struct {
  1298.     UINT cbSize;
  1299.     DWORD dwMask;
  1300.     int idCommand;
  1301.     int iImage;
  1302.     BYTE fsState;
  1303.     BYTE fsStyle;
  1304.     WORD cx;
  1305.     DWORD lParam;
  1306.     LPWSTR pszText;
  1307.     int cchText;
  1308. } TBBUTTONINFOW, *LPTBBUTTONINFOW;
  1309.  
  1310. #ifdef UNICODE
  1311. #define TBBUTTONINFO TBBUTTONINFOW
  1312. #define LPTBBUTTONINFO LPTBBUTTONINFOW
  1313. #else
  1314. #define TBBUTTONINFO TBBUTTONINFOA
  1315. #define LPTBBUTTONINFO LPTBBUTTONINFOA
  1316. #endif
  1317.  
  1318.  
  1319. // BUTTONINFO APIs do NOT support the string pool.
  1320. #define TB_GETBUTTONINFOW        (WM_USER + 63)
  1321. #define TB_SETBUTTONINFOW        (WM_USER + 64)
  1322. #define TB_GETBUTTONINFOA        (WM_USER + 65)
  1323. #define TB_SETBUTTONINFOA        (WM_USER + 66)
  1324. #ifdef UNICODE
  1325. #define TB_GETBUTTONINFO        TB_GETBUTTONINFOW
  1326. #define TB_SETBUTTONINFO        TB_SETBUTTONINFOW
  1327. #else
  1328. #define TB_GETBUTTONINFO        TB_GETBUTTONINFOA
  1329. #define TB_SETBUTTONINFO        TB_SETBUTTONINFOA
  1330. #endif
  1331.  
  1332.  
  1333. #define TB_INSERTBUTTONW        (WM_USER + 67)
  1334. #define TB_ADDBUTTONSW          (WM_USER + 68)
  1335.  
  1336. #define TB_HITTEST              (WM_USER + 69)
  1337.  
  1338. // New post Win95/NT4 for InsertButton and AddButton.  if iString member
  1339. // is a pointer to a string, it will be handled as a string like listview
  1340. // (although LPSTR_TEXTCALLBACK is not supported).
  1341. #ifdef UNICODE
  1342. #define TB_INSERTBUTTON         TB_INSERTBUTTONW
  1343. #define TB_ADDBUTTONS           TB_ADDBUTTONSW
  1344. #else
  1345. #define TB_INSERTBUTTON         TB_INSERTBUTTONA
  1346. #define TB_ADDBUTTONS           TB_ADDBUTTONSA
  1347. #endif
  1348.  
  1349. #define TB_SETDRAWTEXTFLAGS     (WM_USER + 70)  // wParam == mask lParam == bit values
  1350.  
  1351. #endif         // _WIN32_IE >= 0x0400
  1352.  
  1353. #define TBN_GETBUTTONINFOA      (TBN_FIRST-0)
  1354. #define TBN_GETBUTTONINFOW      (TBN_FIRST-20)
  1355. #define TBN_BEGINDRAG           (TBN_FIRST-1)
  1356. #define TBN_ENDDRAG             (TBN_FIRST-2)
  1357. #define TBN_BEGINADJUST         (TBN_FIRST-3)
  1358. #define TBN_ENDADJUST           (TBN_FIRST-4)
  1359. #define TBN_RESET               (TBN_FIRST-5)
  1360. #define TBN_QUERYINSERT         (TBN_FIRST-6)
  1361. #define TBN_QUERYDELETE         (TBN_FIRST-7)
  1362. #define TBN_TOOLBARCHANGE       (TBN_FIRST-8)
  1363. #define TBN_CUSTHELP            (TBN_FIRST-9)
  1364. #if (_WIN32_IE >= 0x0300)
  1365. #define TBN_DROPDOWN            (TBN_FIRST - 10)
  1366. #endif
  1367. #if (_WIN32_IE >= 0x0400)
  1368. #define TBN_GETOBJECT           (TBN_FIRST - 12)
  1369.  
  1370. // Structure for TBN_HOTITEMCHANGE notification
  1371. //
  1372. typedef struct tagNMTBHOTITEM
  1373. {
  1374.     NMHDR   hdr;
  1375.     int     idOld;
  1376.     int     idNew;
  1377.     DWORD   dwFlags;           // HICF_*
  1378. } NMTBHOTITEM, * LPNMTBHOTITEM;
  1379.  
  1380. // Hot item change flags
  1381. #define HICF_OTHER          0x00000000
  1382. #define HICF_MOUSE          0x00000001          // Triggered by mouse
  1383. #define HICF_ARROWKEYS      0x00000002          // Triggered by arrow keys
  1384. #define HICF_ACCELERATOR    0x00000004          // Triggered by accelerator
  1385. #define HICF_DUPACCEL       0x00000008          // This accelerator is not unique
  1386. #define HICF_ENTERING       0x00000010          // idOld is invalid
  1387. #define HICF_LEAVING        0x00000020          // idNew is invalid
  1388. #define HICF_RESELECT       0x00000040          // hot item reselected
  1389.  
  1390.  
  1391. #define TBN_HOTITEMCHANGE       (TBN_FIRST - 13)
  1392. #define TBN_DRAGOUT             (TBN_FIRST - 14) // this is sent when the user clicks down on a button then drags off the button
  1393. #define TBN_DELETINGBUTTON      (TBN_FIRST - 15) // uses TBNOTIFY
  1394. #define TBN_GETDISPINFOA        (TBN_FIRST - 16) // This is sent when the  toolbar needs  some display information
  1395. #define TBN_GETDISPINFOW        (TBN_FIRST - 17) // This is sent when the  toolbar needs  some display information
  1396. #define TBN_GETINFOTIPA         (TBN_FIRST - 18)
  1397. #define TBN_GETINFOTIPW         (TBN_FIRST - 19)
  1398.  
  1399.  
  1400. typedef struct tagNMTBGETINFOTIPA
  1401. {
  1402.     NMHDR hdr;
  1403.     LPSTR pszText;
  1404.     int cchTextMax;
  1405.     int iItem;
  1406.     LPARAM lParam;
  1407. } NMTBGETINFOTIPA, *LPNMTBGETINFOTIPA;
  1408.  
  1409. typedef struct tagNMTBGETINFOTIPW
  1410. {
  1411.     NMHDR hdr;
  1412.     LPWSTR pszText;
  1413.     int cchTextMax;
  1414.     int iItem;
  1415.     LPARAM lParam;
  1416. } NMTBGETINFOTIPW, *LPNMTBGETINFOTIPW;
  1417.  
  1418. #ifdef UNICODE
  1419. #define TBN_GETINFOTIP          TBN_GETINFOTIPW
  1420. #define NMTBGETINFOTIP          NMTBGETINFOTIPW
  1421. #define LPNMTBGETINFOTIP        LPNMTBGETINFOTIPW
  1422. #else
  1423. #define TBN_GETINFOTIP          TBN_GETINFOTIPA
  1424. #define NMTBGETINFOTIP          NMTBGETINFOTIPA
  1425. #define LPNMTBGETINFOTIP        LPNMTBGETINFOTIPA
  1426. #endif
  1427.  
  1428. #define TBNF_IMAGE              0x00000001
  1429. #define TBNF_TEXT               0x00000002
  1430. #define TBNF_DI_SETITEM         0x10000000
  1431.  
  1432. typedef struct {
  1433.     NMHDR  hdr;
  1434.     DWORD dwMask;     // [in] Specifies the values requested .[out] Client ask the data to be set for future use
  1435.     int idCommand;    // [in] id of button we're requesting info for
  1436.     DWORD lParam;     // [in] lParam of button
  1437.     int iImage;       // [out] image index
  1438.     LPSTR pszText;    // [out] new text for item
  1439.     int cchText;      // [in] size of buffer pointed to by pszText
  1440. } NMTBDISPINFOA, *LPNMTBDISPINFOA;
  1441.  
  1442. typedef struct {
  1443.     NMHDR hdr;
  1444.     DWORD dwMask;      //[in] Specifies the values requested .[out] Client ask the data to be set for future use
  1445.     int idCommand;    // [in] id of button we're requesting info for
  1446.     DWORD lParam;     // [in] lParam of button
  1447.     int iImage;       // [out] image index
  1448.     LPWSTR pszText;   // [out] new text for item
  1449.     int cchText;      // [in] size of buffer pointed to by pszText
  1450. } NMTBDISPINFOW, *LPNMTBDISPINFOW;
  1451.  
  1452.  
  1453. #ifdef UNICODE
  1454. #define TBN_GETDISPINFO       TBN_GETDISPINFOW
  1455. #define NMTBDISPINFO          NMTBDISPINFOW
  1456. #define LPNMTBDISPINFO        LPNMTBDISPINFOW
  1457. #else
  1458. #define TBN_GETDISPINFO       TBN_GETDISPINFOA
  1459. #define NMTBDISPINFO          NMTBDISPINFOA
  1460. #define LPNMTBDISPINFO        LPNMTBDISPINFOA
  1461. #endif
  1462.  
  1463. // Return codes for TBN_DROPDOWN
  1464. #define TBDDRET_DEFAULT         0
  1465. #define TBDDRET_NODEFAULT       1
  1466. #define TBDDRET_TREATPRESSED    2       // Treat as a standard press button
  1467.  
  1468. #endif
  1469.  
  1470.  
  1471. #ifdef UNICODE
  1472. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOW
  1473. #else
  1474. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOA
  1475. #endif
  1476.  
  1477. #if (_WIN32_IE >= 0x0300)
  1478. #define TBNOTIFYA NMTOOLBARA
  1479. #define TBNOTIFYW NMTOOLBARW
  1480. #define LPTBNOTIFYA LPNMTOOLBARA
  1481. #define LPTBNOTIFYW LPNMTOOLBARW
  1482. #else
  1483. #define tagNMTOOLBARA  tagTBNOTIFYA
  1484. #define NMTOOLBARA     TBNOTIFYA
  1485. #define LPNMTOOLBARA   LPTBNOTIFYA
  1486. #define tagNMTOOLBARW  tagTBNOTIFYW
  1487. #define NMTOOLBARW     TBNOTIFYW
  1488. #define LPNMTOOLBARW   LPTBNOTIFYW
  1489. #endif
  1490.  
  1491. #define TBNOTIFY       NMTOOLBAR
  1492. #define LPTBNOTIFY     LPNMTOOLBAR
  1493.  
  1494. #if (_WIN32_IE >= 0x0300)
  1495. typedef struct tagNMTOOLBARA {
  1496.     NMHDR   hdr;
  1497.     int     iItem;
  1498.     TBBUTTON tbButton;
  1499.     int     cchText;
  1500.     LPSTR   pszText;
  1501. } NMTOOLBARA, FAR* LPNMTOOLBARA;
  1502. #endif
  1503.  
  1504.  
  1505. #if (_WIN32_IE >= 0x0300)
  1506. typedef struct tagNMTOOLBARW {
  1507.     NMHDR   hdr;
  1508.     int     iItem;
  1509.     TBBUTTON tbButton;
  1510.     int     cchText;
  1511.     LPWSTR   pszText;
  1512. } NMTOOLBARW, FAR* LPNMTOOLBARW;
  1513. #endif
  1514.  
  1515.  
  1516. #ifdef UNICODE
  1517. #define NMTOOLBAR               NMTOOLBARW
  1518. #define LPNMTOOLBAR             LPNMTOOLBARW
  1519. #else
  1520. #define NMTOOLBAR               NMTOOLBARA
  1521. #define LPNMTOOLBAR             LPNMTOOLBARA
  1522. #endif
  1523.  
  1524. #endif
  1525.  
  1526. #endif      // NOTOOLBAR
  1527.  
  1528.  
  1529. #if (_WIN32_IE >= 0x0300)
  1530. //====== REBAR CONTROL ========================================================
  1531.  
  1532. #ifndef NOREBAR
  1533.  
  1534. #ifdef _WIN32
  1535. #define REBARCLASSNAMEW         L"ReBarWindow32"
  1536. #define REBARCLASSNAMEA         "ReBarWindow32"
  1537.  
  1538. #ifdef  UNICODE
  1539. #define REBARCLASSNAME          REBARCLASSNAMEW
  1540. #else
  1541. #define REBARCLASSNAME          REBARCLASSNAMEA
  1542. #endif
  1543.  
  1544. #else
  1545. #define REBARCLASSNAME          "ReBarWindow"
  1546. #endif
  1547.  
  1548. #define RBIM_IMAGELIST  0x00000001
  1549.  
  1550. #if (_WIN32_IE >= 0x0400)
  1551. #define RBS_TOOLTIPS        0x0100
  1552. #define RBS_VARHEIGHT       0x0200
  1553. #define RBS_BANDBORDERS     0x0400
  1554. #define RBS_FIXEDORDER      0x0800
  1555. #define RBS_REGISTERDROP    0x1000
  1556. #define RBS_AUTOSIZE        0x2000
  1557. #define RBS_VERTICALGRIPPER 0x4000  // this always has the vertical gripper (default for horizontal mode)
  1558. #define RBS_DBLCLKTOGGLE    0x8000
  1559. #else
  1560. #define RBS_TOOLTIPS        0x00000100
  1561. #define RBS_VARHEIGHT       0x00000200
  1562. #define RBS_BANDBORDERS     0x00000400
  1563. #define RBS_FIXEDORDER      0x00000800
  1564. #endif      // _WIN32_IE >= 0x0400
  1565.  
  1566.  
  1567. typedef struct tagREBARINFO
  1568. {
  1569.     UINT        cbSize;
  1570.     UINT        fMask;
  1571. #ifndef NOIMAGEAPIS
  1572.     HIMAGELIST  himl;
  1573. #else
  1574.     HANDLE      himl;
  1575. #endif
  1576. }   REBARINFO, FAR *LPREBARINFO;
  1577.  
  1578. #define RBBS_BREAK          0x00000001  // break to new line
  1579. #define RBBS_FIXEDSIZE      0x00000002  // band can't be sized
  1580. #define RBBS_CHILDEDGE      0x00000004  // edge around top & bottom of child window
  1581. #define RBBS_HIDDEN         0x00000008  // don't show
  1582. #define RBBS_NOVERT         0x00000010  // don't show when vertical
  1583. #define RBBS_FIXEDBMP       0x00000020  // bitmap doesn't move during band resize
  1584. #if (_WIN32_IE >= 0x0400)
  1585. #define RBBS_VARIABLEHEIGHT 0x00000040  // allow autosizing of this child vertically
  1586. #define RBBS_GRIPPERALWAYS  0x00000080  // always show the gripper
  1587. #define RBBS_NOGRIPPER      0x00000100  // never show the gripper
  1588. #endif
  1589.  
  1590. #define RBBIM_STYLE         0x00000001
  1591. #define RBBIM_COLORS        0x00000002
  1592. #define RBBIM_TEXT          0x00000004
  1593. #define RBBIM_IMAGE         0x00000008
  1594. #define RBBIM_CHILD         0x00000010
  1595. #define RBBIM_CHILDSIZE     0x00000020
  1596. #define RBBIM_SIZE          0x00000040
  1597. #define RBBIM_BACKGROUND    0x00000080
  1598. #define RBBIM_ID            0x00000100
  1599. #if (_WIN32_IE >= 0x0400)
  1600. #define RBBIM_IDEALSIZE     0x00000200
  1601. #define RBBIM_LPARAM        0x00000400
  1602. #define RBBIM_HEADERSIZE    0x00000800  // control the size of the header
  1603. #endif
  1604.  
  1605. typedef struct tagREBARBANDINFOA
  1606. {
  1607.     UINT        cbSize;
  1608.     UINT        fMask;
  1609.     UINT        fStyle;
  1610.     COLORREF    clrFore;
  1611.     COLORREF    clrBack;
  1612.     LPSTR       lpText;
  1613.     UINT        cch;
  1614.     int         iImage;
  1615.     HWND        hwndChild;
  1616.     UINT        cxMinChild;
  1617.     UINT        cyMinChild;
  1618.     UINT        cx;
  1619.     HBITMAP     hbmBack;
  1620.     UINT        wID;
  1621. #if (_WIN32_IE >= 0x0400)
  1622.     UINT        cyChild;
  1623.     UINT        cyMaxChild;
  1624.     UINT        cyIntegral;
  1625.     UINT        cxIdeal;
  1626.     LPARAM      lParam;
  1627.     UINT        cxHeader;
  1628. #endif
  1629. }   REBARBANDINFOA, FAR *LPREBARBANDINFOA;
  1630. typedef REBARBANDINFOA CONST FAR *LPCREBARBANDINFOA;
  1631.  
  1632. #define REBARBANDINFOA_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, wID)
  1633. #define REBARBANDINFOW_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, wID)
  1634.  
  1635. typedef struct tagREBARBANDINFOW
  1636. {
  1637.     UINT        cbSize;
  1638.     UINT        fMask;
  1639.     UINT        fStyle;
  1640.     COLORREF    clrFore;
  1641.     COLORREF    clrBack;
  1642.     LPWSTR      lpText;
  1643.     UINT        cch;
  1644.     int         iImage;
  1645.     HWND        hwndChild;
  1646.     UINT        cxMinChild;
  1647.     UINT        cyMinChild;
  1648.     UINT        cx;
  1649.     HBITMAP     hbmBack;
  1650.     UINT        wID;
  1651. #if (_WIN32_IE >= 0x0400)
  1652.     UINT        cyChild;
  1653.     UINT        cyMaxChild;
  1654.     UINT        cyIntegral;
  1655.     UINT        cxIdeal;
  1656.     LPARAM      lParam;
  1657.     UINT        cxHeader;
  1658. #endif
  1659. }   REBARBANDINFOW, FAR *LPREBARBANDINFOW;
  1660. typedef REBARBANDINFOW CONST FAR *LPCREBARBANDINFOW;
  1661.  
  1662. #ifdef UNICODE
  1663. #define REBARBANDINFO       REBARBANDINFOW
  1664. #define LPREBARBANDINFO     LPREBARBANDINFOW
  1665. #define LPCREBARBANDINFO    LPCREBARBANDINFOW
  1666. #define REBARBANDINFO_V3_SIZE REBARBANDINFOW_V3_SIZE
  1667. #else
  1668. #define REBARBANDINFO       REBARBANDINFOA
  1669. #define LPREBARBANDINFO     LPREBARBANDINFOA
  1670. #define LPCREBARBANDINFO    LPCREBARBANDINFOA
  1671. #define REBARBANDINFO_V3_SIZE REBARBANDINFOA_V3_SIZE
  1672. #endif
  1673.  
  1674. #define RB_INSERTBANDA  (WM_USER +  1)
  1675. #define RB_DELETEBAND   (WM_USER +  2)
  1676. #define RB_GETBARINFO   (WM_USER +  3)
  1677. #define RB_SETBARINFO   (WM_USER +  4)
  1678. #if (_WIN32_IE < 0x0400)
  1679. #define RB_GETBANDINFO  (WM_USER +  5)
  1680. #endif
  1681. #define RB_SETBANDINFOA (WM_USER +  6)
  1682. #define RB_SETPARENT    (WM_USER +  7)
  1683. #if (_WIN32_IE >= 0x0400)
  1684. #define RB_HITTEST      (WM_USER +  8)
  1685. #define RB_GETRECT      (WM_USER +  9)
  1686. #endif
  1687. #define RB_INSERTBANDW  (WM_USER +  10)
  1688. #define RB_SETBANDINFOW (WM_USER +  11)
  1689. #define RB_GETBANDCOUNT (WM_USER +  12)
  1690. #define RB_GETROWCOUNT  (WM_USER +  13)
  1691. #define RB_GETROWHEIGHT (WM_USER +  14)
  1692. #if (_WIN32_IE >= 0x0400)
  1693. #define RB_IDTOINDEX    (WM_USER +  16) // wParam == id
  1694. #define RB_GETTOOLTIPS  (WM_USER +  17)
  1695. #define RB_SETTOOLTIPS  (WM_USER +  18)
  1696. #define RB_SETBKCOLOR   (WM_USER +  19) // sets the default BK color
  1697. #define RB_GETBKCOLOR   (WM_USER +  20) // defaults to CLR_NONE
  1698. #define RB_SETTEXTCOLOR (WM_USER +  21)
  1699. #define RB_GETTEXTCOLOR (WM_USER +  22) // defaults to 0x00000000
  1700. #define RB_SIZETORECT   (WM_USER +  23) // resize the rebar/break bands and such to this rect (lparam)
  1701. #endif      // _WIN32_IE >= 0x0400
  1702.  
  1703. #define RB_SETCOLORSCHEME   CCM_SETCOLORSCHEME  // lParam is color scheme
  1704. #define RB_GETCOLORSCHEME   CCM_GETCOLORSCHEME  // fills in COLORSCHEME pointed to by lParam
  1705.  
  1706. #ifdef UNICODE
  1707. #define RB_INSERTBAND   RB_INSERTBANDW
  1708. #define RB_SETBANDINFO   RB_SETBANDINFOW
  1709. #else
  1710. #define RB_INSERTBAND   RB_INSERTBANDA
  1711. #define RB_SETBANDINFO   RB_SETBANDINFOA
  1712. #endif
  1713.  
  1714. #if (_WIN32_IE >= 0x0400)
  1715. // for manual drag control
  1716. // lparam == cursor pos
  1717.         // -1 means do it yourself.
  1718.         // -2 means use what you had saved before
  1719. #define RB_BEGINDRAG    (WM_USER + 24)
  1720. #define RB_ENDDRAG      (WM_USER + 25)
  1721. #define RB_DRAGMOVE     (WM_USER + 26)
  1722. #define RB_GETBARHEIGHT (WM_USER + 27)
  1723. #define RB_GETBANDINFOW (WM_USER + 28)
  1724. #define RB_GETBANDINFOA (WM_USER + 29)
  1725.  
  1726. #ifdef UNICODE
  1727. #define RB_GETBANDINFO   RB_GETBANDINFOW
  1728. #else
  1729. #define RB_GETBANDINFO   RB_GETBANDINFOA
  1730. #endif
  1731.  
  1732. #define RB_MINIMIZEBAND (WM_USER + 30)
  1733. #define RB_MAXIMIZEBAND (WM_USER + 31)
  1734.  
  1735. #define RB_GETDROPTARGET (CCM_GETDROPTARGET)
  1736.  
  1737. #define RB_GETBANDBORDERS (WM_USER + 34)  // returns in lparam = lprc the amount of edges added to band wparam
  1738.  
  1739. #define RB_SHOWBAND     (WM_USER + 35)      // show/hide band
  1740. #define RB_SETPALETTE   (WM_USER + 37)
  1741. #define RB_GETPALETTE   (WM_USER + 38)
  1742. #define RB_MOVEBAND     (WM_USER + 39)
  1743.  
  1744. #define RB_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  1745. #define RB_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  1746.  
  1747. #endif      // _WIN32_IE >= 0x0400
  1748.  
  1749. #define RBN_HEIGHTCHANGE    (RBN_FIRST - 0)
  1750.  
  1751. #if (_WIN32_IE >= 0x0400)
  1752. #define RBN_GETOBJECT       (RBN_FIRST - 1)
  1753. #define RBN_LAYOUTCHANGED   (RBN_FIRST - 2)
  1754. #define RBN_AUTOSIZE        (RBN_FIRST - 3)
  1755. #define RBN_BEGINDRAG       (RBN_FIRST - 4)
  1756. #define RBN_ENDDRAG         (RBN_FIRST - 5)
  1757. #define RBN_DELETINGBAND    (RBN_FIRST - 6)     // Uses NMREBAR
  1758. #define RBN_DELETEDBAND     (RBN_FIRST - 7)     // Uses NMREBAR
  1759. #define RBN_CHILDSIZE       (RBN_FIRST - 8)
  1760.  
  1761.  
  1762. typedef struct tagNMREBARCHILDSIZE
  1763. {
  1764.     NMHDR hdr;
  1765.     UINT uBand;
  1766.     UINT wID;
  1767.     RECT rcChild;
  1768.     RECT rcBand;
  1769. } NMREBARCHILDSIZE, *LPNMREBARCHILDSIZE;
  1770.  
  1771. typedef struct tagNMREBAR
  1772. {
  1773.     NMHDR   hdr;
  1774.     DWORD   dwMask;           // RBNM_*
  1775.     UINT    uBand;
  1776.     UINT    fStyle;
  1777.     UINT    wID;
  1778.     LPARAM  lParam;
  1779. } NMREBAR, *LPNMREBAR;
  1780.  
  1781. // Mask flags for NMREBAR
  1782. #define RBNM_ID         0x00000001
  1783. #define RBNM_STYLE      0x00000002
  1784. #define RBNM_LPARAM     0x00000004
  1785.  
  1786.  
  1787. typedef struct tagNMRBAUTOSIZE
  1788. {
  1789.     NMHDR hdr;
  1790.     BOOL fChanged;
  1791.     RECT rcTarget;
  1792.     RECT rcActual;
  1793. } NMRBAUTOSIZE, *LPNMRBAUTOSIZE;
  1794.  
  1795. #define RBHT_NOWHERE    0x0001
  1796. #define RBHT_CAPTION    0x0002
  1797. #define RBHT_CLIENT     0x0003
  1798. #define RBHT_GRABBER    0x0004
  1799.  
  1800. typedef struct _RB_HITTESTINFO
  1801. {
  1802.     POINT pt;
  1803.     UINT flags;
  1804.     int iBand;
  1805. } RBHITTESTINFO, FAR *LPRBHITTESTINFO;
  1806.  
  1807. #endif      // _WIN32_IE >= 0x0400
  1808.  
  1809. #endif      // NOREBAR
  1810.  
  1811. #endif      // _WIN32_IE >= 0x0300
  1812.  
  1813. //====== TOOLTIPS CONTROL =====================================================
  1814.  
  1815. #ifndef NOTOOLTIPS
  1816.  
  1817. #ifdef _WIN32
  1818.  
  1819. #define TOOLTIPS_CLASSW         L"tooltips_class32"
  1820. #define TOOLTIPS_CLASSA         "tooltips_class32"
  1821.  
  1822. #ifdef UNICODE
  1823. #define TOOLTIPS_CLASS          TOOLTIPS_CLASSW
  1824. #else
  1825. #define TOOLTIPS_CLASS          TOOLTIPS_CLASSA
  1826. #endif
  1827.  
  1828. #else
  1829. #define TOOLTIPS_CLASS          "tooltips_class"
  1830. #endif
  1831.  
  1832. #if (_WIN32_IE >= 0x0300)
  1833. #define LPTOOLINFOA   LPTTTOOLINFOA
  1834. #define LPTOOLINFOW   LPTTTOOLINFOW
  1835. #define TOOLINFOA       TTTOOLINFOA
  1836. #define TOOLINFOW       TTTOOLINFOW
  1837. #else
  1838. #define   TTTOOLINFOA   TOOLINFOA
  1839. #define LPTTTOOLINFOA LPTOOLINFOA
  1840. #define   TTTOOLINFOW   TOOLINFOW
  1841. #define LPTTTOOLINFOW LPTOOLINFOW
  1842. #endif
  1843.  
  1844. #define LPTOOLINFO    LPTTTOOLINFO
  1845. #define TOOLINFO        TTTOOLINFO
  1846.  
  1847. #define TTTOOLINFOA_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpszText)
  1848. #define TTTOOLINFOW_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpszText)
  1849.  
  1850. typedef struct tagTOOLINFOA {
  1851.     UINT cbSize;
  1852.     UINT uFlags;
  1853.     HWND hwnd;
  1854.     UINT uId;
  1855.     RECT rect;
  1856.     HINSTANCE hinst;
  1857.     LPSTR lpszText;
  1858. #if (_WIN32_IE >= 0x0300)
  1859.     LPARAM lParam;
  1860. #endif
  1861. } TTTOOLINFOA, NEAR *PTOOLINFOA, FAR *LPTTTOOLINFOA;
  1862.  
  1863. typedef struct tagTOOLINFOW {
  1864.     UINT cbSize;
  1865.     UINT uFlags;
  1866.     HWND hwnd;
  1867.     UINT uId;
  1868.     RECT rect;
  1869.     HINSTANCE hinst;
  1870.     LPWSTR lpszText;
  1871. #if (_WIN32_IE >= 0x0300)
  1872.     LPARAM lParam;
  1873. #endif
  1874. } TTTOOLINFOW, NEAR *PTOOLINFOW, FAR* LPTTTOOLINFOW;
  1875.  
  1876. #ifdef UNICODE
  1877. #define TTTOOLINFO              TTTOOLINFOW
  1878. #define PTOOLINFO               PTOOLINFOW
  1879. #define LPTTTOOLINFO            LPTTTOOLINFOW
  1880. #define TTTOOLINFO_V1_SIZE TTTOOLINFOW_V1_SIZE
  1881. #else
  1882. #define PTOOLINFO               PTOOLINFOA
  1883. #define TTTOOLINFO              TTTOOLINFOA
  1884. #define LPTTTOOLINFO            LPTTTOOLINFOA
  1885. #define TTTOOLINFO_V1_SIZE TTTOOLINFOA_V1_SIZE
  1886. #endif
  1887.  
  1888. // begin_r_commctrl
  1889.  
  1890. #define TTS_ALWAYSTIP           0x01
  1891. #define TTS_NOPREFIX            0x02
  1892.  
  1893. // end_r_commctrl
  1894.  
  1895. #define TTF_IDISHWND            0x0001
  1896.  
  1897. // Use this to center around trackpoint in trackmode
  1898. // -OR- to center around tool in normal mode.
  1899. // Use TTF_ABSOLUTE to place the tip exactly at the track coords when
  1900. // in tracking mode.  TTF_ABSOLUTE can be used in conjunction with TTF_CENTERTIP
  1901. // to center the tip absolutely about the track point.
  1902.  
  1903. #define TTF_CENTERTIP           0x0002
  1904. #define TTF_RTLREADING          0x0004
  1905. #define TTF_SUBCLASS            0x0010
  1906. #if (_WIN32_IE >= 0x0300)
  1907. #define TTF_TRACK               0x0020
  1908. #define TTF_ABSOLUTE            0x0080
  1909. #define TTF_TRANSPARENT         0x0100
  1910. #define TTF_DI_SETITEM          0x8000       // valid only on the TTN_NEEDTEXT callback
  1911. #endif      // _WIN32_IE >= 0x0300
  1912.  
  1913. #define TTDT_AUTOMATIC          0
  1914. #define TTDT_RESHOW             1
  1915. #define TTDT_AUTOPOP            2
  1916. #define TTDT_INITIAL            3
  1917.  
  1918. #define TTM_ACTIVATE            (WM_USER + 1)
  1919. #define TTM_SETDELAYTIME        (WM_USER + 3)
  1920. #define TTM_ADDTOOLA            (WM_USER + 4)
  1921. #define TTM_ADDTOOLW            (WM_USER + 50)
  1922. #define TTM_DELTOOLA            (WM_USER + 5)
  1923. #define TTM_DELTOOLW            (WM_USER + 51)
  1924. #define TTM_NEWTOOLRECTA        (WM_USER + 6)
  1925. #define TTM_NEWTOOLRECTW        (WM_USER + 52)
  1926. #define TTM_RELAYEVENT          (WM_USER + 7)
  1927.  
  1928. #define TTM_GETTOOLINFOA        (WM_USER + 8)
  1929. #define TTM_GETTOOLINFOW        (WM_USER + 53)
  1930.  
  1931. #define TTM_SETTOOLINFOA        (WM_USER + 9)
  1932. #define TTM_SETTOOLINFOW        (WM_USER + 54)
  1933.  
  1934. #define TTM_HITTESTA            (WM_USER +10)
  1935. #define TTM_HITTESTW            (WM_USER +55)
  1936. #define TTM_GETTEXTA            (WM_USER +11)
  1937. #define TTM_GETTEXTW            (WM_USER +56)
  1938. #define TTM_UPDATETIPTEXTA      (WM_USER +12)
  1939. #define TTM_UPDATETIPTEXTW      (WM_USER +57)
  1940. #define TTM_GETTOOLCOUNT        (WM_USER +13)
  1941. #define TTM_ENUMTOOLSA          (WM_USER +14)
  1942. #define TTM_ENUMTOOLSW          (WM_USER +58)
  1943. #define TTM_GETCURRENTTOOLA     (WM_USER + 15)
  1944. #define TTM_GETCURRENTTOOLW     (WM_USER + 59)
  1945. #define TTM_WINDOWFROMPOINT     (WM_USER + 16)
  1946. #if (_WIN32_IE >= 0x0300)
  1947. #define TTM_TRACKACTIVATE       (WM_USER + 17)  // wParam = TRUE/FALSE start end  lparam = LPTOOLINFO
  1948. #define TTM_TRACKPOSITION       (WM_USER + 18)  // lParam = dwPos
  1949. #define TTM_SETTIPBKCOLOR       (WM_USER + 19)
  1950. #define TTM_SETTIPTEXTCOLOR     (WM_USER + 20)
  1951. #define TTM_GETDELAYTIME        (WM_USER + 21)
  1952. #define TTM_GETTIPBKCOLOR       (WM_USER + 22)
  1953. #define TTM_GETTIPTEXTCOLOR     (WM_USER + 23)
  1954. #define TTM_SETMAXTIPWIDTH      (WM_USER + 24)
  1955. #define TTM_GETMAXTIPWIDTH      (WM_USER + 25)
  1956. #define TTM_SETMARGIN           (WM_USER + 26)  // lParam = lprc
  1957. #define TTM_GETMARGIN           (WM_USER + 27)  // lParam = lprc
  1958. #define TTM_POP                 (WM_USER + 28)
  1959. #endif
  1960. #if (_WIN32_IE >= 0x0400)
  1961. #define TTM_UPDATE              (WM_USER + 29)
  1962. #endif
  1963.  
  1964.  
  1965. #ifdef UNICODE
  1966. #define TTM_ADDTOOL             TTM_ADDTOOLW
  1967. #define TTM_DELTOOL             TTM_DELTOOLW
  1968. #define TTM_NEWTOOLRECT         TTM_NEWTOOLRECTW
  1969. #define TTM_GETTOOLINFO         TTM_GETTOOLINFOW
  1970. #define TTM_SETTOOLINFO         TTM_SETTOOLINFOW
  1971. #define TTM_HITTEST             TTM_HITTESTW
  1972. #define TTM_GETTEXT             TTM_GETTEXTW
  1973. #define TTM_UPDATETIPTEXT       TTM_UPDATETIPTEXTW
  1974. #define TTM_ENUMTOOLS           TTM_ENUMTOOLSW
  1975. #define TTM_GETCURRENTTOOL      TTM_GETCURRENTTOOLW
  1976. #else
  1977. #define TTM_ADDTOOL             TTM_ADDTOOLA
  1978. #define TTM_DELTOOL             TTM_DELTOOLA
  1979. #define TTM_NEWTOOLRECT         TTM_NEWTOOLRECTA
  1980. #define TTM_GETTOOLINFO         TTM_GETTOOLINFOA
  1981. #define TTM_SETTOOLINFO         TTM_SETTOOLINFOA
  1982. #define TTM_HITTEST             TTM_HITTESTA
  1983. #define TTM_GETTEXT             TTM_GETTEXTA
  1984. #define TTM_UPDATETIPTEXT       TTM_UPDATETIPTEXTA
  1985. #define TTM_ENUMTOOLS           TTM_ENUMTOOLSA
  1986. #define TTM_GETCURRENTTOOL      TTM_GETCURRENTTOOLA
  1987. #endif
  1988.  
  1989.  
  1990. #if (_WIN32_IE >= 0x0300)
  1991. #define LPHITTESTINFOW    LPTTHITTESTINFOW
  1992. #define LPHITTESTINFOA    LPTTHITTESTINFOA
  1993. #else
  1994. #define LPTTHITTESTINFOA  LPHITTESTINFOA
  1995. #define LPTTHITTESTINFOW  LPHITTESTINFOW
  1996. #endif
  1997.  
  1998. #define LPHITTESTINFO     LPTTHITTESTINFO
  1999.  
  2000. typedef struct _TT_HITTESTINFOA {
  2001.     HWND hwnd;
  2002.     POINT pt;
  2003.     TTTOOLINFOA ti;
  2004. } TTHITTESTINFOA, FAR * LPTTHITTESTINFOA;
  2005.  
  2006. typedef struct _TT_HITTESTINFOW {
  2007.     HWND hwnd;
  2008.     POINT pt;
  2009.     TTTOOLINFOW ti;
  2010. } TTHITTESTINFOW, FAR * LPTTHITTESTINFOW;
  2011.  
  2012. #ifdef UNICODE
  2013. #define TTHITTESTINFO           TTHITTESTINFOW
  2014. #define LPTTHITTESTINFO         LPTTHITTESTINFOW
  2015. #else
  2016. #define TTHITTESTINFO           TTHITTESTINFOA
  2017. #define LPTTHITTESTINFO         LPTTHITTESTINFOA
  2018. #endif
  2019.  
  2020. #define TTN_GETDISPINFOA        (TTN_FIRST - 0)
  2021. #define TTN_GETDISPINFOW        (TTN_FIRST - 10)
  2022. #define TTN_SHOW                (TTN_FIRST - 1)
  2023. #define TTN_POP                 (TTN_FIRST - 2)
  2024.  
  2025. #ifdef UNICODE
  2026. #define TTN_GETDISPINFO         TTN_GETDISPINFOW
  2027. #else
  2028. #define TTN_GETDISPINFO         TTN_GETDISPINFOA
  2029. #endif
  2030.  
  2031. #define TTN_NEEDTEXT            TTN_GETDISPINFO
  2032. #define TTN_NEEDTEXTA           TTN_GETDISPINFOA
  2033. #define TTN_NEEDTEXTW           TTN_GETDISPINFOW
  2034.  
  2035. #if (_WIN32_IE >= 0x0300)
  2036. #define TOOLTIPTEXTW NMTTDISPINFOW
  2037. #define TOOLTIPTEXTA NMTTDISPINFOA
  2038. #define LPTOOLTIPTEXTA LPNMTTDISPINFOA
  2039. #define LPTOOLTIPTEXTW LPNMTTDISPINFOW
  2040. #else
  2041. #define tagNMTTDISPINFOA  tagTOOLTIPTEXTA
  2042. #define NMTTDISPINFOA     TOOLTIPTEXTA
  2043. #define LPNMTTDISPINFOA   LPTOOLTIPTEXTA
  2044. #define tagNMTTDISPINFOW  tagTOOLTIPTEXTW
  2045. #define NMTTDISPINFOW     TOOLTIPTEXTW
  2046. #define LPNMTTDISPINFOW   LPTOOLTIPTEXTW
  2047. #endif
  2048.  
  2049. #define TOOLTIPTEXT    NMTTDISPINFO
  2050. #define LPTOOLTIPTEXT  LPNMTTDISPINFO
  2051.  
  2052. #define NMTTDISPINFOA_V1_SIZE CCSIZEOF_STRUCT(NMTTDISPINFOA, uFlags)
  2053. #define NMTTDISPINFOW_V1_SIZE CCSIZEOF_STRUCT(NMTTDISPINFOW, uFlags)
  2054.  
  2055. typedef struct tagNMTTDISPIFNOA {
  2056.     NMHDR hdr;
  2057.     LPSTR lpszText;
  2058.     char szText[80];
  2059.     HINSTANCE hinst;
  2060.     UINT uFlags;
  2061. #if (_WIN32_IE >= 0x0300)
  2062.     LPARAM lParam;
  2063. #endif
  2064. } NMTTDISPINFOA, FAR *LPNMTTDISPINFOA;
  2065.  
  2066. typedef struct tagNMTTDISPINFOW {
  2067.     NMHDR hdr;
  2068.     LPWSTR lpszText;
  2069.     WCHAR szText[80];
  2070.     HINSTANCE hinst;
  2071.     UINT uFlags;
  2072. #if (_WIN32_IE >= 0x0300)
  2073.     LPARAM lParam;
  2074. #endif
  2075. } NMTTDISPINFOW, FAR *LPNMTTDISPINFOW;
  2076.  
  2077. #ifdef UNICODE
  2078. #define NMTTDISPINFO            NMTTDISPINFOW
  2079. #define LPNMTTDISPINFO          LPNMTTDISPINFOW
  2080. #define NMTTDISPINFO_V1_SIZE NMTTDISPINFOW_V1_SIZE
  2081. #else
  2082. #define NMTTDISPINFO            NMTTDISPINFOA
  2083. #define LPNMTTDISPINFO          LPNMTTDISPINFOA
  2084. #define NMTTDISPINFO_V1_SIZE NMTTDISPINFOA_V1_SIZE
  2085. #endif
  2086.  
  2087. #endif      // NOTOOLTIPS
  2088.  
  2089.  
  2090. //====== STATUS BAR CONTROL ===================================================
  2091.  
  2092. #ifndef NOSTATUSBAR
  2093.  
  2094. // begin_r_commctrl
  2095.  
  2096. #define SBARS_SIZEGRIP          0x0100
  2097.  
  2098. // end_r_commctrl
  2099.  
  2100. WINCOMMCTRLAPI void WINAPI DrawStatusTextA(HDC hDC, LPRECT lprc, LPCSTR pszText, UINT uFlags);
  2101. WINCOMMCTRLAPI void WINAPI DrawStatusTextW(HDC hDC, LPRECT lprc, LPCWSTR pszText, UINT uFlags);
  2102.  
  2103. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowA(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
  2104. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR lpszText, HWND hwndParent, UINT wID);
  2105.  
  2106. #ifdef UNICODE
  2107. #define CreateStatusWindow      CreateStatusWindowW
  2108. #define DrawStatusText          DrawStatusTextW
  2109. #else
  2110. #define CreateStatusWindow      CreateStatusWindowA
  2111. #define DrawStatusText          DrawStatusTextA
  2112. #endif
  2113.  
  2114. #ifdef _WIN32
  2115. #define STATUSCLASSNAMEW        L"msctls_statusbar32"
  2116. #define STATUSCLASSNAMEA        "msctls_statusbar32"
  2117.  
  2118. #ifdef UNICODE
  2119. #define STATUSCLASSNAME         STATUSCLASSNAMEW
  2120. #else
  2121. #define STATUSCLASSNAME         STATUSCLASSNAMEA
  2122. #endif
  2123.  
  2124. #else
  2125. #define STATUSCLASSNAME         "msctls_statusbar"
  2126. #endif
  2127.  
  2128. #define SB_SETTEXTA             (WM_USER+1)
  2129. #define SB_SETTEXTW             (WM_USER+11)
  2130. #define SB_GETTEXTA             (WM_USER+2)
  2131. #define SB_GETTEXTW             (WM_USER+13)
  2132. #define SB_GETTEXTLENGTHA       (WM_USER+3)
  2133. #define SB_GETTEXTLENGTHW       (WM_USER+12)
  2134.  
  2135. #ifdef UNICODE
  2136. #define SB_GETTEXT              SB_GETTEXTW
  2137. #define SB_SETTEXT              SB_SETTEXTW
  2138. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHW
  2139. #if (_WIN32_IE >= 0x0400)
  2140. #define SB_SETTIPTEXT           SB_SETTIPTEXTW
  2141. #define SB_GETTIPTEXT           SB_GETTIPTEXTW
  2142. #endif
  2143. #else
  2144. #define SB_GETTEXT              SB_GETTEXTA
  2145. #define SB_SETTEXT              SB_SETTEXTA
  2146. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHA
  2147. #if (_WIN32_IE >= 0x0400)
  2148. #define SB_SETTIPTEXT           SB_SETTIPTEXTA
  2149. #define SB_GETTIPTEXT           SB_GETTIPTEXTA
  2150. #endif
  2151. #endif
  2152.  
  2153.  
  2154. #define SB_SETPARTS             (WM_USER+4)
  2155. #define SB_GETPARTS             (WM_USER+6)
  2156. #define SB_GETBORDERS           (WM_USER+7)
  2157. #define SB_SETMINHEIGHT         (WM_USER+8)
  2158. #define SB_SIMPLE               (WM_USER+9)
  2159. #define SB_GETRECT              (WM_USER+10)
  2160. #if (_WIN32_IE >= 0x0300)
  2161. #define SB_ISSIMPLE             (WM_USER+14)
  2162. #endif
  2163. #if (_WIN32_IE >= 0x0400)
  2164. #define SB_SETICON              (WM_USER+15)
  2165. #define SB_SETTIPTEXTA          (WM_USER+16)
  2166. #define SB_SETTIPTEXTW          (WM_USER+17)
  2167. #define SB_GETTIPTEXTA          (WM_USER+18)
  2168. #define SB_GETTIPTEXTW          (WM_USER+19)
  2169. #define SB_GETICON              (WM_USER+20)
  2170. #define SB_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  2171. #define SB_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  2172. #endif
  2173.  
  2174. #define SBT_OWNERDRAW            0x1000
  2175. #define SBT_NOBORDERS            0x0100
  2176. #define SBT_POPOUT               0x0200
  2177. #define SBT_RTLREADING           0x0400
  2178. #if (_WIN32_IE >= 0x0400)
  2179. #define SBT_TOOLTIPS             0x0800
  2180. #endif
  2181.  
  2182. #define SB_SETBKCOLOR           CCM_SETBKCOLOR      // lParam = bkColor
  2183.  
  2184. /// status bar notifications
  2185. #if (_WIN32_IE >= 0x0400)
  2186. #define SBN_SIMPLEMODECHANGE    (SBN_FIRST - 0)
  2187. #endif
  2188.  
  2189. #endif      // NOSTATUSBAR
  2190.  
  2191. //====== MENU HELP ============================================================
  2192.  
  2193. #ifndef NOMENUHELP
  2194.  
  2195. WINCOMMCTRLAPI void WINAPI MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT FAR *lpwIDs);
  2196. WINCOMMCTRLAPI BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo);
  2197. WINCOMMCTRLAPI void WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo);
  2198.  
  2199. #define MINSYSCOMMAND   SC_SIZE
  2200.  
  2201. #endif
  2202.  
  2203.  
  2204. //====== TRACKBAR CONTROL =====================================================
  2205.  
  2206. #ifndef NOTRACKBAR
  2207.  
  2208. #ifdef _WIN32
  2209.  
  2210. #define TRACKBAR_CLASSA         "msctls_trackbar32"
  2211. #define TRACKBAR_CLASSW         L"msctls_trackbar32"
  2212.  
  2213. #ifdef UNICODE
  2214. #define  TRACKBAR_CLASS         TRACKBAR_CLASSW
  2215. #else
  2216. #define  TRACKBAR_CLASS         TRACKBAR_CLASSA
  2217. #endif
  2218.  
  2219. #else
  2220. #define TRACKBAR_CLASS          "msctls_trackbar"
  2221. #endif
  2222.  
  2223.  
  2224. // begin_r_commctrl
  2225.  
  2226. #define TBS_AUTOTICKS           0x0001
  2227. #define TBS_VERT                0x0002
  2228. #define TBS_HORZ                0x0000
  2229. #define TBS_TOP                 0x0004
  2230. #define TBS_BOTTOM              0x0000
  2231. #define TBS_LEFT                0x0004
  2232. #define TBS_RIGHT               0x0000
  2233. #define TBS_BOTH                0x0008
  2234. #define TBS_NOTICKS             0x0010
  2235. #define TBS_ENABLESELRANGE      0x0020
  2236. #define TBS_FIXEDLENGTH         0x0040
  2237. #define TBS_NOTHUMB             0x0080
  2238. #if (_WIN32_IE >= 0x0300)
  2239. #define TBS_TOOLTIPS            0x0100
  2240. #endif
  2241.  
  2242. // end_r_commctrl
  2243.  
  2244. #define TBM_GETPOS              (WM_USER)
  2245. #define TBM_GETRANGEMIN         (WM_USER+1)
  2246. #define TBM_GETRANGEMAX         (WM_USER+2)
  2247. #define TBM_GETTIC              (WM_USER+3)
  2248. #define TBM_SETTIC              (WM_USER+4)
  2249. #define TBM_SETPOS              (WM_USER+5)
  2250. #define TBM_SETRANGE            (WM_USER+6)
  2251. #define TBM_SETRANGEMIN         (WM_USER+7)
  2252. #define TBM_SETRANGEMAX         (WM_USER+8)
  2253. #define TBM_CLEARTICS           (WM_USER+9)
  2254. #define TBM_SETSEL              (WM_USER+10)
  2255. #define TBM_SETSELSTART         (WM_USER+11)
  2256. #define TBM_SETSELEND           (WM_USER+12)
  2257. #define TBM_GETPTICS            (WM_USER+14)
  2258. #define TBM_GETTICPOS           (WM_USER+15)
  2259. #define TBM_GETNUMTICS          (WM_USER+16)
  2260. #define TBM_GETSELSTART         (WM_USER+17)
  2261. #define TBM_GETSELEND           (WM_USER+18)
  2262. #define TBM_CLEARSEL            (WM_USER+19)
  2263. #define TBM_SETTICFREQ          (WM_USER+20)
  2264. #define TBM_SETPAGESIZE         (WM_USER+21)
  2265. #define TBM_GETPAGESIZE         (WM_USER+22)
  2266. #define TBM_SETLINESIZE         (WM_USER+23)
  2267. #define TBM_GETLINESIZE         (WM_USER+24)
  2268. #define TBM_GETTHUMBRECT        (WM_USER+25)
  2269. #define TBM_GETCHANNELRECT      (WM_USER+26)
  2270. #define TBM_SETTHUMBLENGTH      (WM_USER+27)
  2271. #define TBM_GETTHUMBLENGTH      (WM_USER+28)
  2272. #if (_WIN32_IE >= 0x0300)
  2273. #define TBM_SETTOOLTIPS         (WM_USER+29)
  2274. #define TBM_GETTOOLTIPS         (WM_USER+30)
  2275. #define TBM_SETTIPSIDE          (WM_USER+31)
  2276. // TrackBar Tip Side flags
  2277. #define TBTS_TOP                0
  2278. #define TBTS_LEFT               1
  2279. #define TBTS_BOTTOM             2
  2280. #define TBTS_RIGHT              3
  2281.  
  2282. #define TBM_SETBUDDY            (WM_USER+32) // wparam = BOOL fLeft; (or right)
  2283. #define TBM_GETBUDDY            (WM_USER+33) // wparam = BOOL fLeft; (or right)
  2284. #endif
  2285. #if (_WIN32_IE >= 0x0400)
  2286. #define TBM_SETUNICODEFORMAT    CCM_SETUNICODEFORMAT
  2287. #define TBM_GETUNICODEFORMAT    CCM_GETUNICODEFORMAT
  2288. #endif
  2289.  
  2290.  
  2291. #define TB_LINEUP               0
  2292. #define TB_LINEDOWN             1
  2293. #define TB_PAGEUP               2
  2294. #define TB_PAGEDOWN             3
  2295. #define TB_THUMBPOSITION        4
  2296. #define TB_THUMBTRACK           5
  2297. #define TB_TOP                  6
  2298. #define TB_BOTTOM               7
  2299. #define TB_ENDTRACK             8
  2300.  
  2301.  
  2302. #if (_WIN32_IE >= 0x0300)
  2303. // custom draw item specs
  2304. #define TBCD_TICS    0x0001
  2305. #define TBCD_THUMB   0x0002
  2306. #define TBCD_CHANNEL 0x0003
  2307. #endif
  2308.  
  2309. #endif // trackbar
  2310.  
  2311. //====== DRAG LIST CONTROL ====================================================
  2312.  
  2313. #ifndef NODRAGLIST
  2314.  
  2315. typedef struct tagDRAGLISTINFO {
  2316.     UINT uNotification;
  2317.     HWND hWnd;
  2318.     POINT ptCursor;
  2319. } DRAGLISTINFO, FAR *LPDRAGLISTINFO;
  2320.  
  2321. #define DL_BEGINDRAG            (WM_USER+133)
  2322. #define DL_DRAGGING             (WM_USER+134)
  2323. #define DL_DROPPED              (WM_USER+135)
  2324. #define DL_CANCELDRAG           (WM_USER+136)
  2325.  
  2326. #define DL_CURSORSET            0
  2327. #define DL_STOPCURSOR           1
  2328. #define DL_COPYCURSOR           2
  2329. #define DL_MOVECURSOR           3
  2330.  
  2331. #define DRAGLISTMSGSTRING       TEXT("commctrl_DragListMsg")
  2332.  
  2333. WINCOMMCTRLAPI BOOL WINAPI MakeDragList(HWND hLB);
  2334. WINCOMMCTRLAPI void WINAPI DrawInsert(HWND handParent, HWND hLB, int nItem);
  2335. WINCOMMCTRLAPI int WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll);
  2336.  
  2337. #endif
  2338.  
  2339.  
  2340. //====== UPDOWN CONTROL =======================================================
  2341.  
  2342. #ifndef NOUPDOWN
  2343.  
  2344. #ifdef _WIN32
  2345.  
  2346. #define UPDOWN_CLASSA           "msctls_updown32"
  2347. #define UPDOWN_CLASSW           L"msctls_updown32"
  2348.  
  2349. #ifdef UNICODE
  2350. #define  UPDOWN_CLASS           UPDOWN_CLASSW
  2351. #else
  2352. #define  UPDOWN_CLASS           UPDOWN_CLASSA
  2353. #endif
  2354.  
  2355. #else
  2356. #define UPDOWN_CLASS            "msctls_updown"
  2357. #endif
  2358.  
  2359.  
  2360. typedef struct _UDACCEL {
  2361.     UINT nSec;
  2362.     UINT nInc;
  2363. } UDACCEL, FAR *LPUDACCEL;
  2364.  
  2365. #define UD_MAXVAL               0x7fff
  2366. #define UD_MINVAL               (-UD_MAXVAL)
  2367.  
  2368. // begin_r_commctrl
  2369.  
  2370. #define UDS_WRAP                0x0001
  2371. #define UDS_SETBUDDYINT         0x0002
  2372. #define UDS_ALIGNRIGHT          0x0004
  2373. #define UDS_ALIGNLEFT           0x0008
  2374. #define UDS_AUTOBUDDY           0x0010
  2375. #define UDS_ARROWKEYS           0x0020
  2376. #define UDS_HORZ                0x0040
  2377. #define UDS_NOTHOUSANDS         0x0080
  2378. #if (_WIN32_IE >= 0x0300)
  2379. #define UDS_HOTTRACK            0x0100
  2380. #endif
  2381.  
  2382. // end_r_commctrl
  2383.  
  2384. #define UDM_SETRANGE            (WM_USER+101)
  2385. #define UDM_GETRANGE            (WM_USER+102)
  2386. #define UDM_SETPOS              (WM_USER+103)
  2387. #define UDM_GETPOS              (WM_USER+104)
  2388. #define UDM_SETBUDDY            (WM_USER+105)
  2389. #define UDM_GETBUDDY            (WM_USER+106)
  2390. #define UDM_SETACCEL            (WM_USER+107)
  2391. #define UDM_GETACCEL            (WM_USER+108)
  2392. #define UDM_SETBASE             (WM_USER+109)
  2393. #define UDM_GETBASE             (WM_USER+110)
  2394. #if (_WIN32_IE >= 0x0400)
  2395. #define UDM_SETRANGE32          (WM_USER+111)
  2396. #define UDM_GETRANGE32          (WM_USER+112) // wParam & lParam are LPINT
  2397. #define UDM_SETUNICODEFORMAT    CCM_SETUNICODEFORMAT
  2398. #define UDM_GETUNICODEFORMAT    CCM_GETUNICODEFORMAT
  2399. #endif
  2400.  
  2401. WINCOMMCTRLAPI HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy,
  2402.                                 HWND hParent, int nID, HINSTANCE hInst,
  2403.                                 HWND hBuddy,
  2404.                                 int nUpper, int nLower, int nPos);
  2405.  
  2406. #if (_WIN32_IE >= 0x0300)
  2407. #define NM_UPDOWN      NMUPDOWN
  2408. #define LPNM_UPDOWN  LPNMUPDOWN
  2409. #else
  2410. #define NMUPDOWN      NM_UPDOWN
  2411. #define LPNMUPDOWN  LPNM_UPDOWN
  2412. #endif
  2413.  
  2414. typedef struct _NM_UPDOWN
  2415. {
  2416.     NMHDR hdr;
  2417.     int iPos;
  2418.     int iDelta;
  2419. } NMUPDOWN, FAR *LPNMUPDOWN;
  2420.  
  2421. #define UDN_DELTAPOS            (UDN_FIRST - 1)
  2422.  
  2423. #endif  // NOUPDOWN
  2424.  
  2425.  
  2426. //====== PROGRESS CONTROL =====================================================
  2427.  
  2428. #ifndef NOPROGRESS
  2429.  
  2430. #ifdef _WIN32
  2431.  
  2432. #define PROGRESS_CLASSA         "msctls_progress32"
  2433. #define PROGRESS_CLASSW         L"msctls_progress32"
  2434.  
  2435. #ifdef UNICODE
  2436. #define  PROGRESS_CLASS         PROGRESS_CLASSW
  2437. #else
  2438. #define  PROGRESS_CLASS         PROGRESS_CLASSA
  2439. #endif
  2440.  
  2441. #else
  2442. #define PROGRESS_CLASS          "msctls_progress"
  2443. #endif
  2444.  
  2445.  
  2446. #if (_WIN32_IE >= 0x0300)
  2447. #define PBS_SMOOTH              0x01
  2448. #define PBS_VERTICAL            0x04
  2449. #endif
  2450.  
  2451. #define PBM_SETRANGE            (WM_USER+1)
  2452. #define PBM_SETPOS              (WM_USER+2)
  2453. #define PBM_DELTAPOS            (WM_USER+3)
  2454. #define PBM_SETSTEP             (WM_USER+4)
  2455. #define PBM_STEPIT              (WM_USER+5)
  2456. #if (_WIN32_IE >= 0x0300)
  2457. #define PBM_SETRANGE32          (WM_USER+6)  // lParam = high, wParam = low
  2458. typedef struct
  2459. {
  2460.    int iLow;
  2461.    int iHigh;
  2462. } PBRANGE, *PPBRANGE;
  2463. #define PBM_GETRANGE            (WM_USER+7)  // wParam = return (TRUE ? low : high). lParam = PPBRANGE or NULL
  2464. #define PBM_GETPOS              (WM_USER+8)
  2465. #if (_WIN32_IE >= 0x0400)
  2466. #define PBM_SETBARCOLOR         (WM_USER+9)        // lParam = bar color
  2467. #endif      // _WIN32_IE >= 0x0400
  2468. #define PBM_SETBKCOLOR          CCM_SETBKCOLOR  // lParam = bkColor
  2469. #endif      // _WIN32_IE >= 0x0300
  2470.  
  2471. #endif  // NOPROGRESS
  2472.  
  2473.  
  2474. //====== HOTKEY CONTROL =======================================================
  2475.  
  2476. #ifndef NOHOTKEY
  2477.  
  2478. #define HOTKEYF_SHIFT           0x01
  2479. #define HOTKEYF_CONTROL         0x02
  2480. #define HOTKEYF_ALT             0x04
  2481. #ifdef _MAC
  2482. #define HOTKEYF_EXT             0x80
  2483. #else
  2484. #define HOTKEYF_EXT             0x08
  2485. #endif
  2486.  
  2487. #define HKCOMB_NONE             0x0001
  2488. #define HKCOMB_S                0x0002
  2489. #define HKCOMB_C                0x0004
  2490. #define HKCOMB_A                0x0008
  2491. #define HKCOMB_SC               0x0010
  2492. #define HKCOMB_SA               0x0020
  2493. #define HKCOMB_CA               0x0040
  2494. #define HKCOMB_SCA              0x0080
  2495.  
  2496.  
  2497. #define HKM_SETHOTKEY           (WM_USER+1)
  2498. #define HKM_GETHOTKEY           (WM_USER+2)
  2499. #define HKM_SETRULES            (WM_USER+3)
  2500.  
  2501. #ifdef _WIN32
  2502.  
  2503. #define HOTKEY_CLASSA           "msctls_hotkey32"
  2504. #define HOTKEY_CLASSW           L"msctls_hotkey32"
  2505.  
  2506. #ifdef UNICODE
  2507. #define HOTKEY_CLASS            HOTKEY_CLASSW
  2508. #else
  2509. #define HOTKEY_CLASS            HOTKEY_CLASSA
  2510. #endif
  2511.  
  2512. #else
  2513. #define HOTKEY_CLASS            "msctls_hotkey"
  2514. #endif
  2515.  
  2516. #endif  // NOHOTKEY
  2517.  
  2518. // begin_r_commctrl
  2519.  
  2520. //====== COMMON CONTROL STYLES ================================================
  2521.  
  2522. #define CCS_TOP                 0x00000001L
  2523. #define CCS_NOMOVEY             0x00000002L
  2524. #define CCS_BOTTOM              0x00000003L
  2525. #define CCS_NORESIZE            0x00000004L
  2526. #define CCS_NOPARENTALIGN       0x00000008L
  2527. #define CCS_ADJUSTABLE          0x00000020L
  2528. #define CCS_NODIVIDER           0x00000040L
  2529. #if (_WIN32_IE >= 0x0300)
  2530. #define CCS_VERT                0x00000080L
  2531. #define CCS_LEFT                (CCS_VERT | CCS_TOP)
  2532. #define CCS_RIGHT               (CCS_VERT | CCS_BOTTOM)
  2533. #define CCS_NOMOVEX             (CCS_VERT | CCS_NOMOVEY)
  2534. #endif
  2535.  
  2536. // end_r_commctrl
  2537.  
  2538. //====== LISTVIEW CONTROL =====================================================
  2539.  
  2540. #ifndef NOLISTVIEW
  2541.  
  2542. #ifdef _WIN32
  2543.  
  2544. #define WC_LISTVIEWA            "SysListView32"
  2545. #define WC_LISTVIEWW            L"SysListView32"
  2546.  
  2547. #ifdef UNICODE
  2548. #define WC_LISTVIEW             WC_LISTVIEWW
  2549. #else
  2550. #define WC_LISTVIEW             WC_LISTVIEWA
  2551. #endif
  2552.  
  2553. #else
  2554. #define WC_LISTVIEW             "SysListView"
  2555. #endif
  2556.  
  2557. // begin_r_commctrl
  2558.  
  2559. #define LVS_ICON                0x0000
  2560. #define LVS_REPORT              0x0001
  2561. #define LVS_SMALLICON           0x0002
  2562. #define LVS_LIST                0x0003
  2563. #define LVS_TYPEMASK            0x0003
  2564. #define LVS_SINGLESEL           0x0004
  2565. #define LVS_SHOWSELALWAYS       0x0008
  2566. #define LVS_SORTASCENDING       0x0010
  2567. #define LVS_SORTDESCENDING      0x0020
  2568. #define LVS_SHAREIMAGELISTS     0x0040
  2569. #define LVS_NOLABELWRAP         0x0080
  2570. #define LVS_AUTOARRANGE         0x0100
  2571. #define LVS_EDITLABELS          0x0200
  2572. #if (_WIN32_IE >= 0x0300)
  2573. #define LVS_OWNERDATA           0x1000
  2574. #endif
  2575. #define LVS_NOSCROLL            0x2000
  2576.  
  2577. #define LVS_TYPESTYLEMASK       0xfc00
  2578.  
  2579. #define LVS_ALIGNTOP            0x0000
  2580. #define LVS_ALIGNLEFT           0x0800
  2581. #define LVS_ALIGNMASK           0x0c00
  2582.  
  2583. #define LVS_OWNERDRAWFIXED      0x0400
  2584. #define LVS_NOCOLUMNHEADER      0x4000
  2585. #define LVS_NOSORTHEADER        0x8000
  2586.  
  2587. // end_r_commctrl
  2588.  
  2589. #if (_WIN32_IE >= 0x0400)
  2590. #define LVM_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  2591. #define ListView_SetUnicodeFormat(hwnd, fUnicode)  \
  2592.     (BOOL)SNDMSG((hwnd), LVM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0)
  2593.  
  2594. #define LVM_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  2595. #define ListView_GetUnicodeFormat(hwnd)  \
  2596.     (BOOL)SNDMSG((hwnd), LVM_GETUNICODEFORMAT, 0, 0)
  2597. #endif
  2598.  
  2599. #define LVM_GETBKCOLOR          (LVM_FIRST + 0)
  2600. #define ListView_GetBkColor(hwnd)  \
  2601.     (COLORREF)SNDMSG((hwnd), LVM_GETBKCOLOR, 0, 0L)
  2602.  
  2603. #define LVM_SETBKCOLOR          (LVM_FIRST + 1)
  2604. #define ListView_SetBkColor(hwnd, clrBk) \
  2605.     (BOOL)SNDMSG((hwnd), LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  2606.  
  2607. #define LVM_GETIMAGELIST        (LVM_FIRST + 2)
  2608. #define ListView_GetImageList(hwnd, iImageList) \
  2609.     (HIMAGELIST)SNDMSG((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
  2610.  
  2611. #define LVSIL_NORMAL            0
  2612. #define LVSIL_SMALL             1
  2613. #define LVSIL_STATE             2
  2614.  
  2615. #define LVM_SETIMAGELIST        (LVM_FIRST + 3)
  2616. #define ListView_SetImageList(hwnd, himl, iImageList) \
  2617.     (HIMAGELIST)(UINT)SNDMSG((hwnd), LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl))
  2618.  
  2619. #define LVM_GETITEMCOUNT        (LVM_FIRST + 4)
  2620. #define ListView_GetItemCount(hwnd) \
  2621.     (int)SNDMSG((hwnd), LVM_GETITEMCOUNT, 0, 0L)
  2622.  
  2623.  
  2624. #define LVIF_TEXT               0x0001
  2625. #define LVIF_IMAGE              0x0002
  2626. #define LVIF_PARAM              0x0004
  2627. #define LVIF_STATE              0x0008
  2628. #if (_WIN32_IE >= 0x0300)
  2629. #define LVIF_INDENT             0x0010
  2630. #define LVIF_NORECOMPUTE        0x0800
  2631. #endif
  2632.  
  2633. #define LVIS_FOCUSED            0x0001
  2634. #define LVIS_SELECTED           0x0002
  2635. #define LVIS_CUT                0x0004
  2636. #define LVIS_DROPHILITED        0x0008
  2637. #define LVIS_ACTIVATING         0x0020
  2638.  
  2639. #define LVIS_OVERLAYMASK        0x0F00
  2640. #define LVIS_STATEIMAGEMASK     0xF000
  2641.  
  2642. #define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
  2643.  
  2644. #if (_WIN32_IE >= 0x0300)
  2645. #define I_INDENTCALLBACK        (-1)
  2646. #define LV_ITEMA LVITEMA
  2647. #define LV_ITEMW LVITEMW
  2648. #else
  2649. #define tagLVITEMA    _LV_ITEMA
  2650. #define LVITEMA       LV_ITEMA
  2651. #define tagLVITEMW    _LV_ITEMW
  2652. #define LVITEMW       LV_ITEMW
  2653. #endif
  2654.  
  2655. #define LV_ITEM LVITEM
  2656.  
  2657. #define LVITEMA_V1_SIZE CCSIZEOF_STRUCT(LVITEMA, lParam)
  2658. #define LVITEMW_V1_SIZE CCSIZEOF_STRUCT(LVITEMW, lParam)
  2659.  
  2660. typedef struct tagLVITEMA
  2661. {
  2662.     UINT mask;
  2663.     int iItem;
  2664.     int iSubItem;
  2665.     UINT state;
  2666.     UINT stateMask;
  2667.     LPSTR pszText;
  2668.     int cchTextMax;
  2669.     int iImage;
  2670.     LPARAM lParam;
  2671. #if (_WIN32_IE >= 0x0300)
  2672.     int iIndent;
  2673. #endif
  2674. } LVITEMA, FAR* LPLVITEMA;
  2675.  
  2676. typedef struct tagLVITEMW
  2677. {
  2678.     UINT mask;
  2679.     int iItem;
  2680.     int iSubItem;
  2681.     UINT state;
  2682.     UINT stateMask;
  2683.     LPWSTR pszText;
  2684.     int cchTextMax;
  2685.     int iImage;
  2686.     LPARAM lParam;
  2687. #if (_WIN32_IE >= 0x0300)
  2688.     int iIndent;
  2689. #endif
  2690. } LVITEMW, FAR* LPLVITEMW;
  2691.  
  2692.  
  2693. #ifdef UNICODE
  2694. #define LVITEM    LVITEMW
  2695. #define LPLVITEM  LPLVITEMW
  2696. #define LVITEM_V1_SIZE LVITEMW_V1_SIZE
  2697. #else
  2698. #define LVITEM    LVITEMA
  2699. #define LPLVITEM  LPLVITEMA
  2700. #define LVITEM_V1_SIZE LVITEMA_V1_SIZE
  2701. #endif
  2702.  
  2703.  
  2704. #define LPSTR_TEXTCALLBACKW     ((LPWSTR)-1L)
  2705. #define LPSTR_TEXTCALLBACKA     ((LPSTR)-1L)
  2706. #ifdef UNICODE
  2707. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKW
  2708. #else
  2709. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKA
  2710. #endif
  2711.  
  2712. #define I_IMAGECALLBACK         (-1)
  2713.  
  2714. #define LVM_GETITEMA            (LVM_FIRST + 5)
  2715. #define LVM_GETITEMW            (LVM_FIRST + 75)
  2716. #ifdef UNICODE
  2717. #define LVM_GETITEM             LVM_GETITEMW
  2718. #else
  2719. #define LVM_GETITEM             LVM_GETITEMA
  2720. #endif
  2721.  
  2722. #define ListView_GetItem(hwnd, pitem) \
  2723.     (BOOL)SNDMSG((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM FAR*)(pitem))
  2724.  
  2725.  
  2726. #define LVM_SETITEMA            (LVM_FIRST + 6)
  2727. #define LVM_SETITEMW            (LVM_FIRST + 76)
  2728. #ifdef UNICODE
  2729. #define LVM_SETITEM             LVM_SETITEMW
  2730. #else
  2731. #define LVM_SETITEM             LVM_SETITEMA
  2732. #endif
  2733.  
  2734. #define ListView_SetItem(hwnd, pitem) \
  2735.     (BOOL)SNDMSG((hwnd), LVM_SETITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  2736.  
  2737.  
  2738. #define LVM_INSERTITEMA         (LVM_FIRST + 7)
  2739. #define LVM_INSERTITEMW         (LVM_FIRST + 77)
  2740. #ifdef UNICODE
  2741. #define LVM_INSERTITEM          LVM_INSERTITEMW
  2742. #else
  2743. #define LVM_INSERTITEM          LVM_INSERTITEMA
  2744. #endif
  2745. #define ListView_InsertItem(hwnd, pitem)   \
  2746.     (int)SNDMSG((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  2747.  
  2748.  
  2749. #define LVM_DELETEITEM          (LVM_FIRST + 8)
  2750. #define ListView_DeleteItem(hwnd, i) \
  2751.     (BOOL)SNDMSG((hwnd), LVM_DELETEITEM, (WPARAM)(int)(i), 0L)
  2752.  
  2753.  
  2754. #define LVM_DELETEALLITEMS      (LVM_FIRST + 9)
  2755. #define ListView_DeleteAllItems(hwnd) \
  2756.     (BOOL)SNDMSG((hwnd), LVM_DELETEALLITEMS, 0, 0L)
  2757.  
  2758.  
  2759. #define LVM_GETCALLBACKMASK     (LVM_FIRST + 10)
  2760. #define ListView_GetCallbackMask(hwnd) \
  2761.     (BOOL)SNDMSG((hwnd), LVM_GETCALLBACKMASK, 0, 0)
  2762.  
  2763.  
  2764. #define LVM_SETCALLBACKMASK     (LVM_FIRST + 11)
  2765. #define ListView_SetCallbackMask(hwnd, mask) \
  2766.     (BOOL)SNDMSG((hwnd), LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0)
  2767.  
  2768.  
  2769. #define LVNI_ALL                0x0000
  2770. #define LVNI_FOCUSED            0x0001
  2771. #define LVNI_SELECTED           0x0002
  2772. #define LVNI_CUT                0x0004
  2773. #define LVNI_DROPHILITED        0x0008
  2774.  
  2775. #define LVNI_ABOVE              0x0100
  2776. #define LVNI_BELOW              0x0200
  2777. #define LVNI_TOLEFT             0x0400
  2778. #define LVNI_TORIGHT            0x0800
  2779.  
  2780.  
  2781. #define LVM_GETNEXTITEM         (LVM_FIRST + 12)
  2782. #define ListView_GetNextItem(hwnd, i, flags) \
  2783.     (int)SNDMSG((hwnd), LVM_GETNEXTITEM, (WPARAM)(int)(i), MAKELPARAM((flags), 0))
  2784.  
  2785.  
  2786. #define LVFI_PARAM              0x0001
  2787. #define LVFI_STRING             0x0002
  2788. #define LVFI_PARTIAL            0x0008
  2789. #define LVFI_WRAP               0x0020
  2790. #define LVFI_NEARESTXY          0x0040
  2791.  
  2792. #if (_WIN32_IE >= 0x0300)
  2793. #define LV_FINDINFOA    LVFINDINFOA
  2794. #define LV_FINDINFOW    LVFINDINFOW
  2795. #else
  2796. #define tagLVFINDINFOA  _LV_FINDINFOA
  2797. #define    LVFINDINFOA   LV_FINDINFOA
  2798. #define tagLVFINDINFOW  _LV_FINDINFOW
  2799. #define    LVFINDINFOW   LV_FINDINFOW
  2800. #endif
  2801.  
  2802. #define LV_FINDINFO  LVFINDINFO
  2803.  
  2804. typedef struct tagLVFINDINFOA
  2805. {
  2806.     UINT flags;
  2807.     LPCSTR psz;
  2808.     LPARAM lParam;
  2809.     POINT pt;
  2810.     UINT vkDirection;
  2811. } LVFINDINFOA, FAR* LPFINDINFOA;
  2812.  
  2813. typedef struct tagLVFINDINFOW
  2814. {
  2815.     UINT flags;
  2816.     LPCWSTR psz;
  2817.     LPARAM lParam;
  2818.     POINT pt;
  2819.     UINT vkDirection;
  2820. } LVFINDINFOW, FAR* LPFINDINFOW;
  2821.  
  2822. #ifdef UNICODE
  2823. #define  LVFINDINFO            LVFINDINFOW
  2824. #else
  2825. #define  LVFINDINFO            LVFINDINFOA
  2826. #endif
  2827.  
  2828. #define LVM_FINDITEMA           (LVM_FIRST + 13)
  2829. #define LVM_FINDITEMW           (LVM_FIRST + 83)
  2830. #ifdef UNICODE
  2831. #define  LVM_FINDITEM           LVM_FINDITEMW
  2832. #else
  2833. #define  LVM_FINDITEM           LVM_FINDITEMA
  2834. #endif
  2835.  
  2836. #define ListView_FindItem(hwnd, iStart, plvfi) \
  2837.     (int)SNDMSG((hwnd), LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LV_FINDINFO FAR*)(plvfi))
  2838.  
  2839. #define LVIR_BOUNDS             0
  2840. #define LVIR_ICON               1
  2841. #define LVIR_LABEL              2
  2842. #define LVIR_SELECTBOUNDS       3
  2843.  
  2844.  
  2845. #define LVM_GETITEMRECT         (LVM_FIRST + 14)
  2846. #define ListView_GetItemRect(hwnd, i, prc, code) \
  2847.      (BOOL)SNDMSG((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), \
  2848.            ((prc) ? (((RECT FAR *)(prc))->left = (code),(LPARAM)(RECT FAR*)(prc)) : (LPARAM)(RECT FAR*)NULL))
  2849.  
  2850.  
  2851. #define LVM_SETITEMPOSITION     (LVM_FIRST + 15)
  2852. #define ListView_SetItemPosition(hwndLV, i, x, y) \
  2853.     (BOOL)SNDMSG((hwndLV), LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y)))
  2854.  
  2855.  
  2856. #define LVM_GETITEMPOSITION     (LVM_FIRST + 16)
  2857. #define ListView_GetItemPosition(hwndLV, i, ppt) \
  2858.     (BOOL)SNDMSG((hwndLV), LVM_GETITEMPOSITION, (WPARAM)(int)(i), (LPARAM)(POINT FAR*)(ppt))
  2859.  
  2860.  
  2861. #define LVM_GETSTRINGWIDTHA     (LVM_FIRST + 17)
  2862. #define LVM_GETSTRINGWIDTHW     (LVM_FIRST + 87)
  2863. #ifdef UNICODE
  2864. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHW
  2865. #else
  2866. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHA
  2867. #endif
  2868.  
  2869. #define ListView_GetStringWidth(hwndLV, psz) \
  2870.     (int)SNDMSG((hwndLV), LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCTSTR)(psz))
  2871.  
  2872.  
  2873. #define LVHT_NOWHERE            0x0001
  2874. #define LVHT_ONITEMICON         0x0002
  2875. #define LVHT_ONITEMLABEL        0x0004
  2876. #define LVHT_ONITEMSTATEICON    0x0008
  2877. #define LVHT_ONITEM             (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
  2878.  
  2879. #define LVHT_ABOVE              0x0008
  2880. #define LVHT_BELOW              0x0010
  2881. #define LVHT_TORIGHT            0x0020
  2882. #define LVHT_TOLEFT             0x0040
  2883.  
  2884. #if (_WIN32_IE >= 0x0300)
  2885. #define LV_HITTESTINFO LVHITTESTINFO
  2886. #else
  2887. #define tagLVHITTESTINFO  _LV_HITTESTINFO
  2888. #define    LVHITTESTINFO   LV_HITTESTINFO
  2889. #endif
  2890.  
  2891. #define LVHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(LVHITTESTINFO, iItem)
  2892.  
  2893. typedef struct tagLVHITTESTINFO
  2894. {
  2895.     POINT pt;
  2896.     UINT flags;
  2897.     int iItem;
  2898. #if (_WIN32_IE >= 0x0300)
  2899.     int iSubItem;    // this is was NOT in win95.  valid only for LVM_SUBITEMHITTEST
  2900. #endif
  2901. } LVHITTESTINFO, FAR* LPLVHITTESTINFO;
  2902.  
  2903. #define LVM_HITTEST             (LVM_FIRST + 18)
  2904. #define ListView_HitTest(hwndLV, pinfo) \
  2905.     (int)SNDMSG((hwndLV), LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO FAR*)(pinfo))
  2906.  
  2907.  
  2908. #define LVM_ENSUREVISIBLE       (LVM_FIRST + 19)
  2909. #define ListView_EnsureVisible(hwndLV, i, fPartialOK) \
  2910.     (BOOL)SNDMSG((hwndLV), LVM_ENSUREVISIBLE, (WPARAM)(int)(i), MAKELPARAM((fPartialOK), 0))
  2911.  
  2912.  
  2913. #define LVM_SCROLL              (LVM_FIRST + 20)
  2914. #define ListView_Scroll(hwndLV, dx, dy) \
  2915.     (BOOL)SNDMSG((hwndLV), LVM_SCROLL, (WPARAM)(int)dx, (LPARAM)(int)dy)
  2916.  
  2917.  
  2918. #define LVM_REDRAWITEMS         (LVM_FIRST + 21)
  2919. #define ListView_RedrawItems(hwndLV, iFirst, iLast) \
  2920.     (BOOL)SNDMSG((hwndLV), LVM_REDRAWITEMS, (WPARAM)(int)iFirst, (LPARAM)(int)iLast)
  2921.  
  2922.  
  2923. #define LVA_DEFAULT             0x0000
  2924. #define LVA_ALIGNLEFT           0x0001
  2925. #define LVA_ALIGNTOP            0x0002
  2926. #define LVA_SNAPTOGRID          0x0005
  2927.  
  2928. #define LVM_ARRANGE             (LVM_FIRST + 22)
  2929. #define ListView_Arrange(hwndLV, code) \
  2930.     (BOOL)SNDMSG((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0L)
  2931.  
  2932.  
  2933. #define LVM_EDITLABELA          (LVM_FIRST + 23)
  2934. #define LVM_EDITLABELW          (LVM_FIRST + 118)
  2935. #ifdef UNICODE
  2936. #define LVM_EDITLABEL           LVM_EDITLABELW
  2937. #else
  2938. #define LVM_EDITLABEL           LVM_EDITLABELA
  2939. #endif
  2940.  
  2941. #define ListView_EditLabel(hwndLV, i) \
  2942.     (HWND)SNDMSG((hwndLV), LVM_EDITLABEL, (WPARAM)(int)(i), 0L)
  2943.  
  2944.  
  2945. #define LVM_GETEDITCONTROL      (LVM_FIRST + 24)
  2946. #define ListView_GetEditControl(hwndLV) \
  2947.     (HWND)SNDMSG((hwndLV), LVM_GETEDITCONTROL, 0, 0L)
  2948.  
  2949.  
  2950. #if (_WIN32_IE >= 0x0300)
  2951. #define LV_COLUMNA      LVCOLUMNA
  2952. #define LV_COLUMNW      LVCOLUMNW
  2953. #else
  2954. #define tagLVCOLUMNA    _LV_COLUMNA
  2955. #define    LVCOLUMNA     LV_COLUMNA
  2956. #define tagLVCOLUMNW    _LV_COLUMNW
  2957. #define    LVCOLUMNW     LV_COLUMNW
  2958. #endif
  2959.  
  2960. #define LV_COLUMN       LVCOLUMN
  2961.  
  2962. #define LVCOLUMNA_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNA, iSubItem)
  2963. #define LVCOLUMNW_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNW, iSubItem)
  2964.  
  2965. typedef struct tagLVCOLUMNA
  2966. {
  2967.     UINT mask;
  2968.     int fmt;
  2969.     int cx;
  2970.     LPSTR pszText;
  2971.     int cchTextMax;
  2972.     int iSubItem;
  2973. #if (_WIN32_IE >= 0x0300)
  2974.     int iImage;
  2975.     int iOrder;
  2976. #endif
  2977. } LVCOLUMNA, FAR* LPLVCOLUMNA;
  2978.  
  2979. typedef struct tagLVCOLUMNW
  2980. {
  2981.     UINT mask;
  2982.     int fmt;
  2983.     int cx;
  2984.     LPWSTR pszText;
  2985.     int cchTextMax;
  2986.     int iSubItem;
  2987. #if (_WIN32_IE >= 0x0300)
  2988.     int iImage;
  2989.     int iOrder;
  2990. #endif
  2991. } LVCOLUMNW, FAR* LPLVCOLUMNW;
  2992.  
  2993. #ifdef UNICODE
  2994. #define  LVCOLUMN               LVCOLUMNW
  2995. #define  LPLVCOLUMN             LPLVCOLUMNW
  2996. #define LVCOLUMN_V1_SIZE LVCOLUMNW_V1_SIZE
  2997. #else
  2998. #define  LVCOLUMN               LVCOLUMNA
  2999. #define  LPLVCOLUMN             LPLVCOLUMNA
  3000. #define LVCOLUMN_V1_SIZE LVCOLUMNA_V1_SIZE
  3001. #endif
  3002.  
  3003.  
  3004. #define LVCF_FMT                0x0001
  3005. #define LVCF_WIDTH              0x0002
  3006. #define LVCF_TEXT               0x0004
  3007. #define LVCF_SUBITEM            0x0008
  3008. #if (_WIN32_IE >= 0x0300)
  3009. #define LVCF_IMAGE              0x0010
  3010. #define LVCF_ORDER              0x0020
  3011. #endif
  3012.  
  3013. #define LVCFMT_LEFT             0x0000
  3014. #define LVCFMT_RIGHT            0x0001
  3015. #define LVCFMT_CENTER           0x0002
  3016. #define LVCFMT_JUSTIFYMASK      0x0003
  3017. #if (_WIN32_IE >= 0x0300)
  3018. #define LVCFMT_IMAGE            0x0800
  3019. #define LVCFMT_BITMAP_ON_RIGHT  0x1000
  3020. #define LVCFMT_COL_HAS_IMAGES   0x8000
  3021. #endif
  3022.  
  3023. #define LVM_GETCOLUMNA          (LVM_FIRST + 25)
  3024. #define LVM_GETCOLUMNW          (LVM_FIRST + 95)
  3025. #ifdef UNICODE
  3026. #define  LVM_GETCOLUMN          LVM_GETCOLUMNW
  3027. #else
  3028. #define  LVM_GETCOLUMN          LVM_GETCOLUMNA
  3029. #endif
  3030.  
  3031. #define ListView_GetColumn(hwnd, iCol, pcol) \
  3032.     (BOOL)SNDMSG((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN FAR*)(pcol))
  3033.  
  3034.  
  3035. #define LVM_SETCOLUMNA          (LVM_FIRST + 26)
  3036. #define LVM_SETCOLUMNW          (LVM_FIRST + 96)
  3037. #ifdef UNICODE
  3038. #define  LVM_SETCOLUMN          LVM_SETCOLUMNW
  3039. #else
  3040. #define  LVM_SETCOLUMN          LVM_SETCOLUMNA
  3041. #endif
  3042.  
  3043. #define ListView_SetColumn(hwnd, iCol, pcol) \
  3044.     (BOOL)SNDMSG((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  3045.  
  3046.  
  3047. #define LVM_INSERTCOLUMNA       (LVM_FIRST + 27)
  3048. #define LVM_INSERTCOLUMNW       (LVM_FIRST + 97)
  3049. #ifdef UNICODE
  3050. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNW
  3051. #else
  3052. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNA
  3053. #endif
  3054.  
  3055. #define ListView_InsertColumn(hwnd, iCol, pcol) \
  3056.     (int)SNDMSG((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  3057.  
  3058.  
  3059. #define LVM_DELETECOLUMN        (LVM_FIRST + 28)
  3060. #define ListView_DeleteColumn(hwnd, iCol) \
  3061.     (BOOL)SNDMSG((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0)
  3062.  
  3063.  
  3064. #define LVM_GETCOLUMNWIDTH      (LVM_FIRST + 29)
  3065. #define ListView_GetColumnWidth(hwnd, iCol) \
  3066.     (int)SNDMSG((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0)
  3067.  
  3068.  
  3069. #define LVSCW_AUTOSIZE              -1
  3070. #define LVSCW_AUTOSIZE_USEHEADER    -2
  3071. #define LVM_SETCOLUMNWIDTH          (LVM_FIRST + 30)
  3072.  
  3073. #define ListView_SetColumnWidth(hwnd, iCol, cx) \
  3074.     (BOOL)SNDMSG((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0))
  3075.  
  3076. #if (_WIN32_IE >= 0x0300)
  3077. #define LVM_GETHEADER               (LVM_FIRST + 31)
  3078. #define ListView_GetHeader(hwnd)\
  3079.     (HWND)SNDMSG((hwnd), LVM_GETHEADER, 0, 0L)
  3080. #endif
  3081.  
  3082. #define LVM_CREATEDRAGIMAGE     (LVM_FIRST + 33)
  3083. #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
  3084.     (HIMAGELIST)SNDMSG((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
  3085.  
  3086.  
  3087. #define LVM_GETVIEWRECT         (LVM_FIRST + 34)
  3088. #define ListView_GetViewRect(hwnd, prc) \
  3089.     (BOOL)SNDMSG((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT FAR*)(prc))
  3090.  
  3091.  
  3092. #define LVM_GETTEXTCOLOR        (LVM_FIRST + 35)
  3093. #define ListView_GetTextColor(hwnd)  \
  3094.     (COLORREF)SNDMSG((hwnd), LVM_GETTEXTCOLOR, 0, 0L)
  3095.  
  3096.  
  3097. #define LVM_SETTEXTCOLOR        (LVM_FIRST + 36)
  3098. #define ListView_SetTextColor(hwnd, clrText) \
  3099.     (BOOL)SNDMSG((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  3100.  
  3101.  
  3102. #define LVM_GETTEXTBKCOLOR      (LVM_FIRST + 37)
  3103. #define ListView_GetTextBkColor(hwnd)  \
  3104.     (COLORREF)SNDMSG((hwnd), LVM_GETTEXTBKCOLOR, 0, 0L)
  3105.  
  3106.  
  3107. #define LVM_SETTEXTBKCOLOR      (LVM_FIRST + 38)
  3108. #define ListView_SetTextBkColor(hwnd, clrTextBk) \
  3109.     (BOOL)SNDMSG((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  3110.  
  3111.  
  3112. #define LVM_GETTOPINDEX         (LVM_FIRST + 39)
  3113. #define ListView_GetTopIndex(hwndLV) \
  3114.     (int)SNDMSG((hwndLV), LVM_GETTOPINDEX, 0, 0)
  3115.  
  3116.  
  3117. #define LVM_GETCOUNTPERPAGE     (LVM_FIRST + 40)
  3118. #define ListView_GetCountPerPage(hwndLV) \
  3119.     (int)SNDMSG((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)
  3120.  
  3121.  
  3122. #define LVM_GETORIGIN           (LVM_FIRST + 41)
  3123. #define ListView_GetOrigin(hwndLV, ppt) \
  3124.     (BOOL)SNDMSG((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT FAR*)(ppt))
  3125.  
  3126.  
  3127. #define LVM_UPDATE              (LVM_FIRST + 42)
  3128. #define ListView_Update(hwndLV, i) \
  3129.     (BOOL)SNDMSG((hwndLV), LVM_UPDATE, (WPARAM)i, 0L)
  3130.  
  3131.  
  3132. #define LVM_SETITEMSTATE        (LVM_FIRST + 43)
  3133. #define ListView_SetItemState(hwndLV, i, data, mask) \
  3134. { LV_ITEM _ms_lvi;\
  3135.   _ms_lvi.stateMask = mask;\
  3136.   _ms_lvi.state = data;\
  3137.   SNDMSG((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  3138. }
  3139.  
  3140.  
  3141. #define LVM_GETITEMSTATE        (LVM_FIRST + 44)
  3142. #define ListView_GetItemState(hwndLV, i, mask) \
  3143.    (UINT)SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask)
  3144.  
  3145. #if (_WIN32_IE >= 0x0300)
  3146. #define ListView_GetCheckState(hwndLV, i) \
  3147.    ((((UINT)(SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, LVIS_STATEIMAGEMASK))) >> 12) -1)
  3148. #endif
  3149.  
  3150. #define LVM_GETITEMTEXTA        (LVM_FIRST + 45)
  3151. #define LVM_GETITEMTEXTW        (LVM_FIRST + 115)
  3152.  
  3153. #ifdef UNICODE
  3154. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTW
  3155. #else
  3156. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTA
  3157. #endif
  3158.  
  3159. #define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  3160. { LV_ITEM _ms_lvi;\
  3161.   _ms_lvi.iSubItem = iSubItem_;\
  3162.   _ms_lvi.cchTextMax = cchTextMax_;\
  3163.   _ms_lvi.pszText = pszText_;\
  3164.   SNDMSG((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  3165. }
  3166.  
  3167.  
  3168. #define LVM_SETITEMTEXTA        (LVM_FIRST + 46)
  3169. #define LVM_SETITEMTEXTW        (LVM_FIRST + 116)
  3170.  
  3171. #ifdef UNICODE
  3172. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTW
  3173. #else
  3174. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTA
  3175. #endif
  3176.  
  3177. #define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) \
  3178. { LV_ITEM _ms_lvi;\
  3179.   _ms_lvi.iSubItem = iSubItem_;\
  3180.   _ms_lvi.pszText = pszText_;\
  3181.   SNDMSG((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  3182. }
  3183.  
  3184. #if (_WIN32_IE >= 0x0300)
  3185. // these flags only apply to LVS_OWNERDATA listviews in report or list mode
  3186. #define LVSICF_NOINVALIDATEALL  0x00000001
  3187. #define LVSICF_NOSCROLL         0x00000002
  3188. #endif
  3189.  
  3190. #define LVM_SETITEMCOUNT        (LVM_FIRST + 47)
  3191. #define ListView_SetItemCount(hwndLV, cItems) \
  3192.   SNDMSG((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0)
  3193.  
  3194. #if (_WIN32_IE >= 0x0300)
  3195. #define ListView_SetItemCountEx(hwndLV, cItems, dwFlags) \
  3196.   SNDMSG((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, (LPARAM)dwFlags)
  3197. #endif
  3198.  
  3199. typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
  3200.  
  3201.  
  3202. #define LVM_SORTITEMS           (LVM_FIRST + 48)
  3203. #define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) \
  3204.   (BOOL)SNDMSG((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, \
  3205.   (LPARAM)(PFNLVCOMPARE)_pfnCompare)
  3206.  
  3207.  
  3208. #define LVM_SETITEMPOSITION32   (LVM_FIRST + 49)
  3209. #define ListView_SetItemPosition32(hwndLV, i, x, y) \
  3210. { POINT ptNewPos = {x,y}; \
  3211.     SNDMSG((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); \
  3212. }
  3213.  
  3214.  
  3215. #define LVM_GETSELECTEDCOUNT    (LVM_FIRST + 50)
  3216. #define ListView_GetSelectedCount(hwndLV) \
  3217.     (UINT)SNDMSG((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
  3218.  
  3219.  
  3220. #define LVM_GETITEMSPACING      (LVM_FIRST + 51)
  3221. #define ListView_GetItemSpacing(hwndLV, fSmall) \
  3222.         (DWORD)SNDMSG((hwndLV), LVM_GETITEMSPACING, fSmall, 0L)
  3223.  
  3224.  
  3225. #define LVM_GETISEARCHSTRINGA   (LVM_FIRST + 52)
  3226. #define LVM_GETISEARCHSTRINGW   (LVM_FIRST + 117)
  3227.  
  3228. #ifdef UNICODE
  3229. #define LVM_GETISEARCHSTRING    LVM_GETISEARCHSTRINGW
  3230. #else
  3231. #define LVM_GETISEARCHSTRING    LVM_GETISEARCHSTRINGA
  3232. #endif
  3233.  
  3234. #define ListView_GetISearchString(hwndLV, lpsz) \
  3235.         (BOOL)SNDMSG((hwndLV), LVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  3236.  
  3237. #if (_WIN32_IE >= 0x0300)
  3238. #define LVM_SETICONSPACING      (LVM_FIRST + 53)
  3239. // -1 for cx and cy means we'll use the default (system settings)
  3240. // 0 for cx or cy means use the current setting (allows you to change just one param)
  3241. #define ListView_SetIconSpacing(hwndLV, cx, cy) \
  3242.         (DWORD)SNDMSG((hwndLV), LVM_SETICONSPACING, 0, MAKELONG(cx,cy))
  3243.  
  3244.  
  3245. #define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54)   // optional wParam == mask
  3246. #define ListView_SetExtendedListViewStyle(hwndLV, dw)\
  3247.         (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dw)
  3248. #if (_WIN32_IE >= 0x0400)
  3249. #define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)\
  3250.         (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, dwMask, dw)
  3251. #endif
  3252.  
  3253. #define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 55)
  3254. #define ListView_GetExtendedListViewStyle(hwndLV)\
  3255.         (DWORD)SNDMSG((hwndLV), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
  3256.  
  3257. #define LVS_EX_GRIDLINES        0x00000001
  3258. #define LVS_EX_SUBITEMIMAGES    0x00000002
  3259. #define LVS_EX_CHECKBOXES       0x00000004
  3260. #define LVS_EX_TRACKSELECT      0x00000008
  3261. #define LVS_EX_HEADERDRAGDROP   0x00000010
  3262. #define LVS_EX_FULLROWSELECT    0x00000020 // applies to report mode only
  3263. #define LVS_EX_ONECLICKACTIVATE 0x00000040
  3264. #define LVS_EX_TWOCLICKACTIVATE 0x00000080
  3265. #if (_WIN32_IE >= 0x0400)
  3266. #define LVS_EX_FLATSB           0x00000100
  3267. #define LVS_EX_REGIONAL         0x00000200
  3268. #define LVS_EX_INFOTIP          0x00000400 // listview does InfoTips for you
  3269. #define LVS_EX_UNDERLINEHOT     0x00000800
  3270. #define LVS_EX_UNDERLINECOLD    0x00001000
  3271. #define LVS_EX_MULTIWORKAREAS   0x00002000
  3272. #endif
  3273.  
  3274. #define LVM_GETSUBITEMRECT      (LVM_FIRST + 56)
  3275. #define ListView_GetSubItemRect(hwnd, iItem, iSubItem, code, prc) \
  3276.         (BOOL)SNDMSG((hwnd), LVM_GETSUBITEMRECT, (WPARAM)(int)(iItem), \
  3277.                 ((prc) ? ((((LPRECT)(prc))->top = iSubItem), (((LPRECT)(prc))->left = code), (LPARAM)(prc)) : (LPARAM)(LPRECT)NULL))
  3278.  
  3279. #define LVM_SUBITEMHITTEST      (LVM_FIRST + 57)
  3280. #define ListView_SubItemHitTest(hwnd, plvhti) \
  3281.         (int)SNDMSG((hwnd), LVM_SUBITEMHITTEST, 0, (LPARAM)(LPLVHITTESTINFO)(plvhti))
  3282.  
  3283. #define LVM_SETCOLUMNORDERARRAY (LVM_FIRST + 58)
  3284. #define ListView_SetColumnOrderArray(hwnd, iCount, pi) \
  3285.         (BOOL)SNDMSG((hwnd), LVM_SETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi)
  3286.  
  3287. #define LVM_GETCOLUMNORDERARRAY (LVM_FIRST + 59)
  3288. #define ListView_GetColumnOrderArray(hwnd, iCount, pi) \
  3289.         (BOOL)SNDMSG((hwnd), LVM_GETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi)
  3290.  
  3291. #define LVM_SETHOTITEM  (LVM_FIRST + 60)
  3292. #define ListView_SetHotItem(hwnd, i) \
  3293.         (int)SNDMSG((hwnd), LVM_SETHOTITEM, (WPARAM)i, 0)
  3294.  
  3295. #define LVM_GETHOTITEM  (LVM_FIRST + 61)
  3296. #define ListView_GetHotItem(hwnd) \
  3297.         (int)SNDMSG((hwnd), LVM_GETHOTITEM, 0, 0)
  3298.  
  3299. #define LVM_SETHOTCURSOR  (LVM_FIRST + 62)
  3300. #define ListView_SetHotCursor(hwnd, hcur) \
  3301.         (HCURSOR)SNDMSG((hwnd), LVM_SETHOTCURSOR, 0, (LPARAM)hcur)
  3302.  
  3303. #define LVM_GETHOTCURSOR  (LVM_FIRST + 63)
  3304. #define ListView_GetHotCursor(hwnd) \
  3305.         (HCURSOR)SNDMSG((hwnd), LVM_GETHOTCURSOR, 0, 0)
  3306.  
  3307. #define LVM_APPROXIMATEVIEWRECT (LVM_FIRST + 64)
  3308. #define ListView_ApproximateViewRect(hwnd, iWidth, iHeight, iCount) \
  3309.         (DWORD)SNDMSG((hwnd), LVM_APPROXIMATEVIEWRECT, iCount, MAKELPARAM(iWidth, iHeight))
  3310. #endif      // _WIN32_IE >= 0x0300
  3311.  
  3312. #if (_WIN32_IE >= 0x0400)
  3313.  
  3314. #define LV_MAX_WORKAREAS         16                          
  3315. #define LVM_SETWORKAREAS         (LVM_FIRST + 65)
  3316. #define ListView_SetWorkAreas(hwnd, nWorkAreas, prc) \
  3317.     (BOOL)SNDMSG((hwnd), LVM_SETWORKAREAS, (WPARAM)(int)nWorkAreas, (LPARAM)(RECT FAR*)(prc))
  3318.  
  3319. #define LVM_GETWORKAREAS        (LVM_FIRST + 70)
  3320. #define ListView_GetWorkAreas(hwnd, nWorkAreas, prc) \
  3321.     (BOOL)SNDMSG((hwnd), LVM_GETWORKAREAS, (WPARAM)(int)nWorkAreas, (LPARAM)(RECT FAR*)(prc))
  3322.  
  3323.  
  3324. #define LVM_GETNUMBEROFWORKAREAS  (LVM_FIRST + 73)
  3325. #define ListView_GetNumberOfWorkAreas(hwnd, pnWorkAreas) \
  3326.     (BOOL)SNDMSG((hwnd), LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)(UINT *)(pnWorkAreas))
  3327.  
  3328.  
  3329. #define LVM_GETSELECTIONMARK    (LVM_FIRST + 66)
  3330. #define ListView_GetSelectionMark(hwnd) \
  3331.     (int)SNDMSG((hwnd), LVM_GETSELECTIONMARK, 0, 0)
  3332.  
  3333. #define LVM_SETSELECTIONMARK    (LVM_FIRST + 67)
  3334. #define ListView_SetSelectionMark(hwnd, i) \
  3335.     (int)SNDMSG((hwnd), LVM_SETSELECTIONMARK, 0, (LPARAM)i)
  3336.  
  3337. #define LVM_SETHOVERTIME        (LVM_FIRST + 71)
  3338. #define ListView_SetHoverTime(hwndLV, dwHoverTimeMs)\
  3339.         (DWORD)SendMessage((hwndLV), LVM_SETHOVERTIME, 0, dwHoverTimeMs)
  3340.  
  3341. #define LVM_GETHOVERTIME        (LVM_FIRST + 72)
  3342. #define ListView_GetHoverTime(hwndLV)\
  3343.         (DWORD)SendMessage((hwndLV), LVM_GETHOVERTIME, 0, 0)
  3344.  
  3345. #define LVM_SETTOOLTIPS       (LVM_FIRST + 74)
  3346. #define ListView_SetToolTips(hwndLV, hwndNewHwnd)\
  3347.         (HWND)SendMessage((hwndLV), LVM_SETTOOLTIPS, hwndNewHwnd, 0)
  3348.  
  3349. #define LVM_GETTOOLTIPS       (LVM_FIRST + 78)
  3350. #define ListView_GetToolTips(hwndLV)\
  3351.         (HWND)SendMessage((hwndLV), LVM_GETTOOLTIPS, 0, 0)
  3352.  
  3353.  
  3354. typedef struct tagLVBKIMAGEA
  3355. {
  3356.     ULONG ulFlags;              // LVBKIF_*
  3357.     HBITMAP hbm;
  3358.     LPSTR pszImage;
  3359.     UINT cchImageMax;
  3360.     int xOffsetPercent;
  3361.     int yOffsetPercent;
  3362. } LVBKIMAGEA, FAR *LPLVBKIMAGEA;
  3363. typedef struct tagLVBKIMAGEW
  3364. {
  3365.     ULONG ulFlags;              // LVBKIF_*
  3366.     HBITMAP hbm;
  3367.     LPWSTR pszImage;
  3368.     UINT cchImageMax;
  3369.     int xOffsetPercent;
  3370.     int yOffsetPercent;
  3371. } LVBKIMAGEW, FAR *LPLVBKIMAGEW;
  3372.  
  3373. #define LVBKIF_SOURCE_NONE      0x00000000
  3374. #define LVBKIF_SOURCE_HBITMAP   0x00000001
  3375. #define LVBKIF_SOURCE_URL       0x00000002
  3376. #define LVBKIF_SOURCE_MASK      0x00000003
  3377. #define LVBKIF_STYLE_NORMAL     0x00000000
  3378. #define LVBKIF_STYLE_TILE       0x00000010
  3379. #define LVBKIF_STYLE_MASK       0x00000010
  3380.  
  3381. #define LVM_SETBKIMAGEA         (LVM_FIRST + 68)
  3382. #define LVM_SETBKIMAGEW         (LVM_FIRST + 138)
  3383. #define LVM_GETBKIMAGEA         (LVM_FIRST + 69)
  3384. #define LVM_GETBKIMAGEW         (LVM_FIRST + 139)
  3385.  
  3386. #ifdef UNICODE
  3387. #define LVBKIMAGE               LVBKIMAGEW
  3388. #define LPLVBKIMAGE             LPLVBKIMAGEW
  3389. #define LVM_SETBKIMAGE          LVM_SETBKIMAGEW
  3390. #define LVM_GETBKIMAGE          LVM_GETBKIMAGEW
  3391. #else
  3392. #define LVBKIMAGE               LVBKIMAGEA
  3393. #define LPLVBKIMAGE             LPLVBKIMAGEA
  3394. #define LVM_SETBKIMAGE          LVM_SETBKIMAGEA
  3395. #define LVM_GETBKIMAGE          LVM_GETBKIMAGEA
  3396. #endif
  3397.  
  3398. #define ListView_SetBkImage(hwnd, plvbki) \
  3399.     (BOOL)SNDMSG((hwnd), LVM_SETBKIMAGE, 0, (LPARAM)plvbki)
  3400.  
  3401. #define ListView_GetBkImage(hwnd, plvbki) \
  3402.     (BOOL)SNDMSG((hwnd), LVM_GETBKIMAGE, 0, (LPARAM)plvbki)
  3403.  
  3404.  
  3405. #endif      // _WIN32_IE >= 0x0400
  3406.  
  3407. #if (_WIN32_IE >= 0x0300)
  3408. #define LPNM_LISTVIEW   LPNMLISTVIEW
  3409. #define NM_LISTVIEW     NMLISTVIEW
  3410. #else
  3411. #define tagNMLISTVIEW   _NM_LISTVIEW
  3412. #define    NMLISTVIEW    NM_LISTVIEW
  3413. #define  LPNMLISTVIEW  LPNM_LISTVIEW
  3414. #endif
  3415.  
  3416. typedef struct tagNMLISTVIEW
  3417. {
  3418.     NMHDR   hdr;
  3419.     int     iItem;
  3420.     int     iSubItem;
  3421.     UINT    uNewState;
  3422.     UINT    uOldState;
  3423.     UINT    uChanged;
  3424.     POINT   ptAction;
  3425.     LPARAM  lParam;
  3426. } NMLISTVIEW, FAR *LPNMLISTVIEW;
  3427.  
  3428.  
  3429. #if (_WIN32_IE >= 0x400)
  3430. // NMITEMACTIVATE is used instead of NMLISTVIEW in IE >= 0x400
  3431. // therefore all the fields are the same except for extra uKeyFlags
  3432. // they are used to store key flags at the time of the single click with
  3433. // delayed activation - because by the time the timer goes off a user may
  3434. // not hold the keys (shift, ctrl) any more
  3435. typedef struct tagNMITEMACTIVATE
  3436. {
  3437.     NMHDR   hdr;
  3438.     int     iItem;
  3439.     int     iSubItem;
  3440.     UINT    uNewState;
  3441.     UINT    uOldState;
  3442.     UINT    uChanged;
  3443.     POINT   ptAction;
  3444.     LPARAM  lParam;
  3445.     UINT    uKeyFlags;
  3446. } NMITEMACTIVATE, FAR *LPNMITEMACTIVATE;
  3447.  
  3448. // key flags stored in uKeyFlags
  3449. #define LVKF_ALT       0x0001
  3450. #define LVKF_CONTROL   0x0002
  3451. #define LVKF_SHIFT     0x0004
  3452. #endif //(_WIN32_IE >= 0x0400)
  3453.  
  3454.  
  3455. #if (_WIN32_IE >= 0x0300)
  3456. #define NMLVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMLVCUSTOMDRW, clrTextBk)
  3457.  
  3458. typedef struct tagNMLVCUSTOMDRAW
  3459. {
  3460.     NMCUSTOMDRAW nmcd;
  3461.     COLORREF clrText;
  3462.     COLORREF clrTextBk;
  3463. #if (_WIN32_IE >= 0x0400)
  3464.     int iSubItem;
  3465. #endif
  3466. } NMLVCUSTOMDRAW, *LPNMLVCUSTOMDRAW;
  3467.  
  3468. typedef struct tagNMLVCACHEHINT
  3469. {
  3470.     NMHDR   hdr;
  3471.     int     iFrom;
  3472.     int     iTo;
  3473. } NMLVCACHEHINT, FAR *LPNMLVCACHEHINT;
  3474.  
  3475. #define LPNM_CACHEHINT  LPNMLVCACHEHINT
  3476. #define PNM_CACHEHINT   LPNMLVCACHEHINT
  3477. #define NM_CACHEHINT    NMLVCACHEHINT
  3478.  
  3479. typedef struct tagNMLVFINDITEM
  3480. {
  3481.     NMHDR   hdr;
  3482.     int     iStart;
  3483.     LVFINDINFO lvfi;
  3484. } NMLVFINDITEM, FAR *LPNMLVFINDITEM;
  3485.  
  3486. #define PNM_FINDITEM    LPNMLVFINDITEM
  3487. #define LPNM_FINDITEM   LPNMLVFINDITEM
  3488. #define NM_FINDITEM     NMLVFINDITEM
  3489.  
  3490. typedef struct tagNMLVODSTATECHANGE
  3491. {
  3492.     NMHDR hdr;
  3493.     int iFrom;
  3494.     int iTo;
  3495.     UINT uNewState;
  3496.     UINT uOldState;
  3497. } NMLVODSTATECHANGE, FAR *LPNMLVODSTATECHANGE;
  3498.  
  3499. #define PNM_ODSTATECHANGE   LPNMLVODSTATECHANGE
  3500. #define LPNM_ODSTATECHANGE  LPNMLVODSTATECHANGE
  3501. #define NM_ODSTATECHANGE    NMLVODSTATECHANGE
  3502. #endif      // _WIN32_IE >= 0x0300
  3503.  
  3504.  
  3505. #define LVN_ITEMCHANGING        (LVN_FIRST-0)
  3506. #define LVN_ITEMCHANGED         (LVN_FIRST-1)
  3507. #define LVN_INSERTITEM          (LVN_FIRST-2)
  3508. #define LVN_DELETEITEM          (LVN_FIRST-3)
  3509. #define LVN_DELETEALLITEMS      (LVN_FIRST-4)
  3510. #define LVN_BEGINLABELEDITA     (LVN_FIRST-5)
  3511. #define LVN_BEGINLABELEDITW     (LVN_FIRST-75)
  3512. #define LVN_ENDLABELEDITA       (LVN_FIRST-6)
  3513. #define LVN_ENDLABELEDITW       (LVN_FIRST-76)
  3514. #define LVN_COLUMNCLICK         (LVN_FIRST-8)
  3515. #define LVN_BEGINDRAG           (LVN_FIRST-9)
  3516. #define LVN_BEGINRDRAG          (LVN_FIRST-11)
  3517.  
  3518. #if (_WIN32_IE >= 0x0300)
  3519. #define LVN_ODCACHEHINT         (LVN_FIRST-13)
  3520. #define LVN_ODFINDITEMA         (LVN_FIRST-52)
  3521. #define LVN_ODFINDITEMW         (LVN_FIRST-79)
  3522.  
  3523. #define LVN_ITEMACTIVATE        (LVN_FIRST-14)
  3524. #define LVN_ODSTATECHANGED      (LVN_FIRST-15)
  3525.  
  3526. #ifdef UNICODE
  3527. #define LVN_ODFINDITEM          LVN_ODFINDITEMW
  3528. #else
  3529. #define LVN_ODFINDITEM          LVN_ODFINDITEMA
  3530. #endif
  3531. #endif      // _WIN32_IE >= 0x0300
  3532.  
  3533.  
  3534. #if (_WIN32_IE >= 0x0400)
  3535. #define LVN_HOTTRACK            (LVN_FIRST-21)
  3536. #endif
  3537.  
  3538. #define LVN_GETDISPINFOA        (LVN_FIRST-50)
  3539. #define LVN_GETDISPINFOW        (LVN_FIRST-77)
  3540. #define LVN_SETDISPINFOA        (LVN_FIRST-51)
  3541. #define LVN_SETDISPINFOW        (LVN_FIRST-78)
  3542.  
  3543. #ifdef UNICODE
  3544. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITW
  3545. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITW
  3546. #define LVN_GETDISPINFO         LVN_GETDISPINFOW
  3547. #define LVN_SETDISPINFO         LVN_SETDISPINFOW
  3548. #else
  3549. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITA
  3550. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITA
  3551. #define LVN_GETDISPINFO         LVN_GETDISPINFOA
  3552. #define LVN_SETDISPINFO         LVN_SETDISPINFOA
  3553. #endif
  3554.  
  3555.  
  3556. #define LVIF_DI_SETITEM         0x1000
  3557.  
  3558. #if (_WIN32_IE >= 0x0300)
  3559. #define LV_DISPINFOA    NMLVDISPINFOA
  3560. #define LV_DISPINFOW    NMLVDISPINFOW
  3561. #else
  3562. #define tagLVDISPINFO   _LV_DISPINFO
  3563. #define NMLVDISPINFOA    LV_DISPINFOA
  3564. #define tagLVDISPINFOW  _LV_DISPINFOW
  3565. #define NMLVDISPINFOW    LV_DISPINFOW
  3566. #endif
  3567.  
  3568. #define LV_DISPINFO     NMLVDISPINFO
  3569.  
  3570. typedef struct tagLVDISPINFO {
  3571.     NMHDR hdr;
  3572.     LVITEMA item;
  3573. } NMLVDISPINFOA, FAR *LPNMLVDISPINFOA;
  3574.  
  3575. typedef struct tagLVDISPINFOW {
  3576.     NMHDR hdr;
  3577.     LVITEMW item;
  3578. } NMLVDISPINFOW, FAR * LPNMLVDISPINFOW;
  3579.  
  3580. #ifdef UNICODE
  3581. #define  NMLVDISPINFO           NMLVDISPINFOW
  3582. #else
  3583. #define  NMLVDISPINFO           NMLVDISPINFOA
  3584. #endif
  3585.  
  3586. #define LVN_KEYDOWN             (LVN_FIRST-55)
  3587.  
  3588. #if (_WIN32_IE >= 0x0300)
  3589. #define LV_KEYDOWN              NMLVKEYDOWN
  3590. #else
  3591. #define tagLVKEYDOWN            _LV_KEYDOWN
  3592. #define NMLVKEYDOWN              LV_KEYDOWN
  3593. #endif
  3594.  
  3595. typedef struct tagLVKEYDOWN
  3596. {
  3597.     NMHDR hdr;
  3598.     WORD wVKey;
  3599.     UINT flags;
  3600. } NMLVKEYDOWN, FAR *LPNMLVKEYDOWN;
  3601.  
  3602. #if (_WIN32_IE >= 0x0300)
  3603. #define LVN_MARQUEEBEGIN        (LVN_FIRST-56)
  3604. #endif
  3605.  
  3606. #if (_WIN32_IE >= 0x0400)
  3607. typedef struct tagNMLVGETINFOTIPA
  3608. {
  3609.     NMHDR hdr;
  3610.     DWORD dwFlags;
  3611.     LPSTR pszText;
  3612.     int cchTextMax;
  3613.     int iItem;
  3614.     int iSubItem;
  3615.     LPARAM lParam;
  3616. } NMLVGETINFOTIPA, *LPNMLVGETINFOTIPA;
  3617.  
  3618. typedef struct tagNMLVGETINFOTIPW
  3619. {
  3620.     NMHDR hdr;
  3621.     DWORD dwFlags;
  3622.     LPWSTR pszText;
  3623.     int cchTextMax;
  3624.     int iItem;
  3625.     int iSubItem;
  3626.     LPARAM lParam;
  3627. } NMLVGETINFOTIPW, *LPNMLVGETINFOTIPW;
  3628.  
  3629. // NMLVGETINFOTIPA.dwFlag values
  3630.  
  3631. #define LVGIT_UNFOLDED  0x0001
  3632.  
  3633. #define LVN_GETINFOTIPA          (LVN_FIRST-57)
  3634. #define LVN_GETINFOTIPW          (LVN_FIRST-58)
  3635.  
  3636. #ifdef UNICODE
  3637. #define LVN_GETINFOTIP          LVN_GETINFOTIPW
  3638. #define NMLVGETINFOTIP          NMLVGETINFOTIPW
  3639. #define LPNMLVGETINFOTIP        LPNMLVGETINFOTIPW
  3640. #else
  3641. #define LVN_GETINFOTIP          LVN_GETINFOTIPA
  3642. #define NMLVGETINFOTIP          NMLVGETINFOTIPA
  3643. #define LPNMLVGETINFOTIP        LPNMLVGETINFOTIPA
  3644. #endif
  3645.  
  3646.  
  3647. #endif      // _WIN32_IE >= 0x0400
  3648.  
  3649. #endif // NOLISTVIEW
  3650.  
  3651. //====== TREEVIEW CONTROL =====================================================
  3652.  
  3653. #ifndef NOTREEVIEW
  3654.  
  3655. #ifdef _WIN32
  3656. #define WC_TREEVIEWA            "SysTreeView32"
  3657. #define WC_TREEVIEWW            L"SysTreeView32"
  3658.  
  3659. #ifdef UNICODE
  3660. #define  WC_TREEVIEW            WC_TREEVIEWW
  3661. #else
  3662. #define  WC_TREEVIEW            WC_TREEVIEWA
  3663. #endif
  3664.  
  3665. #else
  3666. #define WC_TREEVIEW             "SysTreeView"
  3667. #endif
  3668.  
  3669. // begin_r_commctrl
  3670.  
  3671. #define TVS_HASBUTTONS          0x0001
  3672. #define TVS_HASLINES            0x0002
  3673. #define TVS_LINESATROOT         0x0004
  3674. #define TVS_EDITLABELS          0x0008
  3675. #define TVS_DISABLEDRAGDROP     0x0010
  3676. #define TVS_SHOWSELALWAYS       0x0020
  3677. #if (_WIN32_IE >= 0x0300)
  3678. #define TVS_RTLREADING          0x0040
  3679.  
  3680. #define TVS_NOTOOLTIPS          0x0080
  3681. #define TVS_CHECKBOXES          0x0100
  3682. #define TVS_TRACKSELECT         0x0200
  3683. #if (_WIN32_IE >= 0x0400)
  3684. #define TVS_SINGLEEXPAND        0x0400
  3685. #define TVS_INFOTIP             0x0800
  3686. #define TVS_FULLROWSELECT       0x1000
  3687. #define TVS_NOSCROLL            0x2000
  3688. #define TVS_NONEVENHEIGHT       0x4000
  3689. #endif
  3690.  
  3691. #endif
  3692.  
  3693. // end_r_commctrl
  3694.  
  3695. typedef struct _TREEITEM FAR* HTREEITEM;
  3696.  
  3697. #define TVIF_TEXT               0x0001
  3698. #define TVIF_IMAGE              0x0002
  3699. #define TVIF_PARAM              0x0004
  3700. #define TVIF_STATE              0x0008
  3701. #define TVIF_HANDLE             0x0010
  3702. #define TVIF_SELECTEDIMAGE      0x0020
  3703. #define TVIF_CHILDREN           0x0040
  3704. #if (_WIN32_IE >= 0x0400)
  3705. #define TVIF_INTEGRAL           0x0080
  3706. #endif
  3707. #define TVIS_SELECTED           0x0002
  3708. #define TVIS_CUT                0x0004
  3709. #define TVIS_DROPHILITED        0x0008
  3710. #define TVIS_BOLD               0x0010
  3711. #define TVIS_EXPANDED           0x0020
  3712. #define TVIS_EXPANDEDONCE       0x0040
  3713. #if (_WIN32_IE >= 0x0300)
  3714. #define TVIS_EXPANDPARTIAL      0x0080
  3715. #endif
  3716.  
  3717. #define TVIS_OVERLAYMASK        0x0F00
  3718. #define TVIS_STATEIMAGEMASK     0xF000
  3719. #define TVIS_USERMASK           0xF000
  3720.  
  3721. #define I_CHILDRENCALLBACK  (-1)
  3722.  
  3723. #if (_WIN32_IE >= 0x0300)
  3724. #define LPTV_ITEMW              LPTVITEMW
  3725. #define LPTV_ITEMA              LPTVITEMA
  3726. #define TV_ITEMW                TVITEMW
  3727. #define TV_ITEMA                TVITEMA
  3728. #else
  3729. #define tagTVITEMA             _TV_ITEMA
  3730. #define    TVITEMA              TV_ITEMA
  3731. #define  LPTVITEMA            LPTV_ITEMA
  3732. #define tagTVITEMW             _TV_ITEMW
  3733. #define    TVITEMW              TV_ITEMW
  3734. #define  LPTVITEMW            LPTV_ITEMW
  3735. #endif
  3736.  
  3737. #define LPTV_ITEM               LPTVITEM
  3738. #define TV_ITEM                 TVITEM
  3739.  
  3740. typedef struct tagTVITEMA {
  3741.     UINT      mask;
  3742.     HTREEITEM hItem;
  3743.     UINT      state;
  3744.     UINT      stateMask;
  3745.     LPSTR     pszText;
  3746.     int       cchTextMax;
  3747.     int       iImage;
  3748.     int       iSelectedImage;
  3749.     int       cChildren;
  3750.     LPARAM    lParam;
  3751. } TVITEMA, FAR *LPTVITEMA;
  3752.  
  3753. typedef struct tagTVITEMW {
  3754.     UINT      mask;
  3755.     HTREEITEM hItem;
  3756.     UINT      state;
  3757.     UINT      stateMask;
  3758.     LPWSTR    pszText;
  3759.     int       cchTextMax;
  3760.     int       iImage;
  3761.     int       iSelectedImage;
  3762.     int       cChildren;
  3763.     LPARAM    lParam;
  3764. } TVITEMW, FAR *LPTVITEMW;
  3765.  
  3766. #if (_WIN32_IE >= 0x0400)
  3767. // only used for Get and Set messages.  no notifies
  3768. typedef struct tagTVITEMEXA {
  3769.     UINT      mask;
  3770.     HTREEITEM hItem;
  3771.     UINT      state;
  3772.     UINT      stateMask;
  3773.     LPSTR     pszText;
  3774.     int       cchTextMax;
  3775.     int       iImage;
  3776.     int       iSelectedImage;
  3777.     int       cChildren;
  3778.     LPARAM    lParam;
  3779.     int       iIntegral;
  3780. } TVITEMEXA, FAR *LPTVITEMEXA;
  3781. // only used for Get and Set messages.  no notifies
  3782. typedef struct tagTVITEMEXW {
  3783.     UINT      mask;
  3784.     HTREEITEM hItem;
  3785.     UINT      state;
  3786.     UINT      stateMask;
  3787.     LPWSTR    pszText;
  3788.     int       cchTextMax;
  3789.     int       iImage;
  3790.     int       iSelectedImage;
  3791.     int       cChildren;
  3792.     LPARAM    lParam;
  3793.     int       iIntegral;
  3794. } TVITEMEXW, FAR *LPTVITEMEXW;
  3795. #ifdef UNICODE
  3796. typedef TVITEMEXW TVITEMEX;
  3797. typedef LPTVITEMEXW LPTVITEMEX;
  3798. #else
  3799. typedef TVITEMEXA TVITEMEX;
  3800. typedef LPTVITEMEXA LPTVITEMEX;
  3801. #endif // UNICODE
  3802.  
  3803. #endif
  3804.  
  3805. #ifdef UNICODE
  3806. #define  TVITEM                 TVITEMW
  3807. #define  LPTVITEM               LPTVITEMW
  3808. #else
  3809. #define  TVITEM                 TVITEMA
  3810. #define  LPTVITEM               LPTVITEMA
  3811. #endif
  3812.  
  3813.  
  3814. #define TVI_ROOT                ((HTREEITEM)0xFFFF0000)
  3815. #define TVI_FIRST               ((HTREEITEM)0xFFFF0001)
  3816. #define TVI_LAST                ((HTREEITEM)0xFFFF0002)
  3817. #define TVI_SORT                ((HTREEITEM)0xFFFF0003)
  3818.  
  3819. #if (_WIN32_IE >= 0x0300)
  3820. #define LPTV_INSERTSTRUCTA      LPTVINSERTSTRUCTA
  3821. #define LPTV_INSERTSTRUCTW      LPTVINSERTSTRUCTW
  3822. #define TV_INSERTSTRUCTA        TVINSERTSTRUCTA
  3823. #define TV_INSERTSTRUCTW        TVINSERTSTRUCTW
  3824. #else
  3825. #define tagTVINSERTSTRUCTA     _TV_INSERTSTRUCTA
  3826. #define    TVINSERTSTRUCTA      TV_INSERTSTRUCTA
  3827. #define  LPTVINSERTSTRUCTA    LPTV_INSERTSTRUCTA
  3828. #define tagTVINSERTSTRUCTW     _TV_INSERTSTRUCTW
  3829. #define    TVINSERTSTRUCTW      TV_INSERTSTRUCTW
  3830. #define  LPTVINSERTSTRUCTW    LPTV_INSERTSTRUCTW
  3831. #endif
  3832.  
  3833. #define TV_INSERTSTRUCT         TVINSERTSTRUCT
  3834. #define LPTV_INSERTSTRUCT       LPTVINSERTSTRUCT
  3835.  
  3836.  
  3837. #define TVINSERTSTRUCTA_V1_SIZE CCSIZEOF_STRUCT(TVINSERTSTRUCTA, item)
  3838. #define TVINSERTSTRUCTW_V1_SIZE CCSIZEOF_STRUCT(TVINSERTSTRUCTW, item)
  3839.  
  3840. typedef struct tagTVINSERTSTRUCTA {
  3841.     HTREEITEM hParent;
  3842.     HTREEITEM hInsertAfter;
  3843. #if (_WIN32_IE >= 0x0400)
  3844.     union
  3845.     {
  3846.         TVITEMEXA itemex;
  3847.         TV_ITEMA  item;
  3848.     } DUMMYUNIONNAME;
  3849. #else
  3850.     TV_ITEMA item;
  3851. #endif
  3852. } TVINSERTSTRUCTA, FAR *LPTVINSERTSTRUCTA;
  3853.  
  3854. typedef struct tagTVINSERTSTRUCTW {
  3855.     HTREEITEM hParent;
  3856.     HTREEITEM hInsertAfter;
  3857. #if (_WIN32_IE >= 0x0400)
  3858.     union
  3859.     {
  3860.         TVITEMEXW itemex;
  3861.         TV_ITEMW  item;
  3862.     } DUMMYUNIONNAME;
  3863. #else
  3864.     TV_ITEMW item;
  3865. #endif
  3866. } TVINSERTSTRUCTW, FAR *LPTVINSERTSTRUCTW;
  3867.  
  3868. #ifdef UNICODE
  3869. #define  TVINSERTSTRUCT         TVINSERTSTRUCTW
  3870. #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTW
  3871. #define TVINSERTSTRUCT_V1_SIZE TVINSERTSTRUCTW_V1_SIZE
  3872. #else
  3873. #define  TVINSERTSTRUCT         TVINSERTSTRUCTA
  3874. #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTA
  3875. #define TVINSERTSTRUCT_V1_SIZE TVINSERTSTRUCTA_V1_SIZE
  3876. #endif
  3877.  
  3878. #define TVM_INSERTITEMA         (TV_FIRST + 0)
  3879. #define TVM_INSERTITEMW         (TV_FIRST + 50)
  3880. #ifdef UNICODE
  3881. #define  TVM_INSERTITEM         TVM_INSERTITEMW
  3882. #else
  3883. #define  TVM_INSERTITEM         TVM_INSERTITEMA
  3884. #endif
  3885.  
  3886. #define TreeView_InsertItem(hwnd, lpis) \
  3887.     (HTREEITEM)SNDMSG((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis))
  3888.  
  3889.  
  3890. #define TVM_DELETEITEM          (TV_FIRST + 1)
  3891. #define TreeView_DeleteItem(hwnd, hitem) \
  3892.     (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem))
  3893.  
  3894.  
  3895. #define TreeView_DeleteAllItems(hwnd) \
  3896.     (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT)
  3897.  
  3898.  
  3899. #define TVM_EXPAND              (TV_FIRST + 2)
  3900. #define TreeView_Expand(hwnd, hitem, code) \
  3901.     (BOOL)SNDMSG((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  3902.  
  3903.  
  3904. #define TVE_COLLAPSE            0x0001
  3905. #define TVE_EXPAND              0x0002
  3906. #define TVE_TOGGLE              0x0003
  3907. #if (_WIN32_IE >= 0x0300)
  3908. #define TVE_EXPANDPARTIAL       0x4000
  3909. #endif
  3910. #define TVE_COLLAPSERESET       0x8000
  3911.  
  3912.  
  3913. #define TVM_GETITEMRECT         (TV_FIRST + 4)
  3914. #define TreeView_GetItemRect(hwnd, hitem, prc, code) \
  3915.     (*(HTREEITEM FAR *)prc = (hitem), (BOOL)SNDMSG((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT FAR*)(prc)))
  3916.  
  3917.  
  3918. #define TVM_GETCOUNT            (TV_FIRST + 5)
  3919. #define TreeView_GetCount(hwnd) \
  3920.     (UINT)SNDMSG((hwnd), TVM_GETCOUNT, 0, 0)
  3921.  
  3922.  
  3923. #define TVM_GETINDENT           (TV_FIRST + 6)
  3924. #define TreeView_GetIndent(hwnd) \
  3925.     (UINT)SNDMSG((hwnd), TVM_GETINDENT, 0, 0)
  3926.  
  3927.  
  3928. #define TVM_SETINDENT           (TV_FIRST + 7)
  3929. #define TreeView_SetIndent(hwnd, indent) \
  3930.     (BOOL)SNDMSG((hwnd), TVM_SETINDENT, (WPARAM)indent, 0)
  3931.  
  3932.  
  3933. #define TVM_GETIMAGELIST        (TV_FIRST + 8)
  3934. #define TreeView_GetImageList(hwnd, iImage) \
  3935.     (HIMAGELIST)SNDMSG((hwnd), TVM_GETIMAGELIST, iImage, 0)
  3936.  
  3937.  
  3938. #define TVSIL_NORMAL            0
  3939. #define TVSIL_STATE             2
  3940.  
  3941.  
  3942. #define TVM_SETIMAGELIST        (TV_FIRST + 9)
  3943. #define TreeView_SetImageList(hwnd, himl, iImage) \
  3944.     (HIMAGELIST)SNDMSG((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl))
  3945.  
  3946.  
  3947. #define TVM_GETNEXTITEM         (TV_FIRST + 10)
  3948. #define TreeView_GetNextItem(hwnd, hitem, code) \
  3949.     (HTREEITEM)SNDMSG((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  3950.  
  3951.  
  3952. #define TVGN_ROOT               0x0000
  3953. #define TVGN_NEXT               0x0001
  3954. #define TVGN_PREVIOUS           0x0002
  3955. #define TVGN_PARENT             0x0003
  3956. #define TVGN_CHILD              0x0004
  3957. #define TVGN_FIRSTVISIBLE       0x0005
  3958. #define TVGN_NEXTVISIBLE        0x0006
  3959. #define TVGN_PREVIOUSVISIBLE    0x0007
  3960. #define TVGN_DROPHILITE         0x0008
  3961. #define TVGN_CARET              0x0009
  3962. #if (_WIN32_IE >= 0x0400)
  3963. #define TVGN_LASTVISIBLE        0x000A
  3964. #endif      // _WIN32_IE >= 0x0400
  3965.  
  3966. #define TreeView_GetChild(hwnd, hitem)          TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)
  3967. #define TreeView_GetNextSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)
  3968. #define TreeView_GetPrevSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)
  3969. #define TreeView_GetParent(hwnd, hitem)         TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)
  3970. #define TreeView_GetFirstVisible(hwnd)          TreeView_GetNextItem(hwnd, NULL,  TVGN_FIRSTVISIBLE)
  3971. #define TreeView_GetNextVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE)
  3972. #define TreeView_GetPrevVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE)
  3973. #define TreeView_GetSelection(hwnd)             TreeView_GetNextItem(hwnd, NULL,  TVGN_CARET)
  3974. #define TreeView_GetDropHilight(hwnd)           TreeView_GetNextItem(hwnd, NULL,  TVGN_DROPHILITE)
  3975. #define TreeView_GetRoot(hwnd)                  TreeView_GetNextItem(hwnd, NULL,  TVGN_ROOT)
  3976. #if (_WIN32_IE >= 0x0400)
  3977. #define TreeView_GetLastVisible(hwnd)          TreeView_GetNextItem(hwnd, NULL,  TVGN_LASTVISIBLE)
  3978. #endif      // _WIN32_IE >= 0x0400
  3979.  
  3980.  
  3981. #define TVM_SELECTITEM          (TV_FIRST + 11)
  3982. #define TreeView_Select(hwnd, hitem, code) \
  3983.     (BOOL)SNDMSG((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  3984.  
  3985.  
  3986. #define TreeView_SelectItem(hwnd, hitem)            TreeView_Select(hwnd, hitem, TVGN_CARET)
  3987. #define TreeView_SelectDropTarget(hwnd, hitem)      TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
  3988. #define TreeView_SelectSetFirstVisible(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
  3989.  
  3990. #define TVM_GETITEMA            (TV_FIRST + 12)
  3991. #define TVM_GETITEMW            (TV_FIRST + 62)
  3992.  
  3993. #ifdef UNICODE
  3994. #define  TVM_GETITEM            TVM_GETITEMW
  3995. #else
  3996. #define  TVM_GETITEM            TVM_GETITEMA
  3997. #endif
  3998.  
  3999. #define TreeView_GetItem(hwnd, pitem) \
  4000.     (BOOL)SNDMSG((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM FAR*)(pitem))
  4001.  
  4002.  
  4003. #define TVM_SETITEMA            (TV_FIRST + 13)
  4004. #define TVM_SETITEMW            (TV_FIRST + 63)
  4005.  
  4006. #ifdef UNICODE
  4007. #define  TVM_SETITEM            TVM_SETITEMW
  4008. #else
  4009. #define  TVM_SETITEM            TVM_SETITEMA
  4010. #endif
  4011.  
  4012. #define TreeView_SetItem(hwnd, pitem) \
  4013.     (BOOL)SNDMSG((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM FAR*)(pitem))
  4014.  
  4015.  
  4016. #define TVM_EDITLABELA          (TV_FIRST + 14)
  4017. #define TVM_EDITLABELW          (TV_FIRST + 65)
  4018. #ifdef UNICODE
  4019. #define TVM_EDITLABEL           TVM_EDITLABELW
  4020. #else
  4021. #define TVM_EDITLABEL           TVM_EDITLABELA
  4022. #endif
  4023.  
  4024. #define TreeView_EditLabel(hwnd, hitem) \
  4025.     (HWND)SNDMSG((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
  4026.  
  4027.  
  4028. #define TVM_GETEDITCONTROL      (TV_FIRST + 15)
  4029. #define TreeView_GetEditControl(hwnd) \
  4030.     (HWND)SNDMSG((hwnd), TVM_GETEDITCONTROL, 0, 0)
  4031.  
  4032.  
  4033. #define TVM_GETVISIBLECOUNT     (TV_FIRST + 16)
  4034. #define TreeView_GetVisibleCount(hwnd) \
  4035.     (UINT)SNDMSG((hwnd), TVM_GETVISIBLECOUNT, 0, 0)
  4036.  
  4037.  
  4038. #define TVM_HITTEST             (TV_FIRST + 17)
  4039. #define TreeView_HitTest(hwnd, lpht) \
  4040.     (HTREEITEM)SNDMSG((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
  4041.  
  4042.  
  4043. #if (_WIN32_IE >= 0x0300)
  4044. #define LPTV_HITTESTINFO   LPTVHITTESTINFO
  4045. #define   TV_HITTESTINFO     TVHITTESTINFO
  4046. #else
  4047. #define tagTVHITTESTINFO    _TV_HITTESTINFO
  4048. #define    TVHITTESTINFO     TV_HITTESTINFO
  4049. #define  LPTVHITTESTINFO   LPTV_HITTESTINFO
  4050. #endif
  4051.  
  4052. typedef struct tagTVHITTESTINFO {
  4053.     POINT       pt;
  4054.     UINT        flags;
  4055.     HTREEITEM   hItem;
  4056. } TVHITTESTINFO, FAR *LPTVHITTESTINFO;
  4057.  
  4058. #define TVHT_NOWHERE            0x0001
  4059. #define TVHT_ONITEMICON         0x0002
  4060. #define TVHT_ONITEMLABEL        0x0004
  4061. #define TVHT_ONITEM             (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
  4062. #define TVHT_ONITEMINDENT       0x0008
  4063. #define TVHT_ONITEMBUTTON       0x0010
  4064. #define TVHT_ONITEMRIGHT        0x0020
  4065. #define TVHT_ONITEMSTATEICON    0x0040
  4066.  
  4067. #define TVHT_ABOVE              0x0100
  4068. #define TVHT_BELOW              0x0200
  4069. #define TVHT_TORIGHT            0x0400
  4070. #define TVHT_TOLEFT             0x0800
  4071.  
  4072.  
  4073. #define TVM_CREATEDRAGIMAGE     (TV_FIRST + 18)
  4074. #define TreeView_CreateDragImage(hwnd, hitem) \
  4075.     (HIMAGELIST)SNDMSG((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem))
  4076.  
  4077.  
  4078. #define TVM_SORTCHILDREN        (TV_FIRST + 19)
  4079. #define TreeView_SortChildren(hwnd, hitem, recurse) \
  4080.     (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem))
  4081.  
  4082.  
  4083. #define TVM_ENSUREVISIBLE       (TV_FIRST + 20)
  4084. #define TreeView_EnsureVisible(hwnd, hitem) \
  4085.     (BOOL)SNDMSG((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem))
  4086.  
  4087.  
  4088. #define TVM_SORTCHILDRENCB      (TV_FIRST + 21)
  4089. #define TreeView_SortChildrenCB(hwnd, psort, recurse) \
  4090.     (BOOL)SNDMSG((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \
  4091.     (LPARAM)(LPTV_SORTCB)(psort))
  4092.  
  4093.  
  4094. #define TVM_ENDEDITLABELNOW     (TV_FIRST + 22)
  4095. #define TreeView_EndEditLabelNow(hwnd, fCancel) \
  4096.     (BOOL)SNDMSG((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0)
  4097.  
  4098.  
  4099. #define TVM_GETISEARCHSTRINGA   (TV_FIRST + 23)
  4100. #define TVM_GETISEARCHSTRINGW   (TV_FIRST + 64)
  4101.  
  4102. #ifdef UNICODE
  4103. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGW
  4104. #else
  4105. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGA
  4106. #endif
  4107.  
  4108. #if (_WIN32_IE >= 0x0300)
  4109. #define TVM_SETTOOLTIPS         (TV_FIRST + 24)
  4110. #define TreeView_SetToolTips(hwnd,  hwndTT) \
  4111.     (HWND)SNDMSG((hwnd), TVM_SETTOOLTIPS, (WPARAM)hwndTT, 0)
  4112. #define TVM_GETTOOLTIPS         (TV_FIRST + 25)
  4113. #define TreeView_GetToolTips(hwnd) \
  4114.     (HWND)SNDMSG((hwnd), TVM_GETTOOLTIPS, 0, 0)
  4115. #endif
  4116.  
  4117. #define TreeView_GetISearchString(hwndTV, lpsz) \
  4118.         (BOOL)SNDMSG((hwndTV), TVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  4119.  
  4120. #if (_WIN32_IE >= 0x0400)
  4121. #define TVM_SETINSERTMARK       (TV_FIRST + 26)
  4122. #define TreeView_SetInsertMark(hwnd, hItem, fAfter) \
  4123.         (BOOL)SNDMSG((hwnd), TVM_SETINSERTMARK, (WPARAM) (fAfter), (LPARAM) (hItem))
  4124.  
  4125. #define TVM_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  4126. #define TreeView_SetUnicodeFormat(hwnd, fUnicode)  \
  4127.     (BOOL)SNDMSG((hwnd), TVM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0)
  4128.  
  4129. #define TVM_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  4130. #define TreeView_GetUnicodeFormat(hwnd)  \
  4131.     (BOOL)SNDMSG((hwnd), TVM_GETUNICODEFORMAT, 0, 0)
  4132.  
  4133. #endif
  4134.  
  4135. #if (_WIN32_IE >= 0x0400)
  4136. #define TVM_SETITEMHEIGHT         (TV_FIRST + 27)
  4137. #define TreeView_SetItemHeight(hwnd,  iHeight) \
  4138.     (int)SNDMSG((hwnd), TVM_SETITEMHEIGHT, (WPARAM)iHeight, 0)
  4139. #define TVM_GETITEMHEIGHT         (TV_FIRST + 28)
  4140. #define TreeView_GetItemHeight(hwnd) \
  4141.     (int)SNDMSG((hwnd), TVM_GETITEMHEIGHT, 0, 0)
  4142.  
  4143. #define TVM_SETBKCOLOR              (TV_FIRST + 29)
  4144. #define TreeView_SetBkColor(hwnd, clr) \
  4145.     (COLORREF)SNDMSG((hwnd), TVM_SETBKCOLOR, 0, (LPARAM)clr)
  4146.  
  4147. #define TVM_SETTEXTCOLOR              (TV_FIRST + 30)
  4148. #define TreeView_SetTextColor(hwnd, clr) \
  4149.     (COLORREF)SNDMSG((hwnd), TVM_SETTEXTCOLOR, 0, (LPARAM)clr)
  4150.  
  4151. #define TVM_GETBKCOLOR              (TV_FIRST + 31)
  4152. #define TreeView_GetBkColor(hwnd) \
  4153.     (COLORREF)SNDMSG((hwnd), TVM_GETBKCOLOR, 0, 0)
  4154.  
  4155. #define TVM_GETTEXTCOLOR              (TV_FIRST + 32)
  4156. #define TreeView_GetTextColor(hwnd) \
  4157.     (COLORREF)SNDMSG((hwnd), TVM_GETTEXTCOLOR, 0, 0)
  4158.  
  4159. #define TVM_SETSCROLLTIME              (TV_FIRST + 33)
  4160. #define TreeView_SetScrollTime(hwnd, uTime) \
  4161.     (UINT)SNDMSG((hwnd), TVM_SETSCROLLTIME, uTime, 0)
  4162.  
  4163. #define TVM_GETSCROLLTIME              (TV_FIRST + 34)
  4164. #define TreeView_GetScrollTime(hwnd) \
  4165.     (UINT)SNDMSG((hwnd), TVM_GETSCROLLTIME, 0, 0)
  4166.  
  4167.  
  4168. #if (_WIN32_IE >= 0x0400)
  4169. #define TVM_SETINSERTMARKCOLOR              (TV_FIRST + 37)
  4170. #define TreeView_SetInsertMarkColor(hwnd, clr) \
  4171.     (COLORREF)SNDMSG((hwnd), TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr)
  4172. #define TVM_GETINSERTMARKCOLOR              (TV_FIRST + 38)
  4173. #define TreeView_GetInsertMarkColor(hwnd) \
  4174.     (COLORREF)SNDMSG((hwnd), TVM_GETINSERTMARKCOLOR, 0, 0)
  4175. #endif  /* (_WIN32_IE >= 0x0400) */
  4176.  
  4177. #endif
  4178.  
  4179. typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  4180.  
  4181. #if (_WIN32_IE >= 0x0300)
  4182. #define LPTV_SORTCB    LPTVSORTCB
  4183. #define   TV_SORTCB      TVSORTCB
  4184. #else
  4185. #define tagTVSORTCB    _TV_SORTCB
  4186. #define    TVSORTCB     TV_SORTCB
  4187. #define  LPTVSORTCB   LPTV_SORTCB
  4188. #endif
  4189.  
  4190. typedef struct tagTVSORTCB
  4191. {
  4192.         HTREEITEM       hParent;
  4193.         PFNTVCOMPARE    lpfnCompare;
  4194.         LPARAM          lParam;
  4195. } TVSORTCB, FAR *LPTVSORTCB;
  4196.  
  4197.  
  4198. #if (_WIN32_IE >= 0x0300)
  4199. #define LPNM_TREEVIEWA          LPNMTREEVIEWA
  4200. #define LPNM_TREEVIEWW          LPNMTREEVIEWW
  4201. #define NM_TREEVIEWW            NMTREEVIEWW
  4202. #define NM_TREEVIEWA            NMTREEVIEWA
  4203. #else
  4204. #define tagNMTREEVIEWA          _NM_TREEVIEWA
  4205. #define tagNMTREEVIEWW          _NM_TREEVIEWW
  4206. #define NMTREEVIEWA             NM_TREEVIEWA
  4207. #define NMTREEVIEWW             NM_TREEVIEWW
  4208. #define LPNMTREEVIEWA           LPNM_TREEVIEWA
  4209. #define LPNMTREEVIEWW           LPNM_TREEVIEWW
  4210. #endif
  4211.  
  4212. #define LPNM_TREEVIEW           LPNMTREEVIEW
  4213. #define NM_TREEVIEW             NMTREEVIEW
  4214.  
  4215. typedef struct tagNMTREEVIEWA {
  4216.     NMHDR       hdr;
  4217.     UINT        action;
  4218.     TVITEMA    itemOld;
  4219.     TVITEMA    itemNew;
  4220.     POINT       ptDrag;
  4221. } NMTREEVIEWA, FAR *LPNMTREEVIEWA;
  4222.  
  4223.  
  4224. typedef struct tagNMTREEVIEWW {
  4225.     NMHDR       hdr;
  4226.     UINT        action;
  4227.     TVITEMW    itemOld;
  4228.     TVITEMW    itemNew;
  4229.     POINT       ptDrag;
  4230. } NMTREEVIEWW, FAR *LPNMTREEVIEWW;
  4231.  
  4232.  
  4233. #ifdef UNICODE
  4234. #define  NMTREEVIEW             NMTREEVIEWW
  4235. #define  LPNMTREEVIEW           LPNMTREEVIEWW
  4236. #else
  4237. #define  NMTREEVIEW             NMTREEVIEWA
  4238. #define  LPNMTREEVIEW           LPNMTREEVIEWA
  4239. #endif
  4240.  
  4241.  
  4242. #define TVN_SELCHANGINGA        (TVN_FIRST-1)
  4243. #define TVN_SELCHANGINGW        (TVN_FIRST-50)
  4244. #define TVN_SELCHANGEDA         (TVN_FIRST-2)
  4245. #define TVN_SELCHANGEDW         (TVN_FIRST-51)
  4246.  
  4247. #define TVC_UNKNOWN             0x0000
  4248. #define TVC_BYMOUSE             0x0001
  4249. #define TVC_BYKEYBOARD          0x0002
  4250.  
  4251. #define TVN_GETDISPINFOA        (TVN_FIRST-3)
  4252. #define TVN_GETDISPINFOW        (TVN_FIRST-52)
  4253. #define TVN_SETDISPINFOA        (TVN_FIRST-4)
  4254. #define TVN_SETDISPINFOW        (TVN_FIRST-53)
  4255.  
  4256. #define TVIF_DI_SETITEM         0x1000
  4257.  
  4258. #if (_WIN32_IE >= 0x0300)
  4259. #define TV_DISPINFOA            NMTVDISPINFOA
  4260. #define TV_DISPINFOW            NMTVDISPINFOW
  4261. #else
  4262. #define tagTVDISPINFOA  _TV_DISPINFOA
  4263. #define NMTVDISPINFOA    TV_DISPINFOA
  4264. #define tagTVDISPINFOW  _TV_DISPINFOW
  4265. #define NMTVDISPINFOW    TV_DISPINFOW
  4266. #endif
  4267.  
  4268. #define TV_DISPINFO             NMTVDISPINFO
  4269.  
  4270. typedef struct tagTVDISPINFOA {
  4271.     NMHDR hdr;
  4272.     TVITEMA item;
  4273. } NMTVDISPINFOA, FAR *LPNMTVDISPINFOA;
  4274.  
  4275. typedef struct tagTVDISPINFOW {
  4276.     NMHDR hdr;
  4277.     TVITEMW item;
  4278. } NMTVDISPINFOW, FAR *LPNMTVDISPINFOW;
  4279.  
  4280.  
  4281. #ifdef UNICODE
  4282. #define NMTVDISPINFO            NMTVDISPINFOW
  4283. #define LPNMTVDISPINFO          LPNMTVDISPINFOW
  4284. #else
  4285. #define NMTVDISPINFO            NMTVDISPINFOA
  4286. #define LPNMTVDISPINFO          LPNMTVDISPINFOA
  4287. #endif
  4288.  
  4289. #define TVN_ITEMEXPANDINGA      (TVN_FIRST-5)
  4290. #define TVN_ITEMEXPANDINGW      (TVN_FIRST-54)
  4291. #define TVN_ITEMEXPANDEDA       (TVN_FIRST-6)
  4292. #define TVN_ITEMEXPANDEDW       (TVN_FIRST-55)
  4293. #define TVN_BEGINDRAGA          (TVN_FIRST-7)
  4294. #define TVN_BEGINDRAGW          (TVN_FIRST-56)
  4295. #define TVN_BEGINRDRAGA         (TVN_FIRST-8)
  4296. #define TVN_BEGINRDRAGW         (TVN_FIRST-57)
  4297. #define TVN_DELETEITEMA         (TVN_FIRST-9)
  4298. #define TVN_DELETEITEMW         (TVN_FIRST-58)
  4299. #define TVN_BEGINLABELEDITA     (TVN_FIRST-10)
  4300. #define TVN_BEGINLABELEDITW     (TVN_FIRST-59)
  4301. #define TVN_ENDLABELEDITA       (TVN_FIRST-11)
  4302. #define TVN_ENDLABELEDITW       (TVN_FIRST-60)
  4303. #define TVN_KEYDOWN             (TVN_FIRST-12)
  4304.  
  4305. #if (_WIN32_IE >= 0x0400)
  4306. #define TVN_GETINFOTIPA         (TVN_FIRST-13)
  4307. #define TVN_GETINFOTIPW         (TVN_FIRST-14)
  4308. #define TVN_SINGLEEXPAND        (TVN_FIRST-15)
  4309. #endif // 0x400
  4310.  
  4311.  
  4312. #if (_WIN32_IE >= 0x0300)
  4313. #define TV_KEYDOWN      NMTVKEYDOWN
  4314. #else
  4315. #define tagTVKEYDOWN    _TV_KEYDOWN
  4316. #define  NMTVKEYDOWN     TV_KEYDOWN
  4317. #endif
  4318.  
  4319. typedef struct tagTVKEYDOWN {
  4320.     NMHDR hdr;
  4321.     WORD wVKey;
  4322.     UINT flags;
  4323. } NMTVKEYDOWN, FAR *LPNMTVKEYDOWN;
  4324.  
  4325.  
  4326. #ifdef UNICODE
  4327. #define TVN_SELCHANGING         TVN_SELCHANGINGW
  4328. #define TVN_SELCHANGED          TVN_SELCHANGEDW
  4329. #define TVN_GETDISPINFO         TVN_GETDISPINFOW
  4330. #define TVN_SETDISPINFO         TVN_SETDISPINFOW
  4331. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGW
  4332. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDW
  4333. #define TVN_BEGINDRAG           TVN_BEGINDRAGW
  4334. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGW
  4335. #define TVN_DELETEITEM          TVN_DELETEITEMW
  4336. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITW
  4337. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITW
  4338. #else
  4339. #define TVN_SELCHANGING         TVN_SELCHANGINGA
  4340. #define TVN_SELCHANGED          TVN_SELCHANGEDA
  4341. #define TVN_GETDISPINFO         TVN_GETDISPINFOA
  4342. #define TVN_SETDISPINFO         TVN_SETDISPINFOA
  4343. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGA
  4344. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDA
  4345. #define TVN_BEGINDRAG           TVN_BEGINDRAGA
  4346. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGA
  4347. #define TVN_DELETEITEM          TVN_DELETEITEMA
  4348. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITA
  4349. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITA
  4350. #endif
  4351.  
  4352. #if (_WIN32_IE >= 0x0300)
  4353. #define NMTVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMTVCUSTOMDRAW, clrTextBk)
  4354.  
  4355. typedef struct tagNMTVCUSTOMDRAW
  4356. {
  4357.     NMCUSTOMDRAW nmcd;
  4358.     COLORREF     clrText;
  4359.     COLORREF     clrTextBk;
  4360. #if (_WIN32_IE >= 0x0400)
  4361.     int iLevel;
  4362. #endif
  4363. } NMTVCUSTOMDRAW, *LPNMTVCUSTOMDRAW;
  4364. #endif
  4365.  
  4366.  
  4367. #if (_WIN32_IE >= 0x0400)
  4368.  
  4369. // for tooltips
  4370.  
  4371. typedef struct tagNMTVGETINFOTIPA
  4372. {
  4373.     NMHDR hdr;
  4374.     LPSTR pszText;
  4375.     int cchTextMax;
  4376.     HTREEITEM hItem;
  4377.     LPARAM lParam;
  4378. } NMTVGETINFOTIPA, *LPNMTVGETINFOTIPA;
  4379.  
  4380. typedef struct tagNMTVGETINFOTIPW
  4381. {
  4382.     NMHDR hdr;
  4383.     LPWSTR pszText;
  4384.     int cchTextMax;
  4385.     HTREEITEM hItem;
  4386.     LPARAM lParam;
  4387. } NMTVGETINFOTIPW, *LPNMTVGETINFOTIPW;
  4388.  
  4389.  
  4390. #ifdef UNICODE
  4391. #define TVN_GETINFOTIP          TVN_GETINFOTIPW
  4392. #define NMTVGETINFOTIP          NMTVGETINFOTIPW
  4393. #define LPNMTVGETINFOTIP        LPNMTVGETINFOTIPW
  4394. #else
  4395. #define TVN_GETINFOTIP          TVN_GETINFOTIPA
  4396. #define NMTVGETINFOTIP          NMTVGETINFOTIPA
  4397. #define LPNMTVGETINFOTIP        LPNMTVGETINFOTIPA
  4398. #endif
  4399.  
  4400. // treeview's customdraw return meaning don't draw images.  valid on CDRF_NOTIFYITEMPREPAINT
  4401. #define TVCDRF_NOIMAGES         0x00010000
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408. #endif      // _WIN32_IE >= 0x0400
  4409.  
  4410. #endif      // NOTREEVIEW
  4411.  
  4412. #if (_WIN32_IE >= 0x0300)
  4413.  
  4414. #ifndef NOUSEREXCONTROLS
  4415.  
  4416. ////////////////////  ComboBoxEx ////////////////////////////////
  4417.  
  4418.  
  4419. #define WC_COMBOBOXEXW         L"ComboBoxEx32"
  4420. #define WC_COMBOBOXEXA         "ComboBoxEx32"
  4421.  
  4422. #ifdef UNICODE
  4423. #define WC_COMBOBOXEX          WC_COMBOBOXEXW
  4424. #else
  4425. #define WC_COMBOBOXEX          WC_COMBOBOXEXA
  4426. #endif
  4427.  
  4428.  
  4429. #define CBEIF_TEXT              0x00000001
  4430. #define CBEIF_IMAGE             0x00000002
  4431. #define CBEIF_SELECTEDIMAGE     0x00000004
  4432. #define CBEIF_OVERLAY           0x00000008
  4433. #define CBEIF_INDENT            0x00000010
  4434. #define CBEIF_LPARAM            0x00000020
  4435.  
  4436. #define CBEIF_DI_SETITEM        0x10000000
  4437.  
  4438. typedef struct tagCOMBOBOXEXITEMA
  4439. {
  4440.     UINT mask;
  4441.     int iItem;
  4442.     LPSTR pszText;
  4443.     int cchTextMax;
  4444.     int iImage;
  4445.     int iSelectedImage;
  4446.     int iOverlay;
  4447.     int iIndent;
  4448.     LPARAM lParam;
  4449. } COMBOBOXEXITEMA, *PCOMBOBOXEXITEMA;
  4450. typedef COMBOBOXEXITEMA CONST *PCCOMBOEXITEMA;
  4451.  
  4452.  
  4453. typedef struct tagCOMBOBOXEXITEMW
  4454. {
  4455.     UINT mask;
  4456.     int iItem;
  4457.     LPWSTR pszText;
  4458.     int cchTextMax;
  4459.     int iImage;
  4460.     int iSelectedImage;
  4461.     int iOverlay;
  4462.     int iIndent;
  4463.     LPARAM lParam;
  4464. } COMBOBOXEXITEMW, *PCOMBOBOXEXITEMW;
  4465. typedef COMBOBOXEXITEMW CONST *PCCOMBOEXITEMW;
  4466.  
  4467. #ifdef UNICODE
  4468. #define COMBOBOXEXITEM            COMBOBOXEXITEMW
  4469. #define PCOMBOBOXEXITEM           PCOMBOBOXEXITEMW
  4470. #define PCCOMBOBOXEXITEM          PCCOMBOBOXEXITEMW
  4471. #else
  4472. #define COMBOBOXEXITEM            COMBOBOXEXITEMA
  4473. #define PCOMBOBOXEXITEM           PCOMBOBOXEXITEMA
  4474. #define PCCOMBOBOXEXITEM          PCCOMBOBOXEXITEMA
  4475. #endif
  4476.  
  4477. #define CBEM_INSERTITEMA        (WM_USER + 1)
  4478. #define CBEM_SETIMAGELIST       (WM_USER + 2)
  4479. #define CBEM_GETIMAGELIST       (WM_USER + 3)
  4480. #define CBEM_GETITEMA           (WM_USER + 4)
  4481. #define CBEM_SETITEMA           (WM_USER + 5)
  4482. #define CBEM_DELETEITEM         CB_DELETESTRING
  4483. #define CBEM_GETCOMBOCONTROL    (WM_USER + 6)
  4484. #define CBEM_GETEDITCONTROL     (WM_USER + 7)
  4485. #if (_WIN32_IE >= 0x0400)
  4486. #define CBEM_SETEXSTYLE         (WM_USER + 8)  // use  SETEXTENDEDSTYLE instead
  4487. #define CBEM_SETEXTENDEDSTYLE   (WM_USER + 14)   // lparam == new style, wParam (optional) == mask
  4488. #define CBEM_GETEXSTYLE         (WM_USER + 9) // use GETEXTENDEDSTYLE instead
  4489. #define CBEM_GETEXTENDEDSTYLE   (WM_USER + 9)
  4490. #define CBEM_SETUNICODEFORMAT   CCM_SETUNICODEFORMAT
  4491. #define CBEM_GETUNICODEFORMAT   CCM_GETUNICODEFORMAT
  4492. #else
  4493. #define CBEM_SETEXSTYLE         (WM_USER + 8)
  4494. #define CBEM_GETEXSTYLE         (WM_USER + 9)
  4495. #endif
  4496. #define CBEM_HASEDITCHANGED     (WM_USER + 10)
  4497. #define CBEM_INSERTITEMW        (WM_USER + 11)
  4498. #define CBEM_SETITEMW           (WM_USER + 12)
  4499. #define CBEM_GETITEMW           (WM_USER + 13)
  4500.  
  4501. #ifdef UNICODE
  4502. #define CBEM_INSERTITEM         CBEM_INSERTITEMW
  4503. #define CBEM_SETITEM            CBEM_SETITEMW
  4504. #define CBEM_GETITEM            CBEM_GETITEMW
  4505. #else
  4506. #define CBEM_INSERTITEM         CBEM_INSERTITEMA
  4507. #define CBEM_SETITEM            CBEM_SETITEMA
  4508. #define CBEM_GETITEM            CBEM_GETITEMA
  4509. #endif
  4510.  
  4511. #define CBES_EX_NOEDITIMAGE          0x00000001
  4512. #define CBES_EX_NOEDITIMAGEINDENT    0x00000002
  4513. #define CBES_EX_PATHWORDBREAKPROC    0x00000004
  4514. #if (_WIN32_IE >= 0x0400)
  4515. #define CBES_EX_NOSIZELIMIT          0x00000008
  4516. #define CBES_EX_CASESENSITIVE        0x00000010
  4517.  
  4518. typedef struct {
  4519.     NMHDR hdr;
  4520.     COMBOBOXEXITEMA ceItem;
  4521. } NMCOMBOBOXEXA, *PNMCOMBOBOXEXA;
  4522.  
  4523. typedef struct {
  4524.     NMHDR hdr;
  4525.     COMBOBOXEXITEMW ceItem;
  4526. } NMCOMBOBOXEXW, *PNMCOMBOBOXEXW;
  4527.  
  4528. #ifdef UNICODE
  4529. #define NMCOMBOBOXEX            NMCOMBOBOXEXW
  4530. #define PNMCOMBOBOXEX           PNMCOMBOBOXEXW
  4531. #define CBEN_GETDISPINFO        CBEN_GETDISPINFOW
  4532. #else
  4533. #define NMCOMBOBOXEX            NMCOMBOBOXEXA
  4534. #define PNMCOMBOBOXEX           PNMCOMBOBOXEXA
  4535. #define CBEN_GETDISPINFO        CBEN_GETDISPINFOA
  4536. #endif
  4537.  
  4538. #else
  4539. typedef struct {
  4540.     NMHDR hdr;
  4541.     COMBOBOXEXITEM ceItem;
  4542. } NMCOMBOBOXEX, *PNMCOMBOBOXEX;
  4543.  
  4544. #define CBEN_GETDISPINFO         (CBEN_FIRST - 0)
  4545.  
  4546. #endif      // _WIN32_IE >= 0x0400
  4547.  
  4548. #if (_WIN32_IE >= 0x0400)
  4549. #define CBEN_GETDISPINFOA        (CBEN_FIRST - 0)
  4550. #endif
  4551. #define CBEN_INSERTITEM          (CBEN_FIRST - 1)
  4552. #define CBEN_DELETEITEM          (CBEN_FIRST - 2)
  4553. #define CBEN_BEGINEDIT           (CBEN_FIRST - 4)
  4554. #define CBEN_ENDEDITA            (CBEN_FIRST - 5)
  4555. #define CBEN_ENDEDITW            (CBEN_FIRST - 6)
  4556.  
  4557. #if (_WIN32_IE >= 0x0400)
  4558. #define CBEN_GETDISPINFOW        (CBEN_FIRST - 7)
  4559. #endif
  4560.  
  4561. #if (_WIN32_IE >= 0x0400)
  4562. #define CBEN_DRAGBEGINA             (CBEN_FIRST - 8)
  4563. #define CBEN_DRAGBEGINW             (CBEN_FIRST - 9)
  4564.  
  4565. #ifdef UNICODE
  4566. #define CBEN_DRAGBEGIN CBEN_DRAGBEGINW
  4567. #else
  4568. #define CBEN_DRAGBEGIN CBEN_DRAGBEGINA
  4569. #endif
  4570.  
  4571. #endif    //(_WIN32_IE >= 0x0400)
  4572.  
  4573. // lParam specifies why the endedit is happening
  4574. #ifdef UNICODE
  4575. #define CBEN_ENDEDIT CBEN_ENDEDITW
  4576. #else
  4577. #define CBEN_ENDEDIT CBEN_ENDEDITA
  4578. #endif
  4579.  
  4580. #define CBENF_KILLFOCUS         1
  4581. #define CBENF_RETURN            2
  4582. #define CBENF_ESCAPE            3
  4583. #define CBENF_DROPDOWN          4
  4584.  
  4585. #define CBEMAXSTRLEN 260
  4586.  
  4587. #if (_WIN32_IE >= 0x0400)
  4588. // CBEN_DRAGBEGIN sends this information ...
  4589.  
  4590. typedef struct {
  4591.     NMHDR hdr;
  4592.     int   iItemid;
  4593.     WCHAR szText[CBEMAXSTRLEN];
  4594. }NMCBEDRAGBEGINW, *LPNMCBEDRAGBEGINW, *PNMCBEDRAGBEGINW;
  4595.  
  4596.  
  4597. typedef struct {
  4598.     NMHDR hdr;
  4599.     int   iItemid;
  4600.     char szText[CBEMAXSTRLEN];
  4601. }NMCBEDRAGBEGINA, *LPNMCBEDRAGBEGINA, *PNMCBEDRAGBEGINA;
  4602.  
  4603. #ifdef UNICODE
  4604. #define  NMCBEDRAGBEGIN NMCBEDRAGBEGINW
  4605. #define  LPNMCBEDRAGBEGIN LPNMCBEDRAGBEGINW
  4606. #define  PNMCBEDRAGBEGIN PNMCBEDRAGBEGINW
  4607. #else
  4608. #define  NMCBEDRAGBEGIN NMCBEDRAGBEGINA
  4609. #define  LPNMCBEDRAGBEGIN LPNMCBEDRAGBEGINA
  4610. #define  PNMCBEDRAGBEGIN PNMCBEDRAGBEGINA
  4611. #endif
  4612. #endif      // _WIN32_IE >= 0x0400
  4613.  
  4614. // CBEN_ENDEDIT sends this information...
  4615. // fChanged if the user actually did anything
  4616. // iNewSelection gives what would be the new selection unless the notify is failed
  4617. //                      iNewSelection may be CB_ERR if there's no match
  4618. typedef struct {
  4619.         NMHDR hdr;
  4620.         BOOL fChanged;
  4621.         int iNewSelection;
  4622.         WCHAR szText[CBEMAXSTRLEN];
  4623.         int iWhy;
  4624. } NMCBEENDEDITW, *LPNMCBEENDEDITW, *PNMCBEENDEDITW;
  4625.  
  4626. typedef struct {
  4627.         NMHDR hdr;
  4628.         BOOL fChanged;
  4629.         int iNewSelection;
  4630.         char szText[CBEMAXSTRLEN];
  4631.         int iWhy;
  4632. } NMCBEENDEDITA, *LPNMCBEENDEDITA,*PNMCBEENDEDITA;
  4633.  
  4634. #ifdef UNICODE
  4635. #define  NMCBEENDEDIT NMCBEENDEDITW
  4636. #define  LPNMCBEENDEDIT LPNMCBEENDEDITW
  4637. #define  PNMCBEENDEDIT PNMCBEENDEDITW
  4638. #else
  4639. #define  NMCBEENDEDIT NMCBEENDEDITA
  4640. #define  LPNMCBEENDEDIT LPNMCBEENDEDITA
  4641. #define  PNMCBEENDEDIT PNMCBEENDEDITA
  4642. #endif
  4643.  
  4644. #endif
  4645.  
  4646. #endif      // _WIN32_IE >= 0x0300
  4647.  
  4648.  
  4649. //====== TAB CONTROL ==========================================================
  4650.  
  4651. #ifndef NOTABCONTROL
  4652.  
  4653. #ifdef _WIN32
  4654.  
  4655. #define WC_TABCONTROLA          "SysTabControl32"
  4656. #define WC_TABCONTROLW          L"SysTabControl32"
  4657.  
  4658. #ifdef UNICODE
  4659. #define  WC_TABCONTROL          WC_TABCONTROLW
  4660. #else
  4661. #define  WC_TABCONTROL          WC_TABCONTROLA
  4662. #endif
  4663.  
  4664. #else
  4665. #define WC_TABCONTROL           "SysTabControl"
  4666. #endif
  4667.  
  4668. // begin_r_commctrl
  4669.  
  4670. #if (_WIN32_IE >= 0x0300)
  4671. #define TCS_SCROLLOPPOSITE      0x0001   // assumes multiline tab
  4672. #define TCS_BOTTOM              0x0002
  4673. #define TCS_RIGHT               0x0002
  4674. #define TCS_MULTISELECT         0x0004  // allow multi-select in button mode
  4675. #endif
  4676. #if (_WIN32_IE >= 0x0400)
  4677. #define TCS_FLATBUTTONS         0x0008
  4678. #endif
  4679. #define TCS_FORCEICONLEFT       0x0010
  4680. #define TCS_FORCELABELLEFT      0x0020
  4681. #if (_WIN32_IE >= 0x0300)
  4682. #define TCS_HOTTRACK            0x0040
  4683. #define TCS_VERTICAL            0x0080
  4684. #endif
  4685. #define TCS_TABS                0x0000
  4686. #define TCS_BUTTONS             0x0100
  4687. #define TCS_SINGLELINE          0x0000
  4688. #define TCS_MULTILINE           0x0200
  4689. #define TCS_RIGHTJUSTIFY        0x0000
  4690. #define TCS_FIXEDWIDTH          0x0400
  4691. #define TCS_RAGGEDRIGHT         0x0800
  4692. #define TCS_FOCUSONBUTTONDOWN   0x1000
  4693. #define TCS_OWNERDRAWFIXED      0x2000
  4694. #define TCS_TOOLTIPS            0x4000
  4695. #define TCS_FOCUSNEVER          0x8000
  4696.  
  4697. #if (_WIN32_IE >= 0x0400)
  4698. // EX styles for use with TCM_SETEXTENDEDSTYLE
  4699. #define TCS_EX_FLATSEPARATORS   0x00000001
  4700. #define TCS_EX_REGISTERDROP     0x00000002
  4701. #endif
  4702.  
  4703. // end_r_commctrl
  4704.  
  4705.  
  4706. #define TCM_GETIMAGELIST        (TCM_FIRST + 2)
  4707. #define TabCtrl_GetImageList(hwnd) \
  4708.     (HIMAGELIST)SNDMSG((hwnd), TCM_GETIMAGELIST, 0, 0L)
  4709.  
  4710.  
  4711. #define TCM_SETIMAGELIST        (TCM_FIRST + 3)
  4712. #define TabCtrl_SetImageList(hwnd, himl) \
  4713.     (HIMAGELIST)SNDMSG((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl))
  4714.  
  4715.  
  4716. #define TCM_GETITEMCOUNT        (TCM_FIRST + 4)
  4717. #define TabCtrl_GetItemCount(hwnd) \
  4718.     (int)SNDMSG((hwnd), TCM_GETITEMCOUNT, 0, 0L)
  4719.  
  4720.  
  4721. #define TCIF_TEXT               0x0001
  4722. #define TCIF_IMAGE              0x0002
  4723. #define TCIF_RTLREADING         0x0004
  4724. #define TCIF_PARAM              0x0008
  4725. #if (_WIN32_IE >= 0x0300)
  4726. #define TCIF_STATE              0x0010
  4727.  
  4728.  
  4729. #define TCIS_BUTTONPRESSED      0x0001
  4730. #endif
  4731. #if (_WIN32_IE >= 0x0400)
  4732. #define TCIS_HIGHLIGHTED        0x0002
  4733. #endif
  4734.  
  4735. #if (_WIN32_IE >= 0x0300)
  4736. #define TC_ITEMHEADERA         TCITEMHEADERA
  4737. #define TC_ITEMHEADERW         TCITEMHEADERW
  4738. #else
  4739. #define tagTCITEMHEADERA       _TC_ITEMHEADERA
  4740. #define    TCITEMHEADERA        TC_ITEMHEADERA
  4741. #define tagTCITEMHEADERW       _TC_ITEMHEADERW
  4742. #define    TCITEMHEADERW        TC_ITEMHEADERW
  4743. #endif
  4744. #define TC_ITEMHEADER          TCITEMHEADER
  4745.  
  4746. typedef struct tagTCITEMHEADERA
  4747. {
  4748.     UINT mask;
  4749.     UINT lpReserved1;
  4750.     UINT lpReserved2;
  4751.     LPSTR pszText;
  4752.     int cchTextMax;
  4753.     int iImage;
  4754. } TCITEMHEADERA, FAR *LPTCITEMHEADERA;
  4755.  
  4756. typedef struct tagTCITEMHEADERW
  4757. {
  4758.     UINT mask;
  4759.     UINT lpReserved1;
  4760.     UINT lpReserved2;
  4761.     LPWSTR pszText;
  4762.     int cchTextMax;
  4763.     int iImage;
  4764. } TCITEMHEADERW, FAR *LPTCITEMHEADERW;
  4765.  
  4766. #ifdef UNICODE
  4767. #define  TCITEMHEADER          TCITEMHEADERW
  4768. #define  LPTCITEMHEADER        LPTCITEMHEADERW
  4769. #else
  4770. #define  TCITEMHEADER          TCITEMHEADERA
  4771. #define  LPTCITEMHEADER        LPTCITEMHEADERA
  4772. #endif
  4773.  
  4774.  
  4775. #if (_WIN32_IE >= 0x0300)
  4776. #define TC_ITEMA                TCITEMA
  4777. #define TC_ITEMW                TCITEMW
  4778. #else
  4779. #define tagTCITEMA              _TC_ITEMA
  4780. #define    TCITEMA               TC_ITEMA
  4781. #define tagTCITEMW              _TC_ITEMW
  4782. #define    TCITEMW               TC_ITEMW
  4783. #endif
  4784. #define TC_ITEM                 TCITEM
  4785.  
  4786. typedef struct tagTCITEMA
  4787. {
  4788.     UINT mask;
  4789. #if (_WIN32_IE >= 0x0300)
  4790.     DWORD dwState;
  4791.     DWORD dwStateMask;
  4792. #else
  4793.     UINT lpReserved1;
  4794.     UINT lpReserved2;
  4795. #endif
  4796.     LPSTR pszText;
  4797.     int cchTextMax;
  4798.     int iImage;
  4799.  
  4800.     LPARAM lParam;
  4801. } TCITEMA, FAR *LPTCITEMA;
  4802.  
  4803. typedef struct tagTCITEMW
  4804. {
  4805.     UINT mask;
  4806. #if (_WIN32_IE >= 0x0300)
  4807.     DWORD dwState;
  4808.     DWORD dwStateMask;
  4809. #else
  4810.     UINT lpReserved1;
  4811.     UINT lpReserved2;
  4812. #endif
  4813.     LPWSTR pszText;
  4814.     int cchTextMax;
  4815.     int iImage;
  4816.  
  4817.     LPARAM lParam;
  4818. } TCITEMW, FAR *LPTCITEMW;
  4819.  
  4820. #ifdef UNICODE
  4821. #define  TCITEM                 TCITEMW
  4822. #define  LPTCITEM               LPTCITEMW
  4823. #else
  4824. #define  TCITEM                 TCITEMA
  4825. #define  LPTCITEM               LPTCITEMA
  4826. #endif
  4827.  
  4828.  
  4829. #define TCM_GETITEMA            (TCM_FIRST + 5)
  4830. #define TCM_GETITEMW            (TCM_FIRST + 60)
  4831.  
  4832. #ifdef UNICODE
  4833. #define TCM_GETITEM             TCM_GETITEMW
  4834. #else
  4835. #define TCM_GETITEM             TCM_GETITEMA
  4836. #endif
  4837.  
  4838. #define TabCtrl_GetItem(hwnd, iItem, pitem) \
  4839.     (BOOL)SNDMSG((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  4840.  
  4841.  
  4842. #define TCM_SETITEMA            (TCM_FIRST + 6)
  4843. #define TCM_SETITEMW            (TCM_FIRST + 61)
  4844.  
  4845. #ifdef UNICODE
  4846. #define TCM_SETITEM             TCM_SETITEMW
  4847. #else
  4848. #define TCM_SETITEM             TCM_SETITEMA
  4849. #endif
  4850.  
  4851. #define TabCtrl_SetItem(hwnd, iItem, pitem) \
  4852.     (BOOL)SNDMSG((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  4853.  
  4854.  
  4855. #define TCM_INSERTITEMA         (TCM_FIRST + 7)
  4856. #define TCM_INSERTITEMW         (TCM_FIRST + 62)
  4857.  
  4858. #ifdef UNICODE
  4859. #define TCM_INSERTITEM          TCM_INSERTITEMW
  4860. #else
  4861. #define TCM_INSERTITEM          TCM_INSERTITEMA
  4862. #endif
  4863.  
  4864. #define TabCtrl_InsertItem(hwnd, iItem, pitem)   \
  4865.     (int)SNDMSG((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem))
  4866.  
  4867.  
  4868. #define TCM_DELETEITEM          (TCM_FIRST + 8)
  4869. #define TabCtrl_DeleteItem(hwnd, i) \
  4870.     (BOOL)SNDMSG((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L)
  4871.  
  4872.  
  4873. #define TCM_DELETEALLITEMS      (TCM_FIRST + 9)
  4874. #define TabCtrl_DeleteAllItems(hwnd) \
  4875.     (BOOL)SNDMSG((hwnd), TCM_DELETEALLITEMS, 0, 0L)
  4876.  
  4877.  
  4878. #define TCM_GETITEMRECT         (TCM_FIRST + 10)
  4879. #define TabCtrl_GetItemRect(hwnd, i, prc) \
  4880.     (BOOL)SNDMSG((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc))
  4881.  
  4882.  
  4883. #define TCM_GETCURSEL           (TCM_FIRST + 11)
  4884. #define TabCtrl_GetCurSel(hwnd) \
  4885.     (int)SNDMSG((hwnd), TCM_GETCURSEL, 0, 0)
  4886.  
  4887.  
  4888. #define TCM_SETCURSEL           (TCM_FIRST + 12)
  4889. #define TabCtrl_SetCurSel(hwnd, i) \
  4890.     (int)SNDMSG((hwnd), TCM_SETCURSEL, (WPARAM)i, 0)
  4891.  
  4892.  
  4893. #define TCHT_NOWHERE            0x0001
  4894. #define TCHT_ONITEMICON         0x0002
  4895. #define TCHT_ONITEMLABEL        0x0004
  4896. #define TCHT_ONITEM             (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
  4897.  
  4898. #if (_WIN32_IE >= 0x0300)
  4899. #define LPTC_HITTESTINFO        LPTCHITTESTINFO
  4900. #define TC_HITTESTINFO          TCHITTESTINFO
  4901. #else
  4902. #define tagTCHITTESTINFO        _TC_HITTESTINFO
  4903. #define    TCHITTESTINFO         TC_HITTESTINFO
  4904. #define  LPTCHITTESTINFO       LPTC_HITTESTINFO
  4905. #endif
  4906.  
  4907. typedef struct tagTCHITTESTINFO
  4908. {
  4909.     POINT pt;
  4910.     UINT flags;
  4911. } TCHITTESTINFO, FAR * LPTCHITTESTINFO;
  4912.  
  4913. #define TCM_HITTEST             (TCM_FIRST + 13)
  4914. #define TabCtrl_HitTest(hwndTC, pinfo) \
  4915.     (int)SNDMSG((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
  4916.  
  4917.  
  4918. #define TCM_SETITEMEXTRA        (TCM_FIRST + 14)
  4919. #define TabCtrl_SetItemExtra(hwndTC, cb) \
  4920.     (BOOL)SNDMSG((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L)
  4921.  
  4922.  
  4923. #define TCM_ADJUSTRECT          (TCM_FIRST + 40)
  4924. #define TabCtrl_AdjustRect(hwnd, bLarger, prc) \
  4925.     (int)SNDMSG(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT FAR *)prc)
  4926.  
  4927.  
  4928. #define TCM_SETITEMSIZE         (TCM_FIRST + 41)
  4929. #define TabCtrl_SetItemSize(hwnd, x, y) \
  4930.     (DWORD)SNDMSG((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y))
  4931.  
  4932.  
  4933. #define TCM_REMOVEIMAGE         (TCM_FIRST + 42)
  4934. #define TabCtrl_RemoveImage(hwnd, i) \
  4935.         (void)SNDMSG((hwnd), TCM_REMOVEIMAGE, i, 0L)
  4936.  
  4937.  
  4938. #define TCM_SETPADDING          (TCM_FIRST + 43)
  4939. #define TabCtrl_SetPadding(hwnd,  cx, cy) \
  4940.         (void)SNDMSG((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy))
  4941.  
  4942.  
  4943. #define TCM_GETROWCOUNT         (TCM_FIRST + 44)
  4944. #define TabCtrl_GetRowCount(hwnd) \
  4945.         (int)SNDMSG((hwnd), TCM_GETROWCOUNT, 0, 0L)
  4946.  
  4947.  
  4948. #define TCM_GETTOOLTIPS         (TCM_FIRST + 45)
  4949. #define TabCtrl_GetToolTips(hwnd) \
  4950.         (HWND)SNDMSG((hwnd), TCM_GETTOOLTIPS, 0, 0L)
  4951.  
  4952.  
  4953. #define TCM_SETTOOLTIPS         (TCM_FIRST + 46)
  4954. #define TabCtrl_SetToolTips(hwnd, hwndTT) \
  4955.         (void)SNDMSG((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0L)
  4956.  
  4957.  
  4958. #define TCM_GETCURFOCUS         (TCM_FIRST + 47)
  4959. #define TabCtrl_GetCurFocus(hwnd) \
  4960.     (int)SNDMSG((hwnd), TCM_GETCURFOCUS, 0, 0)
  4961.  
  4962. #define TCM_SETCURFOCUS         (TCM_FIRST + 48)
  4963. #define TabCtrl_SetCurFocus(hwnd, i) \
  4964.     SNDMSG((hwnd),TCM_SETCURFOCUS, i, 0)
  4965.  
  4966. #if (_WIN32_IE >= 0x0300)
  4967. #define TCM_SETMINTABWIDTH      (TCM_FIRST + 49)
  4968. #define TabCtrl_SetMinTabWidth(hwnd, x) \
  4969.         (int)SNDMSG((hwnd), TCM_SETMINTABWIDTH, 0, x)
  4970.  
  4971.  
  4972. #define TCM_DESELECTALL         (TCM_FIRST + 50)
  4973. #define TabCtrl_DeselectAll(hwnd, fExcludeFocus)\
  4974.         (void)SNDMSG((hwnd), TCM_DESELECTALL, fExcludeFocus, 0)
  4975. #endif
  4976.  
  4977. #if (_WIN32_IE >= 0x0400)
  4978.  
  4979. #define TCM_HIGHLIGHTITEM       (TCM_FIRST + 51)
  4980. #define TabCtrl_HighlightItem(hwnd, i, fHighlight) \
  4981.     (BOOL)SNDMSG((hwnd), TCM_HIGHLIGHTITEM, (WPARAM)i, (LPARAM)MAKELONG (fHighlight, 0))
  4982.  
  4983. #define TCM_SETEXTENDEDSTYLE    (TCM_FIRST + 52)  // optional wParam == mask
  4984. #define TabCtrl_SetExtendedStyle(hwnd, dw)\
  4985.         (DWORD)SNDMSG((hwnd), TCM_SETEXTENDEDSTYLE, 0, dw)
  4986.  
  4987. #define TCM_GETEXTENDEDSTYLE    (TCM_FIRST + 53)
  4988. #define TabCtrl_GetExtendedStyle(hwnd)\
  4989.         (DWORD)SNDMSG((hwnd), TCM_GETEXTENDEDSTYLE, 0, 0)
  4990.  
  4991. #define TCM_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  4992. #define TabCtrl_SetUnicodeFormat(hwnd, fUnicode)  \
  4993.     (BOOL)SNDMSG((hwnd), TCM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0)
  4994.  
  4995. #define TCM_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  4996. #define TabCtrl_GetUnicodeFormat(hwnd)  \
  4997.     (BOOL)SNDMSG((hwnd), TCM_GETUNICODEFORMAT, 0, 0)
  4998.  
  4999. #endif      // _WIN32_IE >= 0x0400
  5000.  
  5001. #define TCN_KEYDOWN             (TCN_FIRST - 0)
  5002.  
  5003. #if (_WIN32_IE >= 0x0300)
  5004. #define TC_KEYDOWN              NMTCKEYDOWN
  5005. #else
  5006. #define tagTCKEYDOWN            _TC_KEYDOWN
  5007. #define  NMTCKEYDOWN             TC_KEYDOWN
  5008. #endif
  5009.  
  5010. typedef struct tagTCKEYDOWN
  5011. {
  5012.     NMHDR hdr;
  5013.     WORD wVKey;
  5014.     UINT flags;
  5015. } NMTCKEYDOWN;
  5016.  
  5017. #define TCN_SELCHANGE           (TCN_FIRST - 1)
  5018. #define TCN_SELCHANGING         (TCN_FIRST - 2)
  5019. #if (_WIN32_IE >= 0x0400)
  5020. #define TCN_GETOBJECT           (TCN_FIRST - 3)
  5021. #endif      // _WIN32_IE >= 0x0400
  5022.  
  5023. #endif      // NOTABCONTROL
  5024.  
  5025.  
  5026.  
  5027.  
  5028. //====== ANIMATE CONTROL ======================================================
  5029.  
  5030. #ifndef NOANIMATE
  5031.  
  5032. #ifdef _WIN32
  5033.  
  5034. #define ANIMATE_CLASSW          L"SysAnimate32"
  5035. #define ANIMATE_CLASSA          "SysAnimate32"
  5036.  
  5037. #ifdef UNICODE
  5038. #define ANIMATE_CLASS           ANIMATE_CLASSW
  5039. #else
  5040. #define ANIMATE_CLASS           ANIMATE_CLASSA
  5041. #endif
  5042.  
  5043. // begin_r_commctrl
  5044.  
  5045. #define ACS_CENTER              0x0001
  5046. #define ACS_TRANSPARENT         0x0002
  5047. #define ACS_AUTOPLAY            0x0004
  5048. #if (_WIN32_IE >= 0x0300)
  5049. #define ACS_TIMER               0x0008  // don't use threads... use timers
  5050. #endif
  5051.  
  5052. // end_r_commctrl
  5053.  
  5054. #define ACM_OPENA               (WM_USER+100)
  5055. #define ACM_OPENW               (WM_USER+103)
  5056.  
  5057. #ifdef UNICODE
  5058. #define ACM_OPEN                ACM_OPENW
  5059. #else
  5060. #define ACM_OPEN                ACM_OPENA
  5061. #endif
  5062.  
  5063. #define ACM_PLAY                (WM_USER+101)
  5064. #define ACM_STOP                (WM_USER+102)
  5065.  
  5066.  
  5067. #define ACN_START               1
  5068. #define ACN_STOP                2
  5069.  
  5070.  
  5071. #define Animate_Create(hwndP, id, dwStyle, hInstance)   \
  5072.             CreateWindow(ANIMATE_CLASS, NULL,           \
  5073.                 dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), hInstance, NULL)
  5074.  
  5075. #define Animate_Open(hwnd, szName)          (BOOL)SNDMSG(hwnd, ACM_OPEN, 0, (LPARAM)(LPTSTR)(szName))
  5076. #define Animate_OpenEx(hwnd, hInst, szName) (BOOL)SNDMSG(hwnd, ACM_OPEN, (WPARAM)hInst, (LPARAM)(LPTSTR)(szName))
  5077. #define Animate_Play(hwnd, from, to, rep)   (BOOL)SNDMSG(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), (LPARAM)MAKELONG(from, to))
  5078. #define Animate_Stop(hwnd)                  (BOOL)SNDMSG(hwnd, ACM_STOP, 0, 0)
  5079. #define Animate_Close(hwnd)                 Animate_Open(hwnd, NULL)
  5080. #define Animate_Seek(hwnd, frame)           Animate_Play(hwnd, frame, frame, 1)
  5081. #endif
  5082.  
  5083. #endif      // NOANIMATE
  5084.  
  5085. #if (_WIN32_IE >= 0x0300)
  5086. //====== MONTHCAL CONTROL ======================================================
  5087.  
  5088. #ifndef NOMONTHCAL
  5089. #ifdef _WIN32
  5090.  
  5091. #define MONTHCAL_CLASSW          L"SysMonthCal32"
  5092. #define MONTHCAL_CLASSA          "SysMonthCal32"
  5093.  
  5094. #ifdef UNICODE
  5095. #define MONTHCAL_CLASS           MONTHCAL_CLASSW
  5096. #else
  5097. #define MONTHCAL_CLASS           MONTHCAL_CLASSA
  5098. #endif
  5099.  
  5100. // bit-packed array of "bold" info for a month
  5101. // if a bit is on, that day is drawn bold
  5102. typedef DWORD MONTHDAYSTATE, FAR * LPMONTHDAYSTATE;
  5103.  
  5104.  
  5105. #define MCM_FIRST           0x1000
  5106.  
  5107. // BOOL MonthCal_GetCurSel(HWND hmc, LPSYSTEMTIME pst)
  5108. //   returns FALSE if MCS_MULTISELECT
  5109. //   returns TRUE and sets *pst to the currently selected date otherwise
  5110. #define MCM_GETCURSEL       (MCM_FIRST + 1)
  5111. #define MonthCal_GetCurSel(hmc, pst)    (BOOL)SNDMSG(hmc, MCM_GETCURSEL, 0, (LPARAM)(pst))
  5112.  
  5113. // BOOL MonthCal_SetCurSel(HWND hmc, LPSYSTEMTIME pst)
  5114. //   returns FALSE if MCS_MULTISELECT
  5115. //   returns TURE and sets the currently selected date to *pst otherwise
  5116. #define MCM_SETCURSEL       (MCM_FIRST + 2)
  5117. #define MonthCal_SetCurSel(hmc, pst)    (BOOL)SNDMSG(hmc, MCM_SETCURSEL, 0, (LPARAM)(pst))
  5118.  
  5119. // DWORD MonthCal_GetMaxSelCount(HWND hmc)
  5120. //   returns the maximum number of selectable days allowed
  5121. #define MCM_GETMAXSELCOUNT  (MCM_FIRST + 3)
  5122. #define MonthCal_GetMaxSelCount(hmc)    (DWORD)SNDMSG(hmc, MCM_GETMAXSELCOUNT, 0, 0L)
  5123.  
  5124. // BOOL MonthCal_SetMaxSelCount(HWND hmc, UINT n)
  5125. //   sets the max number days that can be selected iff MCS_MULTISELECT
  5126. #define MCM_SETMAXSELCOUNT  (MCM_FIRST + 4)
  5127. #define MonthCal_SetMaxSelCount(hmc, n) (BOOL)SNDMSG(hmc, MCM_SETMAXSELCOUNT, (WPARAM)(n), 0L)
  5128.  
  5129. // BOOL MonthCal_GetSelRange(HWND hmc, LPSYSTEMTIME rgst)
  5130. //   sets rgst[0] to the first day of the selection range
  5131. //   sets rgst[1] to the last day of the selection range
  5132. #define MCM_GETSELRANGE     (MCM_FIRST + 5)
  5133. #define MonthCal_GetSelRange(hmc, rgst) SNDMSG(hmc, MCM_GETSELRANGE, 0, (LPARAM)(rgst))
  5134.  
  5135. // BOOL MonthCal_SetSelRange(HWND hmc, LPSYSTEMTIME rgst)
  5136. //   selects the range of days from rgst[0] to rgst[1]
  5137. #define MCM_SETSELRANGE     (MCM_FIRST + 6)
  5138. #define MonthCal_SetSelRange(hmc, rgst) SNDMSG(hmc, MCM_SETSELRANGE, 0, (LPARAM)(rgst))
  5139.  
  5140. // DWORD MonthCal_GetMonthRange(HWND hmc, DWORD gmr, LPSYSTEMTIME rgst)
  5141. //   if rgst specified, sets rgst[0] to the starting date and
  5142. //      and rgst[1] to the ending date of the the selectable (non-grayed)
  5143. //      days if GMR_VISIBLE or all the displayed days (including grayed)
  5144. //      if GMR_DAYSTATE.
  5145. //   returns the number of months spanned by the above range.
  5146. #define MCM_GETMONTHRANGE   (MCM_FIRST + 7)
  5147. #define MonthCal_GetMonthRange(hmc, gmr, rgst)  (DWORD)SNDMSG(hmc, MCM_GETMONTHRANGE, (WPARAM)(gmr), (LPARAM)(rgst))
  5148.  
  5149. // BOOL MonthCal_SetDayState(HWND hmc, int cbds, DAYSTATE *rgds)
  5150. //   cbds is the count of DAYSTATE items in rgds and it must be equal
  5151. //   to the value returned from MonthCal_GetMonthRange(hmc, GMR_DAYSTATE, NULL)
  5152. //   This sets the DAYSTATE bits for each month (grayed and non-grayed
  5153. //   days) displayed in the calendar. The first bit in a month's DAYSTATE
  5154. //   corresponts to bolding day 1, the second bit affects day 2, etc.
  5155. #define MCM_SETDAYSTATE     (MCM_FIRST + 8)
  5156. #define MonthCal_SetDayState(hmc, cbds, rgds)   SNDMSG(hmc, MCM_SETDAYSTATE, (WPARAM)(cbds), (LPARAM)(rgds))
  5157.  
  5158. // BOOL MonthCal_GetMinReqRect(HWND hmc, LPRECT prc)
  5159. //   sets *prc the minimal size needed to display one month
  5160. //   To display two months, undo the AdjustWindowRect calculation already done to
  5161. //   this rect, double the width, and redo the AdjustWindowRect calculation --
  5162. //   the monthcal control will display two calendars in this window (if you also
  5163. //   double the vertical size, you will get 4 calendars)
  5164. //   NOTE: if you want to gurantee that the "Today" string is not clipped,
  5165. //   get the MCM_GETMAXTODAYWIDTH and use the max of that width and this width
  5166. #define MCM_GETMINREQRECT   (MCM_FIRST + 9)
  5167. #define MonthCal_GetMinReqRect(hmc, prc)        SNDMSG(hmc, MCM_GETMINREQRECT, 0, (LPARAM)(prc))
  5168.  
  5169. // set colors to draw control with -- see MCSC_ bits below
  5170. #define MCM_SETCOLOR            (MCM_FIRST + 10)
  5171. #define MonthCal_SetColor(hmc, iColor, clr) SNDMSG(hmc, MCM_SETCOLOR, iColor, clr)
  5172.  
  5173. #define MCM_GETCOLOR            (MCM_FIRST + 11)
  5174. #define MonthCal_GetColor(hmc, iColor) SNDMSG(hmc, MCM_SETCOLOR, iColor, 0)
  5175.  
  5176. #define MCSC_BACKGROUND   0   // the background color (between months)
  5177. #define MCSC_TEXT         1   // the dates
  5178. #define MCSC_TITLEBK      2   // background of the title
  5179. #define MCSC_TITLETEXT    3
  5180. #define MCSC_MONTHBK      4   // background within the month cal
  5181. #define MCSC_TRAILINGTEXT 5   // the text color of header & trailing days
  5182.  
  5183. // set what day is "today"   send NULL to revert back to real date
  5184. #define MCM_SETTODAY    (MCM_FIRST + 12)
  5185. #define MonthCal_SetToday(hmc, pst)             SNDMSG(hmc, MCM_SETTODAY, 0, (LPARAM)pst)
  5186.  
  5187. // get what day is "today"
  5188. // returns BOOL for success/failure
  5189. #define MCM_GETTODAY    (MCM_FIRST + 13)
  5190. #define MonthCal_GetToday(hmc, pst)             (BOOL)SNDMSG(hmc, MCM_GETTODAY, 0, (LPARAM)pst)
  5191.  
  5192. // determine what pinfo->pt is over
  5193. #define MCM_HITTEST          (MCM_FIRST + 14)
  5194. #define MonthCal_HitTest(hmc, pinfo) \
  5195.         SNDMSG(hmc, MCM_HITTEST, 0, (LPARAM)(PMCHITTESTINFO)pinfo)
  5196.  
  5197. typedef struct {
  5198.         UINT cbSize;
  5199.         POINT pt;
  5200.  
  5201.         UINT uHit;   // out param
  5202.         SYSTEMTIME st;
  5203. } MCHITTESTINFO, *PMCHITTESTINFO;
  5204.  
  5205. #define MCHT_TITLE                      0x00010000
  5206. #define MCHT_CALENDAR                   0x00020000
  5207. #define MCHT_TODAYLINK                  0x00030000
  5208.  
  5209. #define MCHT_NEXT                       0x01000000   // these indicate that hitting
  5210. #define MCHT_PREV                       0x02000000  // here will go to the next/prev month
  5211.  
  5212. #define MCHT_NOWHERE                    0x00000000
  5213.  
  5214. #define MCHT_TITLEBK                    (MCHT_TITLE)
  5215. #define MCHT_TITLEMONTH                 (MCHT_TITLE | 0x0001)
  5216. #define MCHT_TITLEYEAR                  (MCHT_TITLE | 0x0002)
  5217. #define MCHT_TITLEBTNNEXT               (MCHT_TITLE | MCHT_NEXT | 0x0003)
  5218. #define MCHT_TITLEBTNPREV               (MCHT_TITLE | MCHT_PREV | 0x0003)
  5219.  
  5220. #define MCHT_CALENDARBK                 (MCHT_CALENDAR)
  5221. #define MCHT_CALENDARDATE               (MCHT_CALENDAR | 0x0001)
  5222. #define MCHT_CALENDARDATENEXT           (MCHT_CALENDARDATE | MCHT_NEXT)
  5223. #define MCHT_CALENDARDATEPREV           (MCHT_CALENDARDATE | MCHT_PREV)
  5224. #define MCHT_CALENDARDAY                (MCHT_CALENDAR | 0x0002)
  5225. #define MCHT_CALENDARWEEKNUM            (MCHT_CALENDAR | 0x0003)
  5226.  
  5227. // set first day of week to iDay:
  5228. // 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
  5229. // -1 for means use locale info
  5230. #define MCM_SETFIRSTDAYOFWEEK (MCM_FIRST + 15)
  5231. #define MonthCal_SetFirstDayOfWeek(hmc, iDay) \
  5232.         SNDMSG(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay)
  5233.  
  5234. // DWORD result...  low word has the day.  high word is bool if this is app set
  5235. // or not (FALSE == using locale info)
  5236. #define MCM_GETFIRSTDAYOFWEEK (MCM_FIRST + 16)
  5237. #define MonthCal_GetFirstDayOfWeek(hmc) \
  5238.         (DWORD)SNDMSG(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0)
  5239.  
  5240. // DWORD MonthCal_GetRange(HWND hmc, LPSYSTEMTIME rgst)
  5241. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  5242. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  5243. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  5244. #define MCM_GETRANGE (MCM_FIRST + 17)
  5245. #define MonthCal_GetRange(hmc, rgst) \
  5246.         (DWORD)SNDMSG(hmc, MCM_GETRANGE, 0, (LPARAM)(rgst))
  5247.  
  5248. // BOOL MonthCal_SetRange(HWND hmc, DWORD gdtr, LPSYSTEMTIME rgst)
  5249. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  5250. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  5251. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  5252. #define MCM_SETRANGE (MCM_FIRST + 18)
  5253. #define MonthCal_SetRange(hmc, gd, rgst) \
  5254.         (BOOL)SNDMSG(hmc, MCM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
  5255.  
  5256. // int MonthCal_GetMonthDelta(HWND hmc)
  5257. //   returns the number of months one click on a next/prev button moves by
  5258. #define MCM_GETMONTHDELTA (MCM_FIRST + 19)
  5259. #define MonthCal_GetMonthDelta(hmc) \
  5260.         (int)SNDMSG(hmc, MCM_GETMONTHDELTA, 0, 0)
  5261.  
  5262. // int MonthCal_SetMonthDelta(HWND hmc, int n)
  5263. //   sets the month delta to n. n==0 reverts to moving by a page of months
  5264. //   returns the previous value of n.
  5265. #define MCM_SETMONTHDELTA (MCM_FIRST + 20)
  5266. #define MonthCal_SetMonthDelta(hmc, n) \
  5267.         (int)SNDMSG(hmc, MCM_SETMONTHDELTA, n, 0)
  5268.  
  5269. // DWORD MonthCal_GetMaxTodayWidth(HWND hmc, LPSIZE psz)
  5270. //   sets *psz to the maximum width/height of the "Today" string displayed
  5271. //   at the bottom of the calendar (as long as MCS_NOTODAY is not specified)
  5272. #define MCM_GETMAXTODAYWIDTH (MCM_FIRST + 21)
  5273. #define MonthCal_GetMaxTodayWidth(hmc) \
  5274.         (DWORD)SNDMSG(hmc, MCM_GETMAXTODAYWIDTH, 0, 0)
  5275.  
  5276. #if (_WIN32_IE >= 0x0400)
  5277. #define MCM_SETUNICODEFORMAT     CCM_SETUNICODEFORMAT
  5278. #define MonthCal_SetUnicodeFormat(hwnd, fUnicode)  \
  5279.     (BOOL)SNDMSG((hwnd), MCM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0)
  5280.  
  5281. #define MCM_GETUNICODEFORMAT     CCM_GETUNICODEFORMAT
  5282. #define MonthCal_GetUnicodeFormat(hwnd)  \
  5283.     (BOOL)SNDMSG((hwnd), MCM_GETUNICODEFORMAT, 0, 0)
  5284. #endif
  5285.  
  5286. // MCN_SELCHANGE is sent whenever the currently displayed date changes
  5287. // via month change, year change, keyboard navigation, prev/next button
  5288. //
  5289. typedef struct tagNMSELCHANGE
  5290. {
  5291.     NMHDR           nmhdr;  // this must be first, so we don't break WM_NOTIFY
  5292.  
  5293.     SYSTEMTIME      stSelStart;
  5294.     SYSTEMTIME      stSelEnd;
  5295. } NMSELCHANGE, FAR * LPNMSELCHANGE;
  5296.  
  5297. #define MCN_SELCHANGE       (MCN_FIRST + 1)
  5298.  
  5299. // MCN_GETDAYSTATE is sent for MCS_DAYSTATE controls whenever new daystate
  5300. // information is needed (month or year scroll) to draw bolding information.
  5301. // The app must fill in cDayState months worth of information starting from
  5302. // stStart date. The app may fill in the array at prgDayState or change
  5303. // prgDayState to point to a different array out of which the information
  5304. // will be copied. (similar to tooltips)
  5305. //
  5306. typedef struct tagNMDAYSTATE
  5307. {
  5308.     NMHDR           nmhdr;  // this must be first, so we don't break WM_NOTIFY
  5309.  
  5310.     SYSTEMTIME      stStart;
  5311.     int             cDayState;
  5312.  
  5313.     LPMONTHDAYSTATE prgDayState; // points to cDayState MONTHDAYSTATEs
  5314. } NMDAYSTATE, FAR * LPNMDAYSTATE;
  5315.  
  5316. #define MCN_GETDAYSTATE     (MCN_FIRST + 3)
  5317.  
  5318. // MCN_SELECT is sent whenever a selection has occured (via mouse or keyboard)
  5319. //
  5320. typedef NMSELCHANGE NMSELECT, FAR * LPNMSELECT;
  5321.  
  5322.  
  5323. #define MCN_SELECT          (MCN_FIRST + 4)
  5324.  
  5325.  
  5326. #define MCS_DAYSTATE        0x0001
  5327. #define MCS_MULTISELECT     0x0002
  5328. #define MCS_WEEKNUMBERS     0x0004
  5329. #if (_WIN32_IE >= 0x0400)
  5330. #define MCS_NOTODAYCIRCLE   0x0008
  5331. #define MCS_NOTODAY         0x0010
  5332. #else
  5333. #define MCS_NOTODAY         0x0008
  5334. #endif
  5335.  
  5336. #define GMR_VISIBLE     0       // visible portion of display
  5337. #define GMR_DAYSTATE    1       // above plus the grayed out parts of
  5338.                                 // partially displayed months
  5339.  
  5340.  
  5341. #endif // _WIN32
  5342. #endif // NOMONTHCAL
  5343.  
  5344.  
  5345. //====== DATETIMEPICK CONTROL ==================================================
  5346.  
  5347. #ifndef NODATETIMEPICK
  5348. #ifdef _WIN32
  5349.  
  5350. #define DATETIMEPICK_CLASSW          L"SysDateTimePick32"
  5351. #define DATETIMEPICK_CLASSA          "SysDateTimePick32"
  5352.  
  5353. #ifdef UNICODE
  5354. #define DATETIMEPICK_CLASS           DATETIMEPICK_CLASSW
  5355. #else
  5356. #define DATETIMEPICK_CLASS           DATETIMEPICK_CLASSA
  5357. #endif
  5358.  
  5359. #define DTM_FIRST        0x1000
  5360.  
  5361. // DWORD DateTimePick_GetSystemtime(HWND hdp, LPSYSTEMTIME pst)
  5362. //   returns GDT_NONE if "none" is selected (DTS_SHOWNONE only)
  5363. //   returns GDT_VALID and modifies *pst to be the currently selected value
  5364. #define DTM_GETSYSTEMTIME   (DTM_FIRST + 1)
  5365. #define DateTime_GetSystemtime(hdp, pst)    (DWORD)SNDMSG(hdp, DTM_GETSYSTEMTIME, 0, (LPARAM)(pst))
  5366.  
  5367. // BOOL DateTime_SetSystemtime(HWND hdp, DWORD gd, LPSYSTEMTIME pst)
  5368. //   if gd==GDT_NONE, sets datetimepick to None (DTS_SHOWNONE only)
  5369. //   if gd==GDT_VALID, sets datetimepick to *pst
  5370. //   returns TRUE on success, FALSE on error (such as bad params)
  5371. #define DTM_SETSYSTEMTIME   (DTM_FIRST + 2)
  5372. #define DateTime_SetSystemtime(hdp, gd, pst)    (BOOL)SNDMSG(hdp, DTM_SETSYSTEMTIME, (LPARAM)(gd), (LPARAM)(pst))
  5373.  
  5374. // DWORD DateTime_GetRange(HWND hdp, LPSYSTEMTIME rgst)
  5375. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  5376. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  5377. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  5378. #define DTM_GETRANGE (DTM_FIRST + 3)
  5379. #define DateTime_GetRange(hdp, rgst)  (DWORD)SNDMSG(hdp, DTM_GETRANGE, 0, (LPARAM)(rgst))
  5380.  
  5381. // BOOL DateTime_SetRange(HWND hdp, DWORD gdtr, LPSYSTEMTIME rgst)
  5382. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  5383. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  5384. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  5385. #define DTM_SETRANGE (DTM_FIRST + 4)
  5386. #define DateTime_SetRange(hdp, gd, rgst)  (BOOL)SNDMSG(hdp, DTM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
  5387.  
  5388. // BOOL DateTime_SetFormat(HWND hdp, LPCTSTR sz)
  5389. //   sets the display formatting string to sz (see GetDateFormat and GetTimeFormat for valid formatting chars)
  5390. //   NOTE: 'X' is a valid formatting character which indicates that the application
  5391. //   will determine how to display information. Such apps must support DTN_WMKEYDOWN,
  5392. //   DTN_FORMAT, and DTN_FORMATQUERY.
  5393. #define DTM_SETFORMATA (DTM_FIRST + 5)
  5394. #define DTM_SETFORMATW (DTM_FIRST + 50)
  5395.  
  5396. #ifdef UNICODE
  5397. #define DTM_SETFORMAT       DTM_SETFORMATW
  5398. #else
  5399. #define DTM_SETFORMAT       DTM_SETFORMATA
  5400. #endif
  5401.  
  5402. #define DateTime_SetFormat(hdp, sz)  (BOOL)SNDMSG(hdp, DTM_SETFORMAT, 0, (LPARAM)(sz))
  5403.  
  5404.  
  5405. #define DTM_SETMCCOLOR    (DTM_FIRST + 6)
  5406. #define DateTime_SetMonthCalColor(hdp, iColor, clr) SNDMSG(hdp, DTM_SETMCCOLOR, iColor, clr)
  5407.  
  5408. #define DTM_GETMCCOLOR    (DTM_FIRST + 7)
  5409. #define DateTime_GetMonthCalColor(hdp, iColor) SNDMSG(hdp, DTM_GETMCCOLOR, iColor, 0)
  5410.  
  5411. // HWND DateTime_GetMonthCal(HWND hdp)
  5412. //   returns the HWND of the MonthCal popup window. Only valid
  5413. // between DTN_DROPDOWN and DTN_CLOSEUP notifications.
  5414. #define DTM_GETMONTHCAL   (DTM_FIRST + 8)
  5415. #define DateTime_GetMonthCal(hdp) (HWND)SNDMSG(hdp, DTM_GETMONTHCAL, 0, 0)
  5416.  
  5417. #if (_WIN32_IE >= 0x0400)
  5418.  
  5419. #define DTM_SETMCFONT     (DTM_FIRST + 9)
  5420. #define DateTime_SetMonthCalFont(hdp, hfont, fRedraw) SNDMSG(hdp, DTM_SETMCFONT, (WPARAM)hfont, (LPARAM)fRedraw)
  5421.  
  5422. #define DTM_GETMCFONT     (DTM_FIRST + 10)
  5423. #define DateTime_GetMonthCalFont(hdp) SNDMSG(hdp, DTM_GETMCFONT, 0, 0)
  5424.  
  5425. #endif      // _WIN32_IE >= 0x0400
  5426.  
  5427. #define DTS_UPDOWN          0x0001 // use UPDOWN instead of MONTHCAL
  5428. #define DTS_SHOWNONE        0x0002 // allow a NONE selection
  5429. #define DTS_SHORTDATEFORMAT 0x0000 // use the short date format (app must forward WM_WININICHANGE messages)
  5430. #define DTS_LONGDATEFORMAT  0x0004 // use the long date format (app must forward WM_WININICHANGE messages)
  5431. #define DTS_TIMEFORMAT      0x0009 // use the time format (app must forward WM_WININICHANGE messages)
  5432. #define DTS_APPCANPARSE     0x0010 // allow user entered strings (app MUST respond to DTN_USERSTRING)
  5433. #define DTS_RIGHTALIGN      0x0020 // right-align popup instead of left-align it
  5434.  
  5435. #define DTN_DATETIMECHANGE  (DTN_FIRST + 1) // the systemtime has changed
  5436. typedef struct tagNMDATETIMECHANGE
  5437. {
  5438.     NMHDR       nmhdr;
  5439.     DWORD       dwFlags;    // GDT_VALID or GDT_NONE
  5440.     SYSTEMTIME  st;         // valid iff dwFlags==GDT_VALID
  5441. } NMDATETIMECHANGE, FAR * LPNMDATETIMECHANGE;
  5442.  
  5443. #define DTN_USERSTRINGA  (DTN_FIRST + 2) // the user has entered a string
  5444. #define DTN_USERSTRINGW  (DTN_FIRST + 15)
  5445. typedef struct tagNMDATETIMESTRINGA
  5446. {
  5447.     NMHDR      nmhdr;
  5448.     LPCSTR     pszUserString;  // string user entered
  5449.     SYSTEMTIME st;             // app fills this in
  5450.     DWORD      dwFlags;        // GDT_VALID or GDT_NONE
  5451. } NMDATETIMESTRINGA, FAR * LPNMDATETIMESTRINGA;
  5452.  
  5453. typedef struct tagNMDATETIMESTRINGW
  5454. {
  5455.     NMHDR      nmhdr;
  5456.     LPCWSTR    pszUserString;  // string user entered
  5457.     SYSTEMTIME st;             // app fills this in
  5458.     DWORD      dwFlags;        // GDT_VALID or GDT_NONE
  5459. } NMDATETIMESTRINGW, FAR * LPNMDATETIMESTRINGW;
  5460.  
  5461. #ifdef UNICODE
  5462. #define DTN_USERSTRING          DTN_USERSTRINGW
  5463. #define NMDATETIMESTRING        NMDATETIMESTRINGW
  5464. #define LPNMDATETIMESTRING      LPNMDATETIMESTRINGW
  5465. #else
  5466. #define DTN_USERSTRING          DTN_USERSTRINGA
  5467. #define NMDATETIMESTRING        NMDATETIMESTRINGA
  5468. #define LPNMDATETIMESTRING      LPNMDATETIMESTRINGA
  5469. #endif
  5470.  
  5471.  
  5472. #define DTN_WMKEYDOWNA  (DTN_FIRST + 3) // modify keydown on app format field (X)
  5473. #define DTN_WMKEYDOWNW  (DTN_FIRST + 16)
  5474. typedef struct tagNMDATETIMEWMKEYDOWNA
  5475. {
  5476.     NMHDR      nmhdr;
  5477.     int        nVirtKey;  // virtual key code of WM_KEYDOWN which MODIFIES an X field
  5478.     LPCSTR     pszFormat; // format substring
  5479.     SYSTEMTIME st;        // current systemtime, app should modify based on key
  5480. } NMDATETIMEWMKEYDOWNA, FAR * LPNMDATETIMEWMKEYDOWNA;
  5481.  
  5482. typedef struct tagNMDATETIMEWMKEYDOWNW
  5483. {
  5484.     NMHDR      nmhdr;
  5485.     int        nVirtKey;  // virtual key code of WM_KEYDOWN which MODIFIES an X field
  5486.     LPCWSTR    pszFormat; // format substring
  5487.     SYSTEMTIME st;        // current systemtime, app should modify based on key
  5488. } NMDATETIMEWMKEYDOWNW, FAR * LPNMDATETIMEWMKEYDOWNW;
  5489.  
  5490. #ifdef UNICODE
  5491. #define DTN_WMKEYDOWN           DTN_WMKEYDOWNW
  5492. #define NMDATETIMEWMKEYDOWN     NMDATETIMEWMKEYDOWNW
  5493. #define LPNMDATETIMEWMKEYDOWN   LPNMDATETIMEWMKEYDOWNW
  5494. #else
  5495. #define DTN_WMKEYDOWN           DTN_WMKEYDOWNA
  5496. #define NMDATETIMEWMKEYDOWN     NMDATETIMEWMKEYDOWNA
  5497. #define LPNMDATETIMEWMKEYDOWN   LPNMDATETIMEWMKEYDOWNA
  5498. #endif
  5499.  
  5500.  
  5501. #define DTN_FORMATA  (DTN_FIRST + 4) // query display for app format field (X)
  5502. #define DTN_FORMATW  (DTN_FIRST + 17)
  5503. typedef struct tagNMDATETIMEFORMATA
  5504. {
  5505.     NMHDR nmhdr;
  5506.     LPCSTR  pszFormat;   // format substring
  5507.     SYSTEMTIME st;       // current systemtime
  5508.     LPCSTR pszDisplay;   // string to display
  5509.     CHAR szDisplay[64];  // buffer pszDisplay originally points at
  5510. } NMDATETIMEFORMATA, FAR * LPNMDATETIMEFORMATA;
  5511.  
  5512. typedef struct tagNMDATETIMEFORMATW
  5513. {
  5514.     NMHDR nmhdr;
  5515.     LPCWSTR pszFormat;   // format substring
  5516.     SYSTEMTIME st;       // current systemtime
  5517.     LPCWSTR pszDisplay;  // string to display
  5518.     WCHAR szDisplay[64]; // buffer pszDisplay originally points at
  5519. } NMDATETIMEFORMATW, FAR * LPNMDATETIMEFORMATW;
  5520.  
  5521. #ifdef UNICODE
  5522. #define DTN_FORMAT             DTN_FORMATW
  5523. #define NMDATETIMEFORMAT        NMDATETIMEFORMATW
  5524. #define LPNMDATETIMEFORMAT      LPNMDATETIMEFORMATW
  5525. #else
  5526. #define DTN_FORMAT             DTN_FORMATA
  5527. #define NMDATETIMEFORMAT        NMDATETIMEFORMATA
  5528. #define LPNMDATETIMEFORMAT      LPNMDATETIMEFORMATA
  5529. #endif
  5530.  
  5531.  
  5532. #define DTN_FORMATQUERYA  (DTN_FIRST + 5) // query formatting info for app format field (X)
  5533. #define DTN_FORMATQUERYW (DTN_FIRST + 18)
  5534. typedef struct tagNMDATETIMEFORMATQUERYA
  5535. {
  5536.     NMHDR nmhdr;
  5537.     LPCSTR pszFormat;  // format substring
  5538.     SIZE szMax;        // max bounding rectangle app will use for this format string
  5539. } NMDATETIMEFORMATQUERYA, FAR * LPNMDATETIMEFORMATQUERYA;
  5540.  
  5541. typedef struct tagNMDATETIMEFORMATQUERYW
  5542. {
  5543.     NMHDR nmhdr;
  5544.     LPCWSTR pszFormat; // format substring
  5545.     SIZE szMax;        // max bounding rectangle app will use for this format string
  5546. } NMDATETIMEFORMATQUERYW, FAR * LPNMDATETIMEFORMATQUERYW;
  5547.  
  5548. #ifdef UNICODE
  5549. #define DTN_FORMATQUERY         DTN_FORMATQUERYW
  5550. #define NMDATETIMEFORMATQUERY   NMDATETIMEFORMATQUERYW
  5551. #define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYW
  5552. #else
  5553. #define DTN_FORMATQUERY         DTN_FORMATQUERYA
  5554. #define NMDATETIMEFORMATQUERY   NMDATETIMEFORMATQUERYA
  5555. #define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYA
  5556. #endif
  5557.  
  5558.  
  5559. #define DTN_DROPDOWN    (DTN_FIRST + 6) // MonthCal has dropped down
  5560. #define DTN_CLOSEUP     (DTN_FIRST + 7) // MonthCal is popping up
  5561.  
  5562.  
  5563. #define GDTR_MIN     0x0001
  5564. #define GDTR_MAX     0x0002
  5565.  
  5566. #define GDT_ERROR    -1
  5567. #define GDT_VALID    0
  5568. #define GDT_NONE     1
  5569.  
  5570.  
  5571. #endif // _WIN32
  5572. #endif // NODATETIMEPICK
  5573.  
  5574.  
  5575. #if (_WIN32_IE >= 0x0400)
  5576.  
  5577. #ifndef NOIPADDRESS
  5578.  
  5579. ///////////////////////////////////////////////
  5580. ///    IP Address edit control
  5581.  
  5582. // Messages sent to IPAddress controls
  5583.  
  5584. #define IPM_CLEARADDRESS (WM_USER+100) // no parameters
  5585. #define IPM_SETADDRESS   (WM_USER+101) // lparam = TCP/IP address
  5586. #define IPM_GETADDRESS   (WM_USER+102) // lresult = # of non black fields.  lparam = LPDWORD for TCP/IP address
  5587. #define IPM_SETRANGE (WM_USER+103) // wparam = field, lparam = range
  5588. #define IPM_SETFOCUS (WM_USER+104) // wparam = field
  5589. #define IPM_ISBLANK  (WM_USER+105) // no parameters
  5590.  
  5591. #define WC_IPADDRESSW           L"SysIPAddress32"
  5592. #define WC_IPADDRESSA           "SysIPAddress32"
  5593.  
  5594. #ifdef UNICODE
  5595. #define WC_IPADDRESS          WC_IPADDRESSW
  5596. #else
  5597. #define WC_IPADDRESS          WC_IPADDRESSA
  5598. #endif
  5599.  
  5600. #define IPN_FIELDCHANGED                (IPN_FIRST - 0)
  5601. typedef struct tagNMIPADDRESS
  5602. {
  5603.         NMHDR hdr;
  5604.         int iField;
  5605.         int iValue;
  5606. } NMIPADDRESS, *LPNMIPADDRESS;
  5607.  
  5608. // The following is a useful macro for passing the range values in the
  5609. // IPM_SETRANGE message.
  5610.  
  5611. #define MAKEIPRANGE(low, high)    ((LPARAM)(WORD)(((BYTE)(high) << 8) + (BYTE)(low)))
  5612.  
  5613. // And this is a useful macro for making the IP Address to be passed
  5614. // as a LPARAM.
  5615.  
  5616. #define MAKEIPADDRESS(b1,b2,b3,b4)  ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
  5617.  
  5618. // Get individual number
  5619. #define FIRST_IPADDRESS(x)  ((x>>24) & 0xff)
  5620. #define SECOND_IPADDRESS(x) ((x>>16) & 0xff)
  5621. #define THIRD_IPADDRESS(x)  ((x>>8) & 0xff)
  5622. #define FOURTH_IPADDRESS(x) (x & 0xff)
  5623.  
  5624.  
  5625. #endif // NOIPADDRESS
  5626.  
  5627.  
  5628. //---------------------------------------------------------------------------------------
  5629. //---------------------------------------------------------------------------------------
  5630. ///  ====================== Pager Control =============================
  5631. //---------------------------------------------------------------------------------------
  5632. //---------------------------------------------------------------------------------------
  5633.  
  5634. #ifndef NOPAGESCROLLER
  5635.  
  5636. //Pager Class Name
  5637. #define WC_PAGESCROLLERW           L"SysPager"
  5638. #define WC_PAGESCROLLERA           "SysPager"
  5639.  
  5640. #ifdef UNICODE
  5641. #define WC_PAGESCROLLER          WC_PAGESCROLLERW
  5642. #else
  5643. #define WC_PAGESCROLLER          WC_PAGESCROLLERA
  5644. #endif
  5645.  
  5646.  
  5647. //---------------------------------------------------------------------------------------
  5648. // Pager Control Styles
  5649. //---------------------------------------------------------------------------------------
  5650. #define PGS_VERT                0x00000000
  5651. #define PGS_HORZ                0x00000001
  5652. #define PGS_AUTOSCROLL          0x00000002
  5653. #define PGS_DRAGNDROP           0x00000004
  5654.  
  5655.  
  5656. //---------------------------------------------------------------------------------------
  5657. // Pager Button State
  5658. //---------------------------------------------------------------------------------------
  5659. //The scroll can be in one of the following control State 
  5660. #define  PGF_INVISIBLE   0      // Scroll button is not visible
  5661. #define  PGF_NORMAL      1      // Scroll button is in normal state
  5662. #define  PGF_GRAYED      2      // Scroll button is in grayed state
  5663. #define  PGF_DEPRESSED   4      // Scroll button is in depressed state
  5664. #define  PGF_HOT         8      // Scroll button is in hot state
  5665.  
  5666.  
  5667. // The following identifiers specifies the button control 
  5668. #define PGB_TOPORLEFT       0
  5669. #define PGB_BOTTOMORRIGHT   1
  5670.  
  5671. //---------------------------------------------------------------------------------------
  5672. // Pager Control  Messages
  5673. //---------------------------------------------------------------------------------------
  5674. #define PGM_SETCHILD            (PGM_FIRST + 1)  // lParam == hwnd
  5675. #define Pager_SetChild(hwnd, hwndChild) \
  5676.         (void)SNDMSG((hwnd), PGM_SETCHILD, 0, (LPARAM)(hwndChild))
  5677.  
  5678. #define PGM_RECALCSIZE          (PGM_FIRST + 2)
  5679. #define Pager_RecalcSize(hwnd) \
  5680.         (void)SNDMSG((hwnd), PGM_RECALCSIZE, 0, 0)
  5681.  
  5682. #define PGM_FORWARDMOUSE        (PGM_FIRST + 3)
  5683. #define Pager_ForwardMouse(hwnd, bForward) \
  5684.         (void)SNDMSG((hwnd), PGM_FORWARDMOUSE, (WPARAM)(bForward), 0)
  5685.  
  5686. #define PGM_SETBKCOLOR          (PGM_FIRST + 4)
  5687. #define Pager_SetBkColor(hwnd, clr) \
  5688.         (COLORREF)SNDMSG((hwnd), PGM_SETBKCOLOR, 0, (LPARAM)clr)
  5689.  
  5690. #define PGM_GETBKCOLOR          (PGM_FIRST + 5)
  5691. #define Pager_GetBkColor(hwnd) \
  5692.         (COLORREF)SNDMSG((hwnd), PGM_GETBKCOLOR, 0, 0)
  5693.  
  5694. #define PGM_SETBORDER          (PGM_FIRST + 6)
  5695. #define Pager_SetBorder(hwnd, iBorder) \
  5696.         (int)SNDMSG((hwnd), PGM_SETBORDER, 0, (LPARAM)iBorder)
  5697.  
  5698. #define PGM_GETBORDER          (PGM_FIRST + 7)
  5699. #define Pager_GetBorder(hwnd) \
  5700.         (int)SNDMSG((hwnd), PGM_GETBORDER, 0, 0)
  5701.  
  5702. #define PGM_SETPOS              (PGM_FIRST + 8)
  5703. #define Pager_SetPos(hwnd, iPos) \
  5704.         (int)SNDMSG((hwnd), PGM_SETPOS, 0, (LPARAM)iPos)
  5705.  
  5706. #define PGM_GETPOS              (PGM_FIRST + 9)
  5707. #define Pager_GetPos(hwnd) \
  5708.         (int)SNDMSG((hwnd), PGM_GETPOS, 0, 0)
  5709.  
  5710. #define PGM_SETBUTTONSIZE       (PGM_FIRST + 10)
  5711. #define Pager_SetButtonSize(hwnd, iSize) \
  5712.         (int)SNDMSG((hwnd), PGM_SETBUTTONSIZE, 0, (LPARAM)iSize)
  5713.  
  5714. #define PGM_GETBUTTONSIZE       (PGM_FIRST + 11)
  5715. #define Pager_GetButtonSize(hwnd) \
  5716.         (int)SNDMSG((hwnd), PGM_GETBUTTONSIZE, 0,0)
  5717.  
  5718. #define PGM_GETBUTTONSTATE      (PGM_FIRST + 12)
  5719. #define Pager_GetButtonState(hwnd, iButton) \
  5720.         (DWORD)SNDMSG((hwnd), PGM_GETBUTTONSTATE, 0, (LPARAM)iButton)
  5721.  
  5722. #define PGM_GETDROPTARGET       CCM_GETDROPTARGET
  5723. #define Pager_GetDropTarget(hwnd, ppdt) \
  5724.         (void)SNDMSG((hwnd), PGM_GETDROPTARGET, 0, (LPARAM)ppdt)
  5725.  
  5726. //---------------------------------------------------------------------------------------
  5727. //Pager Control Notification Messages
  5728. //---------------------------------------------------------------------------------------
  5729.  
  5730.  
  5731. // PGN_SCROLL Notification Message
  5732.  
  5733. #define PGN_SCROLL          (PGN_FIRST-1)
  5734.  
  5735. #define PGF_SCROLLUP        1
  5736. #define PGF_SCROLLDOWN      2
  5737. #define PGF_SCROLLLEFT      4
  5738. #define PGF_SCROLLRIGHT     8
  5739.  
  5740.  
  5741. //Keys down
  5742. #define PGK_SHIFT           1
  5743. #define PGK_CONTROL         2
  5744. #define PGK_MENU            4
  5745.  
  5746.  
  5747. // This structure is sent along with PGN_SCROLL notifications
  5748. typedef struct {
  5749.     NMHDR hdr;
  5750.     WORD fwKeys;            // Specifies which keys are down when this notification is send
  5751.     RECT rcParent;          // Contains Parent Window Rect
  5752.     int  iDir;              // Scrolling Direction
  5753.     int  iXpos;             // Horizontal scroll position
  5754.     int  iYpos;             // Vertical scroll position
  5755.     int  iScroll;           // [in/out] Amount to scroll
  5756. }NMPGSCROLL, *LPNMPGSCROLL;
  5757.  
  5758.  
  5759. // PGN_CALCSIZE Notification Message
  5760.  
  5761. #define PGN_CALCSIZE        (PGN_FIRST-2)
  5762.  
  5763. #define PGF_CALCWIDTH       1
  5764. #define PGF_CALCHEIGHT      2
  5765.  
  5766. typedef struct {
  5767.     NMHDR   hdr;
  5768.     DWORD   dwFlag;
  5769.     int     iWidth;
  5770.     int     iHeight;
  5771. }NMPGCALCSIZE, *LPNMPGCALCSIZE;
  5772.  
  5773. #endif // NOPAGESCROLLER
  5774.  
  5775. ////======================  End Pager Control ==========================================
  5776.  
  5777. //
  5778. // === Native Font Control ===
  5779. //
  5780. #ifndef NONATIVEFONTCTL
  5781. //NativeFont Class Name
  5782. #define WC_NATIVEFONTCTLW           L"NativeFontCtl"
  5783. #define WC_NATIVEFONTCTLA           "NativeFontCtl"
  5784.  
  5785. #ifdef UNICODE
  5786. #define WC_NATIVEFONTCTL          WC_NATIVEFONTCTLW
  5787. #else
  5788. #define WC_NATIVEFONTCTL          WC_NATIVEFONTCTLA
  5789. #endif
  5790.  
  5791. // style definition
  5792. #define NFS_EDIT                0x0001
  5793. #define NFS_STATIC              0x0002
  5794. #define NFS_LISTCOMBO           0x0004
  5795. #define NFS_BUTTON              0x0008
  5796. #define NFS_ALL                 0x0010
  5797.  
  5798. #endif // NONATIVEFONTCTL
  5799. // === End Native Font Control ===
  5800.  
  5801. #endif      // _WIN32_IE >= 0x0400
  5802.  
  5803. #ifdef _WIN32
  5804. //====== TrackMouseEvent  =====================================================
  5805.  
  5806. #ifndef NOTRACKMOUSEEVENT
  5807.  
  5808. //
  5809. // If the messages for TrackMouseEvent have not been defined then define them
  5810. // now.
  5811. //
  5812. #ifndef WM_MOUSEHOVER
  5813. #define WM_MOUSEHOVER                   0x02A1
  5814. #define WM_MOUSELEAVE                   0x02A3
  5815. #endif
  5816.  
  5817. //
  5818. // If the TRACKMOUSEEVENT structure and associated flags havent been declared
  5819. // then declare them now.
  5820. //
  5821. #ifndef TME_HOVER
  5822.  
  5823. #define TME_HOVER       0x00000001
  5824. #define TME_LEAVE       0x00000002
  5825. #define TME_QUERY       0x40000000
  5826. #define TME_CANCEL      0x80000000
  5827.  
  5828.  
  5829. #define HOVER_DEFAULT   0xFFFFFFFF
  5830.  
  5831. typedef struct tagTRACKMOUSEEVENT {
  5832.     DWORD cbSize;
  5833.     DWORD dwFlags;
  5834.     HWND  hwndTrack;
  5835.     DWORD dwHoverTime;
  5836. } TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT;
  5837.  
  5838. #endif // !TME_HOVER
  5839.  
  5840. //
  5841. // Declare _TrackMouseEvent.  This API tries to use the window manager's
  5842. // implementation of TrackMouseEvent if it is present, otherwise it emulates.
  5843. //
  5844. WINCOMMCTRLAPI
  5845. BOOL
  5846. WINAPI
  5847. _TrackMouseEvent(
  5848.     LPTRACKMOUSEEVENT lpEventTrack);
  5849.  
  5850. #endif // !NOTRACKMOUSEEVENT
  5851.  
  5852. #if (_WIN32_IE >= 0x0400)
  5853.  
  5854. //====== Flat Scrollbar APIs=========================================
  5855. #ifndef NOFLATSBAPIS
  5856.  
  5857. #define WSB_PROP_CYVSCROLL  0x00000001L
  5858. #define WSB_PROP_CXHSCROLL  0x00000002L
  5859. #define WSB_PROP_CYHSCROLL  0x00000004L
  5860. #define WSB_PROP_CXVSCROLL  0x00000008L
  5861. #define WSB_PROP_CXHTHUMB   0x00000010L
  5862. #define WSB_PROP_CYVTHUMB   0x00000020L
  5863. #define WSB_PROP_VBKGCOLOR  0x00000040L
  5864. #define WSB_PROP_HBKGCOLOR  0x00000080L
  5865. #define WSB_PROP_VSTYLE     0x00000100L
  5866. #define WSB_PROP_HSTYLE     0x00000200L
  5867. #define WSB_PROP_WINSTYLE   0x00000400L
  5868. #define WSB_PROP_PALETTE    0x00000800L
  5869. #define WSB_PROP_MASK       0x00000FFFL
  5870.  
  5871. #define FSB_FLAT_MODE           2
  5872. #define FSB_ENCARTA_MODE        1
  5873. #define FSB_REGULAR_MODE        0
  5874.  
  5875. WINCOMMCTRLAPI BOOL WINAPI FlatSB_EnableScrollBar(HWND, int, UINT);
  5876. WINCOMMCTRLAPI BOOL WINAPI FlatSB_ShowScrollBar(HWND, int code, BOOL);
  5877.  
  5878. WINCOMMCTRLAPI BOOL WINAPI FlatSB_GetScrollRange(HWND, int code, LPINT, LPINT);
  5879. WINCOMMCTRLAPI BOOL WINAPI FlatSB_GetScrollInfo(HWND, int code, LPSCROLLINFO);
  5880. WINCOMMCTRLAPI int WINAPI FlatSB_GetScrollPos(HWND, int code);
  5881. WINCOMMCTRLAPI BOOL WINAPI FlatSB_GetScrollProp(HWND, int propIndex, LPINT);
  5882.  
  5883. WINCOMMCTRLAPI int WINAPI FlatSB_SetScrollPos(HWND, int code, int pos, BOOL fRedraw);
  5884. WINCOMMCTRLAPI int WINAPI FlatSB_SetScrollInfo(HWND, int code, LPSCROLLINFO, BOOL fRedraw);
  5885. WINCOMMCTRLAPI int WINAPI FlatSB_SetScrollRange(HWND, int code, int min, int max, BOOL fRedraw);
  5886. WINCOMMCTRLAPI BOOL WINAPI FlatSB_SetScrollProp(HWND, UINT index, int newValue, BOOL);
  5887.  
  5888. WINCOMMCTRLAPI BOOL WINAPI InitializeFlatSB(HWND);
  5889. WINCOMMCTRLAPI HRESULT WINAPI UninitializeFlatSB(HWND);
  5890.  
  5891. #endif  //  NOFLATSBAPIS
  5892.  
  5893. #endif      // _WIN32_IE >= 0x0400
  5894.  
  5895. #endif /* _WIN32 */
  5896.  
  5897. #endif      // _WIN32_IE >= 0x0300
  5898.  
  5899.  
  5900. #ifdef __cplusplus
  5901. }
  5902. #endif
  5903.  
  5904. #ifdef _WIN32
  5905. #include <poppack.h>
  5906. #endif
  5907.  
  5908. #endif
  5909.  
  5910.  
  5911. #endif  // _INC_COMMCTRL
  5912.