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