commctrl.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 122k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             *
  3. * commctrl.h - - Interface for the Windows Common Controls       *
  4. *                                                                             *
  5. * Version 1.0       *
  6. *                                                                             *
  7. * Copyright (c) 1991-1995, Microsoft Corp. All rights reserved.       *
  8. *                                                                             *
  9. *****************************************************************************/
  10. /*REVIEW: this stuff needs Windows style in many places; find all REVIEWs. */
  11. #ifndef _INC_COMMCTRL
  12. #define _INC_COMMCTRL
  13. #ifndef NOUSER
  14. //
  15. // Define API decoration for direct importing of DLL references.
  16. //
  17. #ifndef WINCOMMCTRLAPI
  18. #if !defined(_COMCTL32_) && defined(_WIN32)
  19. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  20. #else
  21. #define WINCOMMCTRLAPI
  22. #endif
  23. #endif // WINCOMMCTRLAPI
  24. //
  25. // For compilers that don't support nameless unions
  26. //
  27. #ifndef DUMMYUNIONNAME
  28. #ifdef NONAMELESSUNION
  29. #define DUMMYUNIONNAME  u
  30. #define DUMMYUNIONNAME2  u2
  31. #define DUMMYUNIONNAME3  u3
  32. #else
  33. #define DUMMYUNIONNAME
  34. #define DUMMYUNIONNAME2
  35. #define DUMMYUNIONNAME3
  36. #endif
  37. #endif // DUMMYUNIONNAME
  38. #ifdef _WIN32
  39. #include <pshpack1.h>
  40. #endif
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. /* Users of this header may define any number of these constants to avoid
  45.  * the definitions of each functional group.
  46.  *    NOTOOLBAR    Customizable bitmap-button toolbar control.
  47.  *    NOUPDOWN     Up and Down arrow increment/decrement control.
  48.  *    NOSTATUSBAR  Status bar and header bar controls.
  49.  *    NOMENUHELP   APIs to help manage menus, especially with a status bar.
  50.  *    NOTRACKBAR   Customizable column-width tracking control.
  51.  *    NOBTNLIST    A control which is a list of bitmap buttons. ;Internal
  52.  *    NODRAGLIST   APIs to make a listbox source and sink drag&drop actions.
  53.  *    NOPROGRESS   Progress gas gauge.
  54.  *    NOHOTKEY     HotKey control
  55.  */
  56. /*/////////////////////////////////////////////////////////////////////////*/
  57. /* InitCommonControls:
  58.  * Any application requiring the use of any common control should call this
  59.  * API upon application startup.  There is no required shutdown.
  60.  */
  61. WINCOMMCTRLAPI void WINAPI InitCommonControls();
  62. // Define Ownerdraw type for Header controls BUGBUG: should be in windows.h?
  63. #define ODT_HEADER      100
  64. #define ODT_TAB         101
  65. #define ODT_LISTVIEW    102
  66. //====== Ranges for control message IDs
  67. // (making each control's messages unique makes validation and
  68. // debugging easier).
  69. //
  70. #define LVM_FIRST       0x1000      // ListView messages
  71. #define TV_FIRST        0x1100      // TreeView messages
  72. #define HDM_FIRST       0x1200      // Header messages
  73. WINCOMMCTRLAPI LRESULT WINAPI SendNotify(HWND hwndTo, HWND hwndFrom, int code, NMHDR FAR* pnmhdr); /* ;Internal */
  74. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) 
  75.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  76. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) 
  77.     (LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR FAR*)(pnmhdr))
  78. // Generic WM_NOTIFY notification codes
  79. #define NM_OUTOFMEMORY          (NM_FIRST-1)
  80. #define NM_CLICK                (NM_FIRST-2)
  81. #define NM_DBLCLK               (NM_FIRST-3)
  82. #define NM_RETURN               (NM_FIRST-4)
  83. #define NM_RCLICK               (NM_FIRST-5)
  84. #define NM_RDBLCLK              (NM_FIRST-6)
  85. #define NM_SETFOCUS             (NM_FIRST-7)
  86. #define NM_KILLFOCUS            (NM_FIRST-8)
  87. #define NM_STARTWAIT            (NM_FIRST-9)     // ;Internal
  88. #define NM_ENDWAIT              (NM_FIRST-10)    // ;Internal
  89. #define NM_BTNCLK               (NM_FIRST-11)   // ;Internal
  90. // WM_NOTIFY codes (NMHDR.code values)
  91. // these are not required to be in seperate ranges but that makes
  92. // validation and debugging easier
  93. #define NM_FIRST        (0U-  0U) // generic to all controls
  94. #define NM_LAST         (0U- 99U)
  95. #define LVN_FIRST       (0U-100U) // listview
  96. #define LVN_LAST        (0U-199U)
  97. #define HDN_FIRST       (0U-300U) // header
  98. #define HDN_LAST        (0U-399U)
  99. #define TVN_FIRST       (0U-400U) // treeview
  100. #define TVN_LAST        (0U-499U)
  101. #define TTN_FIRST (0U-520U) // tooltips
  102. #define TTN_LAST (0U-549U)
  103. #define TCN_FIRST       (0U-550U) // tab control
  104. #define TCN_LAST        (0U-580U)
  105. // Shell reserved       (0U-580U) -  (0U-589U)
  106. #define CDN_FIRST (0U-601U) // common dialog (new)
  107. #define CDN_LAST (0U-699U)
  108. #define TBN_FIRST       (0U-700U) // toolbar
  109. #define TBN_LAST        (0U-720U)
  110. #define UDN_FIRST       (0U-721) // updown
  111. #define UDN_LAST        (0U-740) // updown
  112. // Message Filter Proc codes - These are defined above MSGF_USER
  113. #define MSGF_COMMCTRL_BEGINDRAG     0x4200
  114. #define MSGF_COMMCTRL_SIZEHEADER    0x4201     
  115. #define MSGF_COMMCTRL_DRAGSELECT    0x4202
  116. #define MSGF_COMMCTRL_TOOLBARCUST   0x4203
  117. //====== IMAGE APIS ==================================================
  118. #define CLR_NONE    0xFFFFFFFFL
  119. #define CLR_DEFAULT 0xFF000000L
  120. struct _IMAGELIST;
  121. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  122. #define ILC_MASK        0x0001      // ImageList has a mask
  123. #define ILC_COLOR       0           // use default
  124. #define ILC_COLORMASK   0x00FE      // ;Internal
  125. #define ILC_COLORDDB    0x00FE      // use device dependent bitmap
  126. #define ILC_COLOR4      0x0004      // use 4bpp DIBSection
  127. #define ILC_COLOR8      0x0008      // use 8bpp DIBSection
  128. #define ILC_COLOR16     0x0010      // use 16bpp DIBSection
  129. #define ILC_COLOR24     0x0018      // use 24bpp DIBSection
  130. #define ILC_COLOR32     0x0020      // use 32bpp DIBSection
  131. #define ILC_SHARED      0x0100      // this is a shareable image list                               /* ;Internal */
  132. #define ILC_LARGESMALL  0x0200      // contains both large and small images (not implenented)       /* ;Internal */
  133. #define ILC_UNIQUE      0x0400      // makes sure no dup. image exists in list (not implenented)    /* ;Internal */
  134. #define ILC_PALETTE     0x0800      // use palette with image list (not implenented)                /* ;Internal */
  135. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
  136. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Destroy(HIMAGELIST himl);
  137. WINCOMMCTRLAPI int         WINAPI ImageList_GetImageCount(HIMAGELIST himl);
  138. WINCOMMCTRLAPI int         WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  139. WINCOMMCTRLAPI int         WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  140. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  141. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_GetBkColor(HIMAGELIST himl);
  142. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  143. #define     ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon)
  144. #define ILD_NORMAL      0x0000          // use current bkcolor
  145. #define ILD_TRANSPARENT 0x0001          // force transparent icon style (override bk color)
  146. #define ILD_MASK        0x0010          // draw the mask
  147. #define ILD_IMAGE       0x0020          // draw the image
  148. #define ILD_BLENDMASK   0x000E          // ;Internal
  149. #define ILD_BLEND25     0x0002          // blend 25%
  150. #define ILD_BLEND50     0x0004          // blend 50%
  151. #define ILD_BLEND75     0x0008          // blend 75% (not implemented!) // ;Internal
  152. #define ILD_OVERLAYMASK 0x0F00 // use these as indexes into special items
  153. #define INDEXTOOVERLAYMASK(i) ((i) << 8)    //
  154. #define OVERLAYMASKTOINDEX(i) ((((i) >> 8) & (ILD_OVERLAYMASK >> 8))-1) // ;Internal
  155. // old flags we still keep around       /* ;Internal */
  156. #define ILD_SELECTED    ILD_BLEND50     // draw as selected
  157. #define ILD_FOCUS       ILD_BLEND25     // draw as focused (selection)
  158. #define ILD_BLEND       ILD_BLEND50     // blend 50%
  159. #define CLR_HILIGHT     CLR_DEFAULT     // draw using default color
  160. WINCOMMCTRLAPI BOOL WINAPI ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle);
  161. // BUGBUG remove these! /* ;Internal */
  162. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetIconSize(HIMAGELIST himl, int FAR *cx, int FAR *cy);                                           /* ;Internal */
  163. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetImageRect(HIMAGELIST himl, int i, RECT FAR* prcImage);                                         /* ;Internal */
  164. 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); /* ;Internal */
  165. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Remove(HIMAGELIST himl, int i);                                                                   /* ;Internal */
  166. #ifdef _WIN32
  167. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask);
  168. WINCOMMCTRLAPI int         WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask);
  169. 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);
  170. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Remove(HIMAGELIST himl, int i);
  171. WINCOMMCTRLAPI HICON       WINAPI ImageList_GetIcon(HIMAGELIST himl, int i, UINT flags);
  172. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImage(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  173. WINCOMMCTRLAPI BOOL WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot);
  174. WINCOMMCTRLAPI void WINAPI ImageList_EndDrag();
  175. WINCOMMCTRLAPI BOOL WINAPI ImageList_DragEnter(HWND hwndLock, int x, int y);
  176. WINCOMMCTRLAPI BOOL WINAPI ImageList_DragLeave(HWND hwndLock);
  177. WINCOMMCTRLAPI BOOL WINAPI ImageList_DragMove(int x, int y);
  178. WINCOMMCTRLAPI BOOL WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot);
  179. WINCOMMCTRLAPI BOOL WINAPI ImageList_DragShowNolock(BOOL fShow);
  180. WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_GetDragImage(POINT FAR* ppt,POINT FAR* pptHotspot);
  181. #define     ImageList_RemoveAll(himl) ImageList_Remove(himl, -1)
  182. #define     ImageList_ExtractIcon(hi, himl, i) ImageList_GetIcon(himl, i, 0)
  183. #define     ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask) ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)
  184. #ifdef __IStream_INTERFACE_DEFINED__
  185. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Read(LPSTREAM pstm);
  186. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
  187. #endif
  188. typedef struct _IMAGEINFO
  189. {
  190.     HBITMAP hbmImage;
  191.     HBITMAP hbmMask;
  192.     int     Unused1;
  193.     int     Unused2;
  194.     RECT    rcImage;
  195. } IMAGEINFO;
  196. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetIconSize(HIMAGELIST himl, int FAR *cx, int FAR *cy);
  197. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetIconSize(HIMAGELIST himl, int cx, int cy);
  198. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO FAR* pImageInfo);
  199. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
  200. #endif // _WIN32
  201. //================ HEADER APIS =============================================
  202. //
  203. // Class name: SysHeader (WC_HEADER)
  204. //
  205. // The SysHeader control provides for column and row headers much like those
  206. // found in MSMail and Excel.  Header items appear as text on a gray
  207. // background. Items can behave as pushbuttons, in which case they have a
  208. // raised face.
  209. //
  210. // SysHeaders support changing width or height of items using the mouse.
  211. // These controls do not support a keyboard interface, so they do not accept
  212. // the input focus.
  213. //
  214. // There are notifications that allow applications to determine when an item
  215. // has been clicked or double clicked, width change has occured, drag tracking
  216. // is occuring, etc.
  217. //
  218. //////////////////////////////////////////////////////////////////////////////
  219. #ifdef _WIN32
  220. #define WC_HEADER       "SysHeader32"
  221. #else
  222. #define WC_HEADER       "SysHeader"
  223. #endif
  224. // Header control styles
  225. #define HDS_HORZ            0x00000000  // Horizontal header
  226. #define HDS_VERT            0x00000001  // ;Internal BUGBUG: not implemente
  227. #define HDS_BUTTONS         0x00000002  // Items act as buttons
  228. #define HDS_DIVIDERTRACK    0x00000004  // ;Internal (on by default) width tracking
  229. #define HDS_HIDDEN      0x00000008  // don't show the headers (use as info storage), actually goes to 0 height
  230. // The HD_ITEM structure describes a header item.
  231. // The first field contains a combination of HDI_* flags
  232. // indicating which fields contain valid data.
  233. //
  234. typedef struct _HD_ITEM
  235. {
  236.     UINT    mask;
  237.     int     cxy;            // width (HDS_HORZ) or height (HDS_VERT)
  238.     LPSTR   pszText;
  239.     HBITMAP hbm;            // Bitmap to use (implies HDF_BITMAP)
  240.     int     cchTextMax;     // Valid only for GetItem: contains size of buffer
  241.     int     fmt;            // HDF_* value
  242.     LPARAM  lParam;
  243. } HD_ITEM;
  244. // HD_ITEM mask flags
  245. #define HDI_WIDTH       0x0001
  246. #define HDI_HEIGHT      HDI_WIDTH
  247. #define HDI_TEXT        0x0002
  248. #define HDI_FORMAT      0x0004
  249. #define HDI_LPARAM      0x0008
  250. #define HDI_BITMAP      0x0010
  251. #define HDI_ALL         0x001f  /* ;Internal */
  252. // HD_ITEM fmt field values
  253. // First justification values
  254. #define HDF_LEFT        0
  255. #define HDF_RIGHT       1
  256. #define HDF_CENTER      2
  257. #define HDF_JUSTIFYMASK 0x0003
  258. //
  259. // MidEast languages only
  260. #define HDF_RTLREADING  4
  261. // Now other formating options
  262. #define HDF_OWNERDRAW   0x8000
  263. #define HDF_STRING      0x4000
  264. #define HDF_BITMAP      0x2000
  265. // Returns number of items in header.
  266. //
  267. // int Header_GetItemCount(HWND hwndHD);
  268. //
  269. #define HDM_GETITEMCOUNT    (HDM_FIRST + 0)
  270. #define Header_GetItemCount(hwndHD) 
  271.     (int)SendMessage((hwndHD), HDM_GETITEMCOUNT, 0, 0L)
  272. // Insert header item at specified index.  Item is inserted at end if
  273. // i is greater than or equal to the number of items in the header.
  274. // Returns the index of the inserted item.
  275. //
  276. // int Header_InsertItem(HWND hwndHD, int i, const HD_ITEM FAR* pitem);
  277. //
  278. #define HDM_INSERTITEM      (HDM_FIRST + 1)
  279. #define Header_InsertItem(hwndHD, i, phdi) 
  280.     (int)SendMessage((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  281. // Delete a header item at the specified index.
  282. //
  283. // BOOL Header_DeleteItem(HWND hwndHD, int i);
  284. //
  285. #define HDM_DELETEITEM      (HDM_FIRST + 2)
  286. #define Header_DeleteItem(hwndHD, i) 
  287.     (BOOL)SendMessage((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(i), 0L)
  288. // Get header item at index i.  The mask field of the pointed-to
  289. // HD_ITEM structure indicates which fields will be set by this
  290. // function; other fields are not changed.
  291. //
  292. // The cchTextMax field of *pitem contains the maximum
  293. // length of the returned string.
  294. //
  295. // BOOL Header_GetItem(HWND hwndHD, int i, HD_ITEM FAR* phdi);
  296. //
  297. #define HDM_GETITEM         (HDM_FIRST + 3)
  298. #define Header_GetItem(hwndHD, i, phdi) 
  299.     (BOOL)SendMessage((hwndHD), HDM_GETITEM, (WPARAM)(int)(i), (LPARAM)(HD_ITEM FAR*)(phdi))
  300. // Set header item at index i.  The mask field of the pointed-to
  301. // HD_ITEM structure indicates which header item attributes will
  302. // be changed by this call; other fields of *pitem that do not
  303. // correspond to pitem->mask are ignored.
  304. //
  305. // The cchTextMax of *pitem is ignored.
  306. //
  307. // BOOL Header_SetItem(HWND hwndHD, int i, const HD_ITEM FAR* phdi);
  308. //
  309. #define HDM_SETITEM         (HDM_FIRST + 4)
  310. #define Header_SetItem(hwndHD, i, phdi) 
  311.     (BOOL)SendMessage((hwndHD), HDM_SETITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  312. // Calculate size and position of header within a rectangle.
  313. // Results are returned in a WINDOWPOS structure you supply,
  314. // and the layout rectangle is adjusted to exclude the leftover area.
  315. //
  316. typedef struct _HD_LAYOUT
  317. {
  318.     RECT FAR* prc;
  319.     WINDOWPOS FAR* pwpos;
  320. } HD_LAYOUT;
  321. // BOOL Header_Layout(HWND hwndHD, HD_LAYOUT FAR* playout);
  322. //
  323. #define HDM_LAYOUT          (HDM_FIRST + 5)
  324. #define Header_Layout(hwndHD, playout) 
  325.     (BOOL)SendMessage((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout))
  326. #define HHT_NOWHERE         0x0001
  327. #define HHT_ONHEADER        0x0002
  328. #define HHT_ONDIVIDER       0x0004
  329. #define HHT_ONDIVOPEN       0x0008
  330. #define HHT_ABOVE           0x0100
  331. #define HHT_BELOW           0x0200
  332. #define HHT_TORIGHT         0x0400
  333. #define HHT_TOLEFT          0x0800
  334. typedef struct _HD_HITTESTINFO
  335. {
  336.     POINT pt;     // in: client coords
  337.     UINT flags;     // out: HHT_ flags
  338.     int iItem;     // out: item
  339. } HD_HITTESTINFO;
  340. #define HDM_HITTEST          (HDM_FIRST + 6)
  341. // Header Notifications
  342. //
  343. // All header notifications are via the WM_NOTIFY message.
  344. // lParam of WM_NOTIFY points to a HD_NOTIFY structure for
  345. // all of the following notifications.
  346. // *pitem contains item being changed.  pitem->mask indicates
  347. // which fields are valid (others have indeterminate state)
  348. //
  349. #define HDN_ITEMCHANGING    (HDN_FIRST-0)
  350. #define HDN_ITEMCHANGED     (HDN_FIRST-1)
  351. // Item has been clicked or doubleclicked (HDS_BUTTONS only)
  352. // iButton contains button id: 0=left, 1=right, 2=middle.
  353. //
  354. #define HDN_ITEMCLICK       (HDN_FIRST-2)
  355. #define HDN_ITEMDBLCLICK    (HDN_FIRST-3)
  356. // Divider area has been clicked or doubleclicked (HDS_DIVIDERTRACK only)
  357. // iButton contains button id: 0=left, 1=right, 2=middle.
  358. //
  359. #define HDN_DIVIDERDBLCLICK (HDN_FIRST-5)
  360. // Begin/end divider tracking (HDS_DIVIDERTRACK only)
  361. // Return TRUE from HDN_BEGINTRACK notification to prevent tracking.
  362. //
  363. #define HDN_BEGINTRACK      (HDN_FIRST-6)
  364. #define HDN_ENDTRACK        (HDN_FIRST-7)
  365. // HDN_DRAG: cxy field contains new height/width, which may be < 0.
  366. // Changing this value will affect the tracked height/width (allowing
  367. // for gridding, pinning, etc).
  368. //
  369. // Return TRUE to cancel tracking.
  370. //
  371. #define HDN_TRACK           (HDN_FIRST-8)
  372. typedef struct _HD_NOTIFY
  373. {
  374.     NMHDR   hdr;
  375.     int     iItem;
  376.     int     iButton;        // *CLICK notifications: 0=left, 1=right, 2=middle
  377.     HD_ITEM FAR* pitem;     // May be NULL
  378. } HD_NOTIFY;
  379. #ifndef NOTOOLBAR
  380. #ifdef _WIN32
  381. #define TOOLBARCLASSNAME "ToolbarWindow32"
  382. #else
  383. #define TOOLBARCLASSNAME "ToolbarWindow"
  384. #endif
  385. typedef struct _TBBUTTON {
  386. /* ;Internal REVIEW: index, command, flag words, resource ids should be UINT */
  387.     int iBitmap; /* index into bitmap of this button's picture */
  388.     int idCommand; /* WM_COMMAND menu ID that this button sends */
  389.     BYTE fsState; /* button's state */
  390.     BYTE fsStyle; /* button's style */
  391. #ifdef _WIN32
  392.     BYTE bReserved[2];  /* Realign to DWORD */
  393. #endif
  394.     DWORD dwData; /* app defined data */
  395.     int iString; /* index into string list */
  396. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  397. typedef const TBBUTTON FAR* LPCTBBUTTON;
  398. /* ;Internal REVIEW: is this internal? if not, call it TBCOLORMAP, prefix tbc */
  399. typedef struct _COLORMAP {
  400.     COLORREF from;
  401.     COLORREF to;
  402. } COLORMAP, FAR* LPCOLORMAP;
  403. WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  404. HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  405. int iNumButtons, int dxButton, int dyButton,
  406. int dxBitmap, int dyBitmap, UINT uStructSize);
  407. WINCOMMCTRLAPI HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, int idBitmap,
  408.                                   UINT wFlags, LPCOLORMAP lpColorMap,
  409.   int iNumMaps);
  410. #define CMB_DISCARDABLE 0x01 /* ;Internal BUGBUG: remove this */
  411. #define CMB_MASKED 0x02 /* create image/mask pair in bitmap */
  412. /*REVIEW: TBSTATE_* should be TBF_* (for Flags) */
  413. #define TBSTATE_CHECKED 0x01 /* radio button is checked */
  414. #define TBSTATE_PRESSED 0x02 /* button is being depressed (any style) */
  415. #define TBSTATE_ENABLED 0x04 /* button is enabled */
  416. #define TBSTATE_HIDDEN 0x08 /* button is hidden */
  417. #define TBSTATE_INDETERMINATE 0x10 /* button is indeterminate */
  418. #define TBSTATE_WRAP 0x20 /* there is a line break after this button */
  419.                                         /*  (needs to be endabled, too) */
  420. #define TBSTYLE_BUTTON 0x00 /* this entry is button */
  421. #define TBSTYLE_SEP 0x01 /* this entry is a separator */
  422. #define TBSTYLE_CHECK 0x02 /* this is a check button (it stays down) */
  423. #define TBSTYLE_GROUP 0x04 /* this is a check button (it stays down) */
  424. #define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) /* this group is a member of a group radio group */
  425. /* TOOLBAR window styles (not button, not trackbar) */
  426. #define TBSTYLE_TOOLTIPS 0x0100    /* make/use a tooltips control */
  427. #define TBSTYLE_WRAPABLE 0x0200    /* wrappable */
  428. #define TBSTYLE_ALTDRAG  0x0400   /* use ALT for drag/drop customize instead of SHIFT */
  429. #define TB_ENABLEBUTTON (WM_USER + 1)
  430. #define TB_CHECKBUTTON (WM_USER + 2)
  431. #define TB_PRESSBUTTON (WM_USER + 3)
  432. #define TB_HIDEBUTTON (WM_USER + 4)
  433. #define TB_INDETERMINATE (WM_USER + 5)
  434. /* ;Internal Messages up to WM_USER+8 are reserved until we define more state bits */
  435. #define TB_ISBUTTONENABLED (WM_USER + 9)
  436. #define TB_ISBUTTONCHECKED (WM_USER + 10)
  437. #define TB_ISBUTTONPRESSED (WM_USER + 11)
  438. #define TB_ISBUTTONHIDDEN (WM_USER + 12)
  439. #define TB_ISBUTTONINDETERMINATE    (WM_USER + 13)
  440. /* ;Internal Messages up to WM_USER+16 are reserved until we define more state bits */
  441. #define TB_SETSTATE             (WM_USER + 17)
  442. #define TB_GETSTATE             (WM_USER + 18)
  443. #define TB_ADDBITMAP (WM_USER + 19)
  444. #ifdef _WIN32
  445. typedef struct {
  446. HINSTANCE hInst; // module handle or NULL, or HINST_COMMCTRL
  447. UINT nID; // if hInst == NULL, HBITMAP, else ID
  448. } TBADDBITMAP, *LPTBADDBITMAP;
  449. #define HINST_COMMCTRL ((HINSTANCE)-1)
  450. #define IDB_STD_SMALL_COLOR 0
  451. #define IDB_STD_LARGE_COLOR 1
  452. #define IDB_STD_SMALL_MONO 2 /* ;Internal not supported yet */
  453. #define IDB_STD_LARGE_MONO 3 /* ;Internal not supported yet */
  454. #define IDB_VIEW_SMALL_COLOR 4
  455. #define IDB_VIEW_LARGE_COLOR 5
  456. #define IDB_VIEW_SMALL_MONO 6 /* ;Internal not supported yet */
  457. #define IDB_VIEW_LARGE_MONO 7 /* ;Internal not supported yet */
  458. // icon indexes for standard bitmap
  459. #define STD_CUT 0
  460. #define STD_COPY 1
  461. #define STD_PASTE 2
  462. #define STD_UNDO 3
  463. #define STD_REDOW 4
  464. #define STD_DELETE 5
  465. #define STD_FILENEW 6
  466. #define STD_FILEOPEN 7
  467. #define STD_FILESAVE 8
  468. #define STD_PRINTPRE 9
  469. #define STD_PROPERTIES 10
  470. #define STD_HELP 11
  471. #define STD_FIND 12
  472. #define STD_REPLACE 13
  473. #define STD_PRINT 14
  474. // icon indexes for standard view bitmap
  475. #define VIEW_LARGEICONS 0
  476. #define VIEW_SMALLICONS 1
  477. #define VIEW_LIST 2
  478. #define VIEW_DETAILS 3
  479. #define VIEW_SORTNAME 4
  480. #define VIEW_SORTSIZE 5
  481. #define VIEW_SORTDATE 6
  482. #define VIEW_SORTTYPE 7
  483. #define VIEW_PARENTFOLDER 8
  484. #define VIEW_NETCONNECT 9
  485. #define VIEW_NETDISCONNECT 10
  486. #define VIEW_NEWFOLDER  11
  487. #endif
  488. #define TB_ADDBUTTONS (WM_USER + 20)
  489. #define TB_INSERTBUTTON (WM_USER + 21)
  490. #define TB_DELETEBUTTON (WM_USER + 22)
  491. #define TB_GETBUTTON (WM_USER + 23)
  492. #define TB_BUTTONCOUNT (WM_USER + 24)
  493. #define TB_COMMANDTOINDEX (WM_USER + 25)
  494. #ifdef _WIN32
  495. typedef struct {
  496.     HKEY hkr;
  497.     LPCSTR pszSubKey;
  498.     LPCSTR pszValueName;
  499. } TBSAVEPARAMS;
  500. // wParam: BOOL (TRUE -> save state, FALSE -> restore
  501. // lParam: pointer to TBSAVERESTOREPARAMS
  502. #endif
  503. #define TB_SAVERESTORE (WM_USER + 26)
  504. #define TB_CUSTOMIZE            (WM_USER + 27)
  505. #define TB_ADDSTRING (WM_USER + 28)
  506. #define TB_GETITEMRECT (WM_USER + 29)
  507. #define TB_BUTTONSTRUCTSIZE (WM_USER + 30)
  508. #define TB_SETBUTTONSIZE (WM_USER + 31)
  509. #define TB_SETBITMAPSIZE (WM_USER + 32)
  510. #define TB_AUTOSIZE (WM_USER + 33)
  511. #define TB_SETBUTTONTYPE (WM_USER + 34)                          /* ;Internal */
  512. #define TB_GETTOOLTIPS (WM_USER + 35)
  513. #define TB_SETTOOLTIPS (WM_USER + 36)
  514. #define TB_SETPARENT (WM_USER + 37)
  515. #ifdef _WIN32 /* ;Internal */
  516. #define TB_ADDBITMAP32 (WM_USER + 38) /* ;Internal */
  517. #endif /* ;Internal */
  518. #define TB_SETROWS (WM_USER + 39)
  519. #define TB_GETROWS (WM_USER + 40)
  520. #define TB_SETCMDID (WM_USER + 42)
  521. #define TB_CHANGEBITMAP (WM_USER + 43)
  522. #define TB_GETBITMAP (WM_USER + 44)
  523. #define TB_GETBUTTONTEXT        (WM_USER + 45)
  524. #define TB_REPLACEBITMAP        (WM_USER + 46)
  525. typedef struct {
  526. HINSTANCE hInstOld;
  527. UINT nIDOld;
  528. HINSTANCE hInstNew;
  529. UINT nIDNew;
  530.         int             nButtons;
  531. } TBREPLACEBITMAP, *LPTBREPLACEBITMAP;
  532. #ifdef _WIN32
  533. #define TBBF_LARGE 0x0001
  534. #define TBBF_MONO 0x0002 /* ;Internal not supported yet */
  535. // returns TBBF_ flags
  536. #define TB_GETBITMAPFLAGS (WM_USER + 41)
  537. #define TBN_GETBUTTONINFO (TBN_FIRST-0)
  538. #define TBN_BEGINDRAG (TBN_FIRST-1)
  539. #define TBN_ENDDRAG (TBN_FIRST-2)
  540. #define TBN_BEGINADJUST (TBN_FIRST-3)
  541. #define TBN_ENDADJUST (TBN_FIRST-4)
  542. #define TBN_RESET (TBN_FIRST-5)
  543. #define TBN_QUERYINSERT (TBN_FIRST-6)
  544. #define TBN_QUERYDELETE (TBN_FIRST-7)
  545. #define TBN_TOOLBARCHANGE (TBN_FIRST-8)
  546. #define TBN_CUSTHELP (TBN_FIRST-9)
  547. typedef struct {
  548.     NMHDR   hdr;
  549.     int     iItem;
  550.     TBBUTTON tbButton;
  551.     int     cchText;
  552.     LPSTR   pszText;
  553. } TBNOTIFY, FAR *LPTBNOTIFY;
  554. #else /* ;Internal */
  555. // for compatibility with the old 16 bit WM_COMMAND hacks /* ;Internal */
  556. typedef struct _ADJUSTINFO { /* ;Internal */
  557.     TBBUTTON tbButton; /* ;Internal */
  558.     char szDescription[1];         /* ;Internal */
  559. } ADJUSTINFO, NEAR* PADJUSTINFO, FAR* LPADJUSTINFO; /* ;Internal */
  560. #define TBN_BEGINDRAG 0x0201 /* ;Internal */
  561. #define TBN_ENDDRAG 0x0203 /* ;Internal */
  562. #define TBN_BEGINADJUST 0x0204 /* ;Internal */
  563. #define TBN_ADJUSTINFO 0x0205 /* ;Internal */
  564. #define TBN_ENDADJUST 0x0206 /* ;Internal */
  565. #define TBN_RESET 0x0207 /* ;Internal */
  566. #define TBN_QUERYINSERT 0x0208 /* ;Internal */
  567. #define TBN_QUERYDELETE 0x0209 /* ;Internal */
  568. #define TBN_TOOLBARCHANGE 0x020a /* ;Internal */
  569. #define TBN_CUSTHELP 0x020b /* ;Internal */
  570. /* ;Internal */
  571. #endif
  572. #endif /* NOTOOLBAR */
  573. /*//////////////////////////////////////////////////////////////////////*/
  574. #ifndef NOTOOLTIPS
  575. #ifdef _WIN32
  576. #define TOOLTIPS_CLASS "tooltips_class32"
  577. #else
  578. #define TOOLTIPS_CLASS "tooltips_class"
  579. #endif
  580. typedef struct {
  581.     UINT cbSize;
  582.     UINT uFlags;
  583.     HWND hwnd;
  584.     UINT uId;
  585.     RECT rect;
  586.     HINSTANCE hinst;
  587.     LPSTR lpszText;
  588.     LPARAM lParam;
  589. } TOOLINFO, NEAR *PTOOLINFO, FAR *LPTOOLINFO;
  590. #define TTS_ALWAYSTIP           0x01            // check over inactive windows as well
  591. #define TTS_NOPREFIX            0x02
  592. #define TTF_IDISHWND            0x0001
  593. #define TTF_CENTERTIP           0x0002
  594. #define TTF_RTLREADING          0x0004
  595. #define TTF_STRIPACCELS         0x0008       // (this is implicit now) // ;Internal
  596. #define TTF_SUBCLASS            0x0010
  597. #define TTF_TRACK               0x0020
  598. #define TTF_UNICODE             0x0040       // Unicode Notify's       // ;Internal
  599. #define TTF_ABSOLUTE            0x0080
  600. #define TTF_TRANSPARENT         0x0100
  601. #define TTF_DI_SETITEM          0x8000       // valid only on the TTN_NEEDTEXT callback
  602. #define TTDT_AUTOMATIC          0
  603. #define TTDT_RESHOW             1
  604. #define TTDT_AUTOPOP            2
  605. #define TTDT_INITIAL            3
  606. #define TTM_ACTIVATE (WM_USER + 1)   // wparam = BOOL (true or false  = activate or deactivate)
  607. #define TTM_SETDELAYTIME (WM_USER + 3)
  608. #define TTM_ADDTOOL (WM_USER + 4)
  609. #define TTM_DELTOOL (WM_USER + 5)
  610. #define TTM_NEWTOOLRECT (WM_USER + 6)
  611. #define TTM_RELAYEVENT (WM_USER + 7)
  612. // lParam has TOOLINFO with hwnd and wid.  this gets filled in
  613. #define TTM_GETTOOLINFO     (WM_USER + 8)
  614. // lParam has TOOLINFO
  615. #define TTM_SETTOOLINFO     (WM_USER + 9)
  616. // returns true or false for found, not found.
  617. // fills in LPHITTESTINFO->ti
  618. #define TTM_HITTEST             (WM_USER +10)
  619. #define TTM_GETTEXT             (WM_USER +11)
  620. #define TTM_UPDATETIPTEXT       (WM_USER +12)
  621. #define TTM_GETTOOLCOUNT        (WM_USER +13)
  622. #define TTM_ENUMTOOLS           (WM_USER +14)
  623. #define TTM_GETCURRENTTOOL      (WM_USER + 15)
  624. #define TTM_WINDOWFROMPOINT     (WM_USER + 16)
  625. #define TTM_TRACKACTIVATE       (WM_USER + 17)  // wParam = TRUE/FALSE start end  lparam = LPTOOLINFO
  626. #define TTM_TRACKPOSITION       (WM_USER + 18)  // lParam = dwPos
  627. #define TTM_SETTIPBKCOLOR       (WM_USER + 19)
  628. #define TTM_SETTIPTEXTCOLOR     (WM_USER + 20)
  629. #define TTM_GETDELAYTIME        (WM_USER + 21)
  630. #define TTM_GETTIPBKCOLOR       (WM_USER + 22)
  631. #define TTM_GETTIPTEXTCOLOR     (WM_USER + 23)
  632. typedef struct _TT_HITTESTINFO {
  633.     HWND hwnd;
  634.     POINT pt;
  635.     TOOLINFO ti;
  636. } TTHITTESTINFO, FAR * LPHITTESTINFO;
  637. // WM_NOTIFY message sent to parent window to get tooltip text
  638. // if LPSTR_TEXTCALLBACK is set on any tips
  639. #define TTN_NEEDTEXT (TTN_FIRST - 0)
  640. #define TTN_SHOW        (TTN_FIRST - 1)
  641. #define TTN_POP         (TTN_FIRST - 2)
  642. // WM_NOTIFY structure sent if TTF_QUERYFORTIP is set
  643. // the host can
  644. // 1) fill in the szText,
  645. // 2) point lpszText to their own text
  646. // 3) put a resource id number in lpszText
  647. //      and point hinst to the hinstance to load from
  648. typedef struct {
  649.     NMHDR hdr;
  650.     LPSTR lpszText;
  651.     char szText[80];
  652.     HINSTANCE hinst;
  653.     UINT uFlags;
  654.     LPARAM lParam;
  655. } TOOLTIPTEXT, FAR *LPTOOLTIPTEXT;
  656. #endif //NOTOOLTIPS
  657. /*/////////////////////////////////////////////////////////////////////////*/
  658. #ifndef NOSTATUSBAR
  659. /*REVIEW: Here exists the only known documentation for status bars. */
  660. // SBS_* styles need to not overlap with CCS_* values
  661. // want a size gripper on a status bar.  this only applies if the
  662. // DrawFrameControl function is available.
  663. #define SBARS_SIZEGRIP 0x0100
  664. /* DrawStatusText:
  665.  * This is used if the app wants to draw status in its client rect,
  666.  * instead of just creating a window.  Note that this same function is
  667.  * used internally in the status bar window's WM_PAINT message.
  668.  * hDC is the DC to draw to.  The font that is selected into hDC will
  669.  * be used.  The RECT lprc is the only portion of hDC that will be drawn
  670.  * to: the outer edge of lprc will have the highlights (the area outside
  671.  * of the highlights will not be drawn in the BUTTONFACE color: the app
  672.  * must handle that).  The area inside the highlights will be erased
  673.  * properly when drawing the text.
  674.  */
  675. WINCOMMCTRLAPI void WINAPI DrawStatusText(HDC hDC, LPRECT lprc, LPCSTR szText, UINT uFlags);
  676. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindow(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
  677. #ifdef _WIN32
  678. #define STATUSCLASSNAME "msctls_statusbar32"
  679. #else
  680. #define STATUSCLASSNAME "msctls_statusbar"
  681. #endif
  682. #define SB_SETTEXT (WM_USER+1)
  683. #define SB_GETTEXT (WM_USER+2)
  684. #define SB_GETTEXTLENGTH (WM_USER+3)
  685. /* Just like WM_?ETTEXT*, with wParam specifying the pane that is referenced
  686.  * (at most 255).
  687.  * Note that you can use the WM_* versions to reference the 0th pane (this
  688.  * is useful if you want to treat a "default" status bar like a static text
  689.  * control).
  690.  * For SETTEXT, wParam is the pane or'ed with SBT_* style bits (defined below).
  691.  * If the text is "normal" (not OWNERDRAW), then a single pane may have left,
  692.  * center, and right justified text by separating the parts with a single tab,
  693.  * plus if lParam is NULL, then the pane has no text.  The pane will be
  694.  * invalidated, but not draw until the next PAINT message.
  695.  * For GETTEXT and GETTEXTLENGTH, the LOWORD of the return will be the length,
  696.  * and the HIWORD will be the SBT_* style bits.
  697.  */
  698. #define SB_SETPARTS (WM_USER+4)
  699. /* wParam is the number of panes, and lParam points to an array of points
  700.  * specifying the right hand side of each pane.  A right hand side of -1 means
  701.  * it goes all the way to the right side of the control minus the X border
  702.  */
  703. #define SB_SETBORDERS (WM_USER+5) /* ;Internal */
  704. #define SB_GETPARTS (WM_USER+6)
  705. /* lParam is a pointer to an array of integers that will get filled in with
  706.  * the right hand side of each pane and wParam is the size (in integers)
  707.  * of the lParam array (so we do not go off the end of it).
  708.  * Returns the number of panes.
  709.  */
  710. #define SB_GETBORDERS (WM_USER+7)
  711. /* lParam is a pointer to an array of 3 integers that will get filled in with
  712.  * the X border, the Y border, and the between pane border.
  713.  */
  714. #define SB_SETMINHEIGHT (WM_USER+8)
  715. /* wParam is the minimum height of the status bar "drawing" area.  This is
  716.  * the area inside the highlights.  This is most useful if a pane is used
  717.  * for an OWNERDRAW item, and is ignored if the SBS_NORESIZE flag is set.
  718.  * Note that WM_SIZE (wParam=0, lParam=0L) must be sent to the control for
  719.  * any size changes to take effect.
  720.  */
  721. #define SB_SIMPLE (WM_USER+9)
  722. /* wParam specifies whether to set (non-zero) or unset (zero) the "simple"
  723.  * mode of the status bar.  In simple mode, only one pane is displayed, and
  724.  * its text is set with LOWORD(wParam)==255 in the SETTEXT message.
  725.  * OWNERDRAW is not allowed, but other styles are.
  726.  * The pane gets invalidated, but not painted until the next PAINT message,
  727.  * so you can set new text without flicker (I hope).
  728.  * This can be used with the WM_INITMENU and WM_MENUSELECT messages to
  729.  * implement help text when scrolling through a menu.
  730.  */
  731. #define SB_GETRECT              (WM_USER + 10)
  732. // wParam is the nth part
  733. // lparam is lprc
  734. // returns true if found a rect for wParam
  735. #ifndef _WIN32 /* ;Internal */
  736. #ifdef WANT_SUCKY_HEADER /* ;Internal */
  737.                                                                                 /* ;Internal */
  738. WINCOMMCTRLAPI HWND WINAPI CreateHeaderWindow(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID); /* ;Internal */
  739. /* ;Internal */
  740. #define HEADERCLASSNAME "msctls_headerbar" /* ;Internal */
  741. /* ;Internal */
  742. #define HB_SAVERESTORE (WM_USER+256) /* ;Internal */
  743. /* This gets a header bar to read or write its state to or from an ini file.   */ /* ;Internal */
  744. /* wParam is 0 for reading, non-zero for writing.  lParam is a pointer to      */ /* ;Internal */
  745. /* an array of two LPSTR's: the section and file respectively.        */ /* ;Internal */
  746. /* Note that the correct number of partitions must be set before calling this. */ /* ;Internal */
  747. #define HB_ADJUST (WM_USER+257) /* ;Internal */
  748. /* This puts the header bar into "adjust" mode, for changing column widths     */ /* ;Internal */
  749. /* with the keyboard.        */ /* ;Internal */
  750. #define HB_SETWIDTHS SB_SETPARTS /* ;Internal */
  751. /* Set the widths of the header columns.  Note that "springy" columns only     */ /* ;Internal */
  752. /* have a minumum width, and negative width are assumed to be hidden columns.  */ /* ;Internal */
  753. /* This works just like SB_SETPARTS.        */ /* ;Internal */
  754. #define HB_GETWIDTHS SB_GETPARTS /* ;Internal */
  755. /* Get the widths of the header columns.  Note that "springy" columns only     */ /* ;Internal */
  756. /* have a minumum width.  This works just like SB_GETPARTS.        */ /* ;Internal */
  757. #define HB_GETPARTS (WM_USER+258)         /* ;Internal */
  758. /* Get a list of the right-hand sides of the columns, for use when drawing the */ /* ;Internal */
  759. /* actual columns for which this is a header.        */ /* ;Internal */
  760. /* lParam is a pointer to an array of integers that will get filled in with    */ /* ;Internal */
  761. /* the right hand side of each pane and wParam is the size (in integers)       */ /* ;Internal */
  762. /* of the lParam array (so we do not go off the end of it).        */ /* ;Internal */
  763. /* Returns the number of panes.        */ /* ;Internal */
  764. #define HB_SHOWTOGGLE (WM_USER+259)         /* ;Internal */
  765. /* Toggle the hidden state of a column.  wParam is the 0-based index of the    */ /* ;Internal */
  766. /* column to toggle.        */ /* ;Internal */
  767. /* ;Internal */
  768. #define HBN_BEGINDRAG 0x0101 /* ;Internal */
  769. #define HBN_DRAGGING 0x0102 /* ;Internal */
  770. #define HBN_ENDDRAG 0x0103 /* ;Internal */
  771. #define HBN_BEGINADJUST 0x0111 /* ;Internal */
  772. #define HBN_ENDADJUST 0x0112 /* ;Internal */
  773. /* ;Internal */
  774. #endif /* ;Internal */
  775. #endif // _WIN32 /* ;Internal */
  776. #define SBT_OWNERDRAW 0x1000
  777. /* The lParam of the SB_SETTEXT message will be returned in the DRAWITEMSTRUCT
  778.  * of the WM_DRAWITEM message.  Note that the fields CtlType, itemAction, and
  779.  * itemState of the DRAWITEMSTRUCT are undefined for a status bar.
  780.  * The return value for GETTEXT will be the itemData.
  781.  */
  782. #define SBT_NOBORDERS 0x0100
  783. /* No borders will be drawn for the pane.
  784.  */
  785. #define SBT_POPOUT 0x0200
  786. /* The text pops out instead of in
  787.  */
  788. //
  789. // MidEast languages only
  790. #define SBT_RTLREADING  0x400
  791. #endif /* NOSTATUSBAR */
  792. /*/////////////////////////////////////////////////////////////////////////*/
  793. #ifndef NOMENUHELP
  794. WINCOMMCTRLAPI void WINAPI MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT FAR *lpwIDs);
  795. WINCOMMCTRLAPI BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo);
  796. WINCOMMCTRLAPI void WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo);
  797. /*REVIEW: is this internal? */
  798. #define MINSYSCOMMAND SC_SIZE
  799. #endif /* NOMENUHELP */
  800. /*/////////////////////////////////////////////////////////////////////////*/ /* ;Internal */
  801. /* ;Internal */
  802. #ifndef NOBTNLIST /* ;Internal */
  803. /* ;Internal */
  804. /*REVIEW: should be BUTTONLIST_CLASS */ /* ;Internal */
  805. #define BUTTONLISTBOX           "ButtonListBox" /* ;Internal */
  806. /* ;Internal */
  807. /* Button List Box Styles */ /* ;Internal */
  808. #define BLS_NUMBUTTONS      0x00FF /* ;Internal */
  809. #define BLS_VERTICAL        0x0100 /* ;Internal */
  810. #define BLS_NOSCROLL        0x0200 /* ;Internal */
  811. /* ;Internal */
  812. /* Button List Box Messages */ /* ;Internal */
  813. #define BL_ADDBUTTON        (WM_USER+1) /* ;Internal */
  814. #define BL_DELETEBUTTON     (WM_USER+2) /* ;Internal */
  815. #define BL_GETCARETINDEX    (WM_USER+3) /* ;Internal */
  816. #define BL_GETCOUNT         (WM_USER+4) /* ;Internal */
  817. #define BL_GETCURSEL        (WM_USER+5) /* ;Internal */
  818. #define BL_GETITEMDATA      (WM_USER+6) /* ;Internal */
  819. #define BL_GETITEMRECT      (WM_USER+7) /* ;Internal */
  820. #define BL_GETTEXT          (WM_USER+8) /* ;Internal */
  821. #define BL_GETTEXTLEN       (WM_USER+9) /* ;Internal */
  822. #define BL_GETTOPINDEX      (WM_USER+10) /* ;Internal */
  823. #define BL_INSERTBUTTON     (WM_USER+11) /* ;Internal */
  824. #define BL_RESETCONTENT     (WM_USER+12) /* ;Internal */
  825. #define BL_SETCARETINDEX    (WM_USER+13) /* ;Internal */
  826. #define BL_SETCURSEL        (WM_USER+14) /* ;Internal */
  827. #define BL_SETITEMDATA      (WM_USER+15) /* ;Internal */
  828. #define BL_SETTOPINDEX      (WM_USER+16) /* ;Internal */
  829. #define BL_MSGMAX           (WM_USER+17) /* ;Internal */ /* ;Internal */
  830. /* ;Internal */
  831. /* Button listbox notification codes send in WM_COMMAND */ /* ;Internal */
  832. #define BLN_ERRSPACE        (-2) /* ;Internal */
  833. #define BLN_SELCHANGE       1 /* ;Internal */
  834. #define BLN_CLICKED         2 /* ;Internal */
  835. #define BLN_SELCANCEL       3 /* ;Internal */
  836. #define BLN_SETFOCUS        4 /* ;Internal */
  837. #define BLN_KILLFOCUS       5 /* ;Internal */
  838. /* ;Internal */
  839. /* Message return values */ /* ;Internal */
  840. #define BL_OKAY             0 /* ;Internal */
  841. #define BL_ERR              (-1) /* ;Internal */
  842. #define BL_ERRSPACE         (-2) /* ;Internal */
  843. /* ;Internal */
  844. /* Create structure for    */ /* ;Internal */
  845. /* BL_ADDBUTTON and    */ /* ;Internal */
  846. /* BL_INSERTBUTTON    */ /* ;Internal */
  847. /*   lpCLB = (LPCREATELISTBUTTON)lParam    */ /* ;Internal */
  848. typedef struct { /* ;Internal */
  849.     UINT        cbSize;     /* size of structure */ /* ;Internal */
  850.     DWORD       dwItemData; /* user defined item data */ /* ;Internal */
  851.                             /* for LB_GETITEMDATA and LB_SETITEMDATA */ /* ;Internal */
  852.     HBITMAP     hBitmap;    /* button bitmap */ /* ;Internal */
  853.     LPCSTR      lpszText;   /* button text */ /* ;Internal */
  854. /* ;Internal */
  855. } CREATELISTBUTTON, FAR* LPCREATELISTBUTTON; /* ;Internal */
  856. /* ;Internal */
  857. #endif /* NOBTNLIST */ /* ;Internal */
  858. /*/////////////////////////////////////////////////////////////////////////*/
  859. // slider control
  860. #ifndef NOTRACKBAR
  861. /*
  862.     This control keeps its ranges in LONGs.  but for
  863.     convienence and symetry with scrollbars
  864.     WORD parameters are are used for some messages.
  865.     if you need a range in LONGs don't use any messages
  866.     that pack values into loword/hiword pairs
  867.     The trackbar messages:
  868.     message         wParam  lParam  return
  869.     TBM_GETPOS      ------  ------  Current logical position of trackbar.
  870.     TBM_GETRANGEMIN ------  ------  Current logical minimum position allowed.
  871.     TBM_GETRANGEMAX ------  ------  Current logical maximum position allowed.
  872.     TBM_SETTIC
  873.     TBM_SETPOS
  874.     TBM_SETRANGEMIN
  875.     TBM_SETRANGEMAX
  876. */
  877. #ifdef _WIN32
  878. #define TRACKBAR_CLASS          "msctls_trackbar32"
  879. #else
  880. #define TRACKBAR_CLASS          "msctls_trackbar"
  881. #endif
  882. /* Trackbar styles */
  883. /* add ticks automatically on TBM_SETRANGE message */
  884. #define TBS_AUTOTICKS           0x0001
  885. #define TBS_VERT                0x0002  /* vertical trackbar */
  886. #define TBS_HORZ                0x0000  /* default */
  887. #define TBS_TOP 0x0004  /* Ticks on top */
  888. #define TBS_BOTTOM 0x0000  /* Ticks on bottom  (default) */
  889. #define TBS_LEFT 0x0004  /* Ticks on left */
  890. #define TBS_RIGHT 0x0000  /* Ticks on right (default) */
  891. #define TBS_BOTH 0x0008  /* Ticks on both side */
  892. #define TBS_NOTICKS 0x0010
  893. #define TBS_ENABLESELRANGE 0x0020
  894. #define TBS_FIXEDLENGTH         0x0040  /* specifies that the thumb will be of fixed size */
  895. #define TBS_NOTHUMB             0x0080
  896. /* Trackbar messages */
  897. /* returns current position (LONG) */
  898. #define TBM_GETPOS              (WM_USER)
  899. /* set the min of the range to LPARAM */
  900. #define TBM_GETRANGEMIN         (WM_USER+1)
  901. /* set the max of the range to LPARAM */
  902. #define TBM_GETRANGEMAX         (WM_USER+2)
  903. /* wParam is index of tick to get (ticks are in the range of min - max) */
  904. #define TBM_GETTIC              (WM_USER+3)
  905. /* wParam is index of tick to set */
  906. #define TBM_SETTIC              (WM_USER+4)
  907. /* set the position to the value of lParam (wParam is the redraw flag) */
  908. #define TBM_SETPOS              (WM_USER+5)
  909. /* LOWORD(lParam) = min, HIWORD(lParam) = max, wParam == fRepaint */
  910. #define TBM_SETRANGE            (WM_USER+6)
  911. /* lParam is range min (use this to keep LONG precision on range) */
  912. #define TBM_SETRANGEMIN         (WM_USER+7)
  913. /* lParam is range max (use this to keep LONG precision on range) */
  914. #define TBM_SETRANGEMAX         (WM_USER+8)
  915. /* remove the ticks */
  916. #define TBM_CLEARTICS           (WM_USER+9)
  917. /* select a range LOWORD(lParam) min, HIWORD(lParam) max */
  918. #define TBM_SETSEL              (WM_USER+10)
  919. /* set selection rang (LONG form) */
  920. #define TBM_SETSELSTART         (WM_USER+11)
  921. #define TBM_SETSELEND           (WM_USER+12)
  922. /* return a pointer to the list of tics (DWORDS) */
  923. #define TBM_GETPTICS            (WM_USER+14)
  924. /* get the pixel position of a given tick */
  925. #define TBM_GETTICPOS           (WM_USER+15)
  926. /* get the number of tics */
  927. #define TBM_GETNUMTICS          (WM_USER+16)
  928. /* get the selection range */
  929. #define TBM_GETSELSTART         (WM_USER+17)
  930. #define TBM_GETSELEND           (WM_USER+18)
  931. /* clear the selection */
  932. #define TBM_CLEARSEL           (WM_USER+19)
  933. /* set tic frequency */
  934. #define TBM_SETTICFREQ (WM_USER+20)
  935. /* Set/get the page size */
  936. #define TBM_SETPAGESIZE         (WM_USER+21)  // lParam = lPageSize .  Returns old pagesize
  937. #define TBM_GETPAGESIZE         (WM_USER+22)
  938. /* Set/get the line size */
  939. #define TBM_SETLINESIZE         (WM_USER+23)
  940. #define TBM_GETLINESIZE         (WM_USER+24)
  941. /* Get the thumb's and channel's rect size */
  942. #define TBM_GETTHUMBRECT        (WM_USER+25) // lParam = lprc  .  for return value
  943. #define TBM_GETCHANNELRECT      (WM_USER+26) // lParam = lprc  .  for return value
  944. #define TBM_SETTHUMBLENGTH       (WM_USER+27) // wParam = UINT size
  945. #define TBM_GETTHUMBLENGTH       (WM_USER+28)
  946. /*REVIEW: these match the SB_ (scroll bar messages); define them that way? */
  947. #define TB_LINEUP 0
  948. #define TB_LINEDOWN 1
  949. #define TB_PAGEUP 2
  950. #define TB_PAGEDOWN 3
  951. #define TB_THUMBPOSITION 4
  952. #define TB_THUMBTRACK 5
  953. #define TB_TOP 6
  954. #define TB_BOTTOM 7
  955. #define TB_ENDTRACK             8
  956. #endif
  957. /*/////////////////////////////////////////////////////////////////////////*/
  958. #ifndef NODRAGLIST
  959. typedef struct {
  960.     UINT uNotification;
  961.     HWND hWnd;
  962.     POINT ptCursor;
  963. } DRAGLISTINFO, FAR *LPDRAGLISTINFO;
  964. #define DL_BEGINDRAG    (WM_USER+133)
  965. #define DL_DRAGGING     (WM_USER+134)
  966. #define DL_DROPPED      (WM_USER+135)
  967. #define DL_CANCELDRAG   (WM_USER+136)
  968. #define DL_CURSORSET 0
  969. #define DL_STOPCURSOR 1
  970. #define DL_COPYCURSOR 2
  971. #define DL_MOVECURSOR 3
  972. #define DRAGLISTMSGSTRING "commctrl_DragListMsg"
  973. WINCOMMCTRLAPI BOOL WINAPI MakeDragList(HWND hLB);
  974. WINCOMMCTRLAPI void WINAPI DrawInsert(HWND handParent, HWND hLB, int nItem);
  975. // BUGBUG -- there's a message to do this now -- just macro-ize this one   ;Internal
  976. WINCOMMCTRLAPI int WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll);
  977. #endif /* NODRAGLIST */
  978. /*/////////////////////////////////////////////////////////////////////////*/
  979. // spinner control
  980. #ifndef NOUPDOWN
  981. /*
  982. // OVERVIEW:
  983. //
  984. // The UpDown control is a simple pair of buttons which increment or
  985. // decrement an integer value.  The operation is similar to a vertical
  986. // scrollbar; except that the control only has line-up and line-down
  987. // functionality, and changes the current position automatically.
  988. //
  989. // The control also can be linked with a companion control, usually an
  990. // "edit" control, to simplify dialog-box management.  This companion is
  991. // termed a "buddy" in this documentation.  Any sibling HWND may be
  992. // assigned as the control's buddy, or the control may be allowed to
  993. // choose one automatically.  Once chosen, the UpDown can size itself to
  994. // match the buddy's right or left border, and/or automatically set the
  995. // text of the buddy control to make the current position visible.
  996. //
  997. // ADDITIONAL NOTES:
  998. //
  999. // The "upper" and "lower" limits must not cover a range larger than 32,767
  1000. // positions.  It is acceptable to have the range inverted, i.e., to have
  1001. // (lower > upper).  The upper button always moves the current position
  1002. // towards the "upper" number, and the lower button always moves towards the
  1003. // "lower" number.  If the range is zero (lower == upper), or the control
  1004. // is disabled (EnableWindow(hCtrl, FALSE)), the control draws grayed
  1005. // arrows in both buttons.  The UDS_WRAP style makes the range cyclic; that
  1006. // is, the numbers will wrap once one end of the range is reached.
  1007. //
  1008. // The buddy window must have the same parent as the UpDown control.
  1009. //
  1010. // If either of the UDS_ALIGN* styles are used, the updown control will
  1011. // locate itself on the "inside" of the buddy by resizing the buddy
  1012. // accordingly.  so the original size of the buddy will now emcompass
  1013. // both a slightly smaller buddy and the updown control.
  1014. //
  1015. // If the buddy window resizes, and the UDS_ALIGN* styles are used, it
  1016. // is necessary to send the UDM_SETBUDDY message to re-anchor the UpDown
  1017. // control on the appropriate border of the buddy window.
  1018. //
  1019. // The UDS_AUTOBUDDY style uses GetWindow(hCtrl, GW_HWNDPREV) to pick
  1020. // the best buddy window.  In the case of a DIALOG resource, this will
  1021. // choose the previous control listed in the resource script.  If the
  1022. // windows will change in Z-order, sending UDM_SETBUDDY with a NULL handle
  1023. // will pick a new buddy; otherwise the original auto-buddy choice is
  1024. // maintained.
  1025. //
  1026. // The UDS_SETBUDDYINT style uses its own SetDlgItemInt-style
  1027. // functionality to set the caption text of the buddy.  All WIN.INI [Intl]
  1028. // values are honored by this routine.
  1029. //
  1030. // The UDS_ARROWKEYS style will subclass the buddy window, in order to steal
  1031. // the VK_UP and VK_DOWN arrow key messages.
  1032. //
  1033. // The UDS_HORZ sytle will draw the two buttons side by side with
  1034. // left and right arrows instead of up and down arrows.  It will also
  1035. // send the WM_HSCROLL message instead
  1036. //
  1037. */
  1038. #ifdef _WIN32
  1039. #define UPDOWN_CLASS "msctls_updown32"
  1040. #else
  1041. #define UPDOWN_CLASS "msctls_updown"
  1042. #endif
  1043. /* Structures */
  1044. typedef struct _UDACCEL {
  1045.     UINT nSec;
  1046.     UINT nInc;
  1047. } UDACCEL, FAR *LPUDACCEL;
  1048. #define UD_MAXVAL 0x7fff
  1049. #define UD_MINVAL (-UD_MAXVAL)
  1050. /* STYLE BITS */
  1051. #define UDS_WRAP 0x0001
  1052. #define UDS_SETBUDDYINT 0x0002
  1053. #define UDS_ALIGNRIGHT 0x0004
  1054. #define UDS_ALIGNLEFT 0x0008
  1055. #define UDS_AUTOBUDDY 0x0010
  1056. #define UDS_ARROWKEYS 0x0020
  1057. #define UDS_HORZ                0x0040
  1058. #define UDS_NOTHOUSANDS 0x0080
  1059. /* MESSAGES */
  1060. #define UDM_SETRANGE (WM_USER+101)
  1061. /* wParam: not used, 0
  1062. // lParam: short LOWORD, new upper; short HIWORD, new lower limit
  1063. // return: not used
  1064. */
  1065. #define UDM_GETRANGE (WM_USER+102)
  1066. /* wParam: not used, 0
  1067. // lParam: not used, 0
  1068. // return: short LOWORD, upper; short HIWORD, lower limit
  1069. */
  1070. #define UDM_SETPOS (WM_USER+103)
  1071. /* wParam: not used, 0
  1072. // lParam: short LOWORD, new pos; HIWORD not used, 0
  1073. // return: short LOWORD, old pos; HIWORD not used
  1074. */
  1075. #define UDM_GETPOS (WM_USER+104)
  1076. /* wParam: not used, 0
  1077. // lParam: not used, 0
  1078. // return: short LOWORD, current pos; HIWORD not used
  1079. */
  1080. #define UDM_SETBUDDY (WM_USER+105)
  1081. /* wParam: HWND, new buddy
  1082. // lParam: not used, 0
  1083. // return: HWND LOWORD, old buddy; HIWORD not used
  1084. */
  1085. #define UDM_GETBUDDY (WM_USER+106)
  1086. /* wParam: not used, 0
  1087. // lParam: not used, 0
  1088. // return: HWND LOWORD, current buddy; HIWORD not used
  1089. */
  1090. #define UDM_SETACCEL (WM_USER+107)
  1091. /* wParam: UINT, number of acceleration steps
  1092. // lParam: LPUDACCEL, pointer to array of UDACCEL elements
  1093. //         Elements should be sorted in increasing nSec order.
  1094. // return: BOOL LOWORD, nonzero if successful; HIWORD not used
  1095. */
  1096. #define UDM_GETACCEL (WM_USER+108)
  1097. /* wParam: UINT, number of elements in the UDACCEL array
  1098. // lParam: LPUDACCEL, pointer to UDACCEL buffer to receive array
  1099. // return: UINT LOWORD, number of elements returned in buffer
  1100. */
  1101. #define UDM_SETBASE (WM_USER+109)
  1102. /* wParam: UINT, new radix base (10 for decimal, 16 for hex, etc.)
  1103. // lParam: not used, 0
  1104. // return: not used
  1105. */
  1106. #define UDM_GETBASE (WM_USER+110)
  1107. /* wParam: not used, 0
  1108. // lParam: not used, 0
  1109. // return: UINT LOWORD, current radix base; HIWORD not used
  1110. */
  1111. /* NOTIFICATIONS */
  1112. /* WM_VSCROLL
  1113. // Note that unlike a scrollbar, the position is automatically changed by
  1114. // the control, and the LOWORD(lParam) is always the new position.  Only
  1115. // SB_THUMBTRACK and SB_THUMBPOSITION scroll codes are sent in the wParam.
  1116. */
  1117. /* HELPER APIs */
  1118. WINCOMMCTRLAPI HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy,
  1119.                                 HWND hParent, int nID, HINSTANCE hInst,
  1120.                                 HWND hBuddy,
  1121. int nUpper, int nLower, int nPos);
  1122. /* Does the CreateWindow call followed by setting the various
  1123. // state information:
  1124. // hBuddy The companion control (usually an "edit").
  1125. // nUpper The range limit corresponding to the upper button.
  1126. // nLower The range limit corresponding to the lower button.
  1127. // nPos The initial position.
  1128. // Returns the handle to the control or NULL on failure.
  1129. */
  1130. typedef struct _NM_UPDOWN
  1131. {
  1132.     NMHDR hdr;
  1133.     int iPos;
  1134.     int iDelta;
  1135. } NM_UPDOWN, FAR *LPNM_UPDOWN;
  1136. // this will be received Before the WM_VSCROLL notification.
  1137. // this gives the parent a chance to bail (return non 0) or change the delta
  1138. #define UDN_DELTAPOS (UDN_FIRST - 1)
  1139. #endif /* NOUPDOWN */
  1140. /*/////////////////////////////////////////////////////////////////////////*/
  1141. // progress indicator
  1142. #ifndef NOPROGRESS
  1143. #ifdef _WIN32
  1144. #define PROGRESS_CLASS "msctls_progress32"
  1145. #else
  1146. #define PROGRESS_CLASS "msctls_progress"
  1147. #endif
  1148. /*
  1149. // OVERVIEW:
  1150. //
  1151. // The progress bar control is a "gas gauge" that can be used to show the
  1152. // progress of a lengthy operation.
  1153. //
  1154. // The application sets the range and current position (similar to a
  1155. // scrollbar) and has the ability to advance the current position in
  1156. // a variety of ways.
  1157. //
  1158. // When PBM_STEPIT is used to advance the current position, the gauge
  1159. // will wrap when it reaches the end and start again at the start.
  1160. // The position is clamped at either end in other cases.
  1161. //
  1162. */
  1163. /*/////////////////////////////////////////////////////////////////////////*/
  1164. /* STYLE BITS */
  1165. #define PBS_SHOWPERCENT 0x01 // ;Internal
  1166. #define PBS_SHOWPOS 0x02 // ;Internal
  1167. /* MESSAGES */
  1168. #define PBM_SETRANGE         (WM_USER+1)
  1169. /* wParam: not used, 0
  1170. // lParam: int LOWORD, bottom of range; int HIWORD top of range
  1171. // return: int LOWORD, previous bottom; int HIWORD old top
  1172. */
  1173. #define PBM_SETPOS           (WM_USER+2)
  1174. /* wParam: int new position
  1175. // lParam: not used, 0
  1176. // return: int LOWORD, previous position; HIWORD not used
  1177. */
  1178. #define PBM_DELTAPOS         (WM_USER+3)
  1179. /* wParam: int amount to advance current position
  1180. // lParam: not used, 0
  1181. // return: int LOWORD, previous position; HIWORD not used
  1182. */
  1183. #define PBM_SETSTEP          (WM_USER+4)
  1184. /* wParam: int new step
  1185. // lParam: not used, 0
  1186. // return: int LOWORD, previous step; HIWORD not used
  1187. */
  1188. #define PBM_STEPIT      (WM_USER+5)
  1189.         /* advance current position by current step
  1190. // wParam: not used 0
  1191. // lParam: not used, 0
  1192. // return: int LOWORD, previous position; HIWORD not used
  1193. */
  1194. #endif /* NOPROGRESS */
  1195. #ifndef NOHOTKEY
  1196. /*
  1197. // OVERVIEW:        k
  1198. //
  1199. // The hotkey control is designed as an edit control for hotkey
  1200. // entry.  the application supplies a set of control/alt/shift
  1201. // combinations that are considered invalid and a default combination
  1202. // to be used OR'd with an invalid combination.
  1203. //
  1204. // Hotkey values are returned as a pair of bytes, one for the
  1205. // virtual key code of the key and the other specifying the
  1206. // modifier combinations used with the key.
  1207. //
  1208. */
  1209. // possible modifiers
  1210. #define HOTKEYF_SHIFT 0x01
  1211. #define HOTKEYF_CONTROL 0x02
  1212. #define HOTKEYF_ALT 0x04
  1213. #define HOTKEYF_EXT 0x08 // keyboard extended bit
  1214. // possible modifier combinations (for defining invalid combos)
  1215. #define HKCOMB_NONE 0x0001 // no modifiers
  1216. #define HKCOMB_S 0x0002 // only shift
  1217. #define HKCOMB_C 0x0004 // only control
  1218. #define HKCOMB_A 0x0008 // only alt
  1219. #define HKCOMB_SC 0x0010 // shift+control
  1220. #define HKCOMB_SA 0x0020 // shift+alt
  1221. #define HKCOMB_CA 0x0040 // control+alt
  1222. #define HKCOMB_SCA 0x0080 // shift+control+alt
  1223. // wHotkey: WORD lobyte, virtual key code
  1224. //     WORD hibyte, modifers (combination of HOTKEYF_).
  1225. #define HKM_SETHOTKEY         (WM_USER+1)
  1226. /* wParam: wHotkey;
  1227. // lParam: not used, 0
  1228. // return: not used
  1229. */
  1230. #define HKM_GETHOTKEY         (WM_USER+2)
  1231. /* wParam: not used, 0
  1232. // lParam: not used, 0
  1233. // return: wHotkey;
  1234. */
  1235. #define HKM_SETRULES         (WM_USER+3)
  1236. /* wParam: UINT, invalid modifier combinations (using HKCOMB_*)
  1237. // lParam: UINT loword, default modifier combination (using HOTKEYF_*)
  1238. //         hiword not used
  1239. // return: not used
  1240. */
  1241. #ifdef _WIN32
  1242. #define HOTKEY_CLASS "msctls_hotkey32"
  1243. #else
  1244. #define HOTKEY_CLASS "msctls_hotkey"
  1245. #endif
  1246. #endif /* NOHOTKEY */
  1247. /*/////////////////////////////////////////////////////////////////////////*/
  1248. /* Note that the following flags are checked every time the window gets a
  1249.  * WM_SIZE message, so the style of the window can be changed "on-the-fly".
  1250.  * If NORESIZE is set, then the app is responsible for all control placement
  1251.  * and sizing.  If NOPARENTALIGN is set, then the app is responsible for
  1252.  * placement.  If neither is set, the app just needs to send a WM_SIZE
  1253.  * message for the window to be positioned and sized correctly whenever the
  1254.  * parent window size changes.
  1255.  * Note that for STATUS bars, CCS_BOTTOM is the default, for HEADER bars,
  1256.  * CCS_NOMOVEY is the default, and for TOOL bars, CCS_TOP is the default.
  1257.  */
  1258. #define CCS_TOP 0x00000001L
  1259. /* This flag means the status bar should be "top" aligned.  If the
  1260.  * NOPARENTALIGN flag is set, then the control keeps the same top, left, and
  1261.  * width measurements, but the height is adjusted to the default, otherwise
  1262.  * the status bar is positioned at the top of the parent window such that
  1263.  * its client area is as wide as the parent window and its client origin is
  1264.  * the same as its parent.
  1265.  * Similarly, if this flag is not set, the control is bottom-aligned, either
  1266.  * with its original rect or its parent rect, depending on the NOPARENTALIGN
  1267.  * flag.
  1268.  */
  1269. #define CCS_NOMOVEY 0x00000002L
  1270. /* This flag means the control may be resized and moved horizontally (if the
  1271.  * CCS_NORESIZE flag is not set), but it will not move vertically when a
  1272.  * WM_SIZE message comes through.
  1273.  */
  1274. #define CCS_BOTTOM 0x00000003L
  1275. /* Same as CCS_TOP, only on the bottom.
  1276.  */
  1277. #define CCS_NORESIZE 0x00000004L
  1278. /* This flag means that the size given when creating or resizing is exact,
  1279.  * and the control should not resize itself to the default height or width
  1280.  */
  1281. #define CCS_NOPARENTALIGN 0x00000008L
  1282. /* This flag means that the control should not "snap" to the top or bottom
  1283.  * or the parent window, but should keep the same placement it was given
  1284.  */
  1285. #define CCS_NOHILITE 0x00000010L                        // ;Internal
  1286. /* Don't draw the one pixel highlight at the top of the control */ // ;Internal
  1287. #define CCS_ADJUSTABLE 0x00000020L
  1288. /* This allows a toolbar (header bar?) to be configured by the user.
  1289.  */
  1290. #define CCS_NODIVIDER 0x00000040L
  1291. /* Don't draw the 2 pixel highlight at top of control (toolbar)
  1292.  */
  1293. /*/////////////////////////////////////////////////////////////////////////*/
  1294. //================ LISTVIEW APIS ===========================================
  1295. //
  1296. // Class name: SysListView (WC_LISTVIEW)
  1297. //
  1298. // The SysListView control provides for a group of items which are displayed
  1299. // as a name and/or an associated icon and associated sub-items, in one of
  1300. // several organizations, depending on current style settings:
  1301. //  * The Icon Format (LVS_ICON)
  1302. //      The control arranges standard-sized icons on an invisible grid
  1303. //      with their text caption below the icon. The user can drag icons to
  1304. //      rearrange them freely, even overlapping each other.
  1305. //  * The Small Icon Format (LVS_SMALLICON)
  1306. //      The control arranges half-sized icons on an invisible columnar grid
  1307. //      like a multi-column owner-draw listbox, with the caption of each
  1308. //      item to the icon's right.  The user can still rearrange items
  1309. //      freely to taste.  Converting from LVS_ICON to LVS_SMALLICON and back
  1310. //      will attempt to preserve approximate relative positions of
  1311. //      repositioned items.
  1312. //  * The List Format (LVS_LIST)
  1313. //      The control enforces a multi-column list of small-icon items with
  1314. //      each item's caption to the right.  No free rearranging is possible.
  1315. //  * The Report Format (LVS_REPORT)
  1316. //      The control enforces a single-column list of small-icon items with
  1317. //      each item's caption to the right, and further columns used for item-
  1318. //      specific sub-item text.  The columns are capped with a SysHeader
  1319. //      bar (unless specified) which allows the user to change the relative
  1320. //      widths of each sub-item column.
  1321. //
  1322. // The icons and small-icons presented may be assigned as indices into
  1323. // an ImageList of the appropriate size.  These ImageLists (either custom
  1324. // lists or copies of the system lists) are assigned to the control by the
  1325. // owner at initialization time or at any later time.
  1326. //
  1327. // Text and icon values may be "late-bound," or assigned by a callback
  1328. // routine as required by the control.  For example, if it would be slow to
  1329. // compute the correct icon or caption for an item, the item can be assigned
  1330. // special values which indicate that they should be computed only as the
  1331. // items become visible (say, for a long list of items being scrolled into
  1332. // view).
  1333. //
  1334. // Each item has a state, which can be (nearly) any combination of the
  1335. // following attributes, mostly managed automatically by the control:
  1336. //  * Selected (LVIS_SELECTED)
  1337. //      The item appears selected.  The appearance of selected items
  1338. //      depends on whether the control has the focus, and the selection
  1339. //      system colors.
  1340. //  * Focused (LVIS_FOCUSED)
  1341. //      One item at a time may be focused.  The item is surrounded with a
  1342. //      standard focus-rectangle.
  1343. //  * Marked (LVIS_CUT)
  1344. //      REVIEW: Call this "Checked"?
  1345. //  * Disabled (LVIS_DISABLED)
  1346. //      The item is drawn with the standard disabled style and coloring.
  1347. //  * Drop-Highlighted (LVIS_DROPHILITED)
  1348. //      The item appears marked when the user drags an object over it, if
  1349. //      it can accept the object as a drop-target.
  1350. //
  1351. // There are notifications that allow applications to determine when an item
  1352. // has been clicked or double clicked, caption text changes have occured,
  1353. // drag tracking is occuring, widths of columns have changed, etc.
  1354. //
  1355. //////////////////////////////////////////////////////////////////////////////
  1356. #ifdef _WIN32
  1357. #define WC_LISTVIEW         "SysListView32"
  1358. #else
  1359. #define WC_LISTVIEW         "SysListView"
  1360. #endif
  1361. // ListView styles
  1362. //
  1363. // view type styles (we only have 16 bits to use here)
  1364. #define LVS_ICON            0x0000
  1365. #define LVS_REPORT          0x0001
  1366. #define LVS_SMALLICON       0x0002
  1367. #define LVS_LIST            0x0003
  1368. #define LVS_TYPEMASK        0x0003
  1369. // shared styles
  1370. #define LVS_SINGLESEL       0x0004
  1371. #define LVS_SHOWSELALWAYS   0x0008
  1372. #define LVS_SORTASCENDING   0x0010
  1373. #define LVS_SORTDESCENDING  0x0020
  1374. #define LVS_SHAREIMAGELISTS 0x0040
  1375. #define LVS_NOLABELWRAP     0x0080
  1376. #define LVS_AUTOARRANGE     0x0100
  1377. #define LVS_EDITLABELS      0x0200
  1378. #define LVS_NOITEMDATA      0x1000 // /* ;Internal */
  1379. #define LVS_NOSCROLL        0x2000
  1380. /// the fields below are reserved for style specific settings.
  1381. #define LVS_TYPESTYLEMASK   0xfc00     // the mask for all these styles
  1382. // Large icon.
  1383. #define LVS_ALIGNTOP        0x0000
  1384. #define LVS_ALIGNBOTTOM     0x0400     /* ;Internal */
  1385. #define LVS_ALIGNLEFT       0x0800
  1386. #define LVS_ALIGNRIGHT      0x0c00     /* ;Internal */
  1387. #define LVS_ALIGNMASK       0x0c00
  1388. // Report view.
  1389. #define LVS_OWNERDRAWFIXED  0x0400
  1390. #define LVS_NOCOLUMNHEADER  0x4000
  1391. #define LVS_NOSORTHEADER    0x8000
  1392. // COLORREF ListView_GetBkColor(HWND hwnd);
  1393. #define LVM_GETBKCOLOR      (LVM_FIRST + 0)
  1394. #define ListView_GetBkColor(hwnd)  
  1395.     (COLORREF)SendMessage((hwnd), LVM_GETBKCOLOR, 0, 0L)
  1396. // BOOL ListView_SetBkColor(HWND hwnd, COLORREF clrBk);
  1397. #define LVM_SETBKCOLOR      (LVM_FIRST + 1)
  1398. #define ListView_SetBkColor(hwnd, clrBk) 
  1399.     (BOOL)SendMessage((hwnd), LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  1400. // HIMAGELIST ListView_GetImageList(HWND hwnd, int iImageList);
  1401. #define LVM_GETIMAGELIST    (LVM_FIRST + 2)
  1402. #define ListView_GetImageList(hwnd, iImageList) 
  1403.     (HIMAGELIST)SendMessage((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
  1404. #define LVSIL_NORMAL 0
  1405. #define LVSIL_SMALL 1
  1406. #define LVSIL_STATE 2
  1407. // HIMAGELIST ListView_SetImageList(HWND hwnd, HIMAGELIST himl, int iImageList);
  1408. #define LVM_SETIMAGELIST    (LVM_FIRST + 3)
  1409. #define ListView_SetImageList(hwnd, himl, iImageList) 
  1410.     (HIMAGELIST)(UINT)SendMessage((hwnd), LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl))
  1411. // int ListView_GetItemCount(HWND hwnd);
  1412. #define LVM_GETITEMCOUNT    (LVM_FIRST + 4)
  1413. #define ListView_GetItemCount(hwnd) 
  1414.     (int)SendMessage((hwnd), LVM_GETITEMCOUNT, 0, 0L)
  1415. // ListView Item structure
  1416. #define LVIF_TEXT           0x0001  // LV_ITEM.mask flags (indicate valid fields in LV_ITEM)
  1417. #define LVIF_IMAGE          0x0002
  1418. #define LVIF_PARAM          0x0004
  1419. #define LVIF_STATE          0x0008
  1420. #define LVIF_ALL            0x000f  // ;Internal
  1421. #define LVIF_RESERVED       0xf000  // all bits in high nibble is for notify specific stuff /* ;Internal */
  1422. // State flags
  1423. #define LVIS_FOCUSED     0x0001  // LV_ITEM.state flags
  1424. #define LVIS_SELECTED       0x0002
  1425. #define LVIS_CUT            0x0004  // LVIS_MARKED
  1426. #define LVIS_DROPHILITED    0x0008
  1427. #define LVIS_DISABLED       0x0010   // GOING AWAY // ;Internal
  1428. #define LVIS_LINK           0x0040   // ;Internal
  1429. #define LVIS_OVERLAYMASK    0x0F00  // used as ImageList overlay image indexes
  1430. #define LVIS_STATEIMAGEMASK 0xF000 // client bits for state image drawing
  1431. #define LVIS_USERMASK       LVIS_STATEIMAGEMASK  // BUGBUG: remove me.
  1432. #define LVIS_ALL            0xFFFF  /* ;Internal */
  1433. #define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
  1434. typedef struct _LV_ITEM
  1435. {
  1436.     UINT mask; // LVIF_ flags
  1437.     int iItem;
  1438.     int iSubItem;
  1439.     UINT state; // LVIS_ flags
  1440.     UINT stateMask; // LVIS_ flags (valid bits in state)
  1441.     LPSTR pszText;
  1442.     int cchTextMax;
  1443.     int iImage;
  1444.     LPARAM lParam;
  1445. } LV_ITEM;
  1446.     // Values used to cause text/image GETDISPINFO callbacks
  1447. #define LPSTR_TEXTCALLBACK      ((LPSTR)-1L)
  1448. #define I_IMAGECALLBACK         (-1)
  1449. // BOOL ListView_GetItem(HWND hwnd, LV_ITEM FAR* pitem);
  1450. #define LVM_GETITEM         (LVM_FIRST + 5)
  1451. #define ListView_GetItem(hwnd, pitem) 
  1452.     (BOOL)SendMessage((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM FAR*)(pitem))
  1453. // Sets items and subitems.
  1454. //
  1455. // BOOL ListView_SetItem(HWND hwnd, const LV_ITEM FAR* pitem);
  1456. #define LVM_SETITEM         (LVM_FIRST + 6)
  1457. #define ListView_SetItem(hwnd, pitem) 
  1458.     (BOOL)SendMessage((hwnd), LVM_SETITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1459. // int ListView_InsertItem(HWND hwnd, const LV_ITEM FAR* pitem);
  1460. #define LVM_INSERTITEM         (LVM_FIRST + 7)
  1461. #define ListView_InsertItem(hwnd, pitem)   
  1462.     (int)SendMessage((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1463. // Deletes the specified item along with all its subitems.
  1464. //
  1465. // BOOL ListView_DeleteItem(HWND hwnd, int i);
  1466. #define LVM_DELETEITEM      (LVM_FIRST + 8)
  1467. #define ListView_DeleteItem(hwnd, i) 
  1468.     (BOOL)SendMessage((hwnd), LVM_DELETEITEM, (WPARAM)(int)(i), 0L)
  1469. // BOOL ListView_DeleteAllItems(HWND hwnd);
  1470. #define LVM_DELETEALLITEMS  (LVM_FIRST + 9)
  1471. #define ListView_DeleteAllItems(hwnd) 
  1472.     (BOOL)SendMessage((hwnd), LVM_DELETEALLITEMS, 0, 0L)
  1473. // UINT ListView_GetCallbackMask(HWND hwnd);
  1474. #define LVM_GETCALLBACKMASK (LVM_FIRST + 10)
  1475. #define ListView_GetCallbackMask(hwnd) 
  1476.     (BOOL)SendMessage((hwnd), LVM_GETCALLBACKMASK, 0, 0)
  1477. // BOOL ListView_SetCallbackMask(HWND hwnd, UINT mask);
  1478. #define LVM_SETCALLBACKMASK (LVM_FIRST + 11)
  1479. #define ListView_SetCallbackMask(hwnd, mask) 
  1480.     (BOOL)SendMessage((hwnd), LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0)
  1481. // ListView_GetNextItem flags (can be used in combination)
  1482. #define LVNI_ALL 0x0000
  1483. #define LVNI_FOCUSED     0x0001  // return only focused item
  1484. #define LVNI_SELECTED    0x0002  // return only selected items
  1485. #define LVNI_CUT      0x0004  // return only marked items
  1486. #define LVNI_DROPHILITED 0x0008 // return only drophilited items
  1487. #define LVNI_PREVIOUS    0x0020  // Go backwards   // ;Internal
  1488. #define LVNI_ABOVE       0x0100  // return item geometrically above
  1489. #define LVNI_BELOW       0x0200  // "" below
  1490. #define LVNI_TOLEFT      0x0400  // "" to left
  1491. #define LVNI_TORIGHT     0x0800  // "" to right (NOTE: these four are
  1492.                                  //              mutually exclusive, but
  1493.                                  //              can be used with other LVNI's)
  1494. // int ListView_GetNextItem(HWND hwnd, int i, UINT flags);
  1495. #define LVM_GETNEXTITEM     (LVM_FIRST + 12)
  1496. #define ListView_GetNextItem(hwnd, i, flags) 
  1497.     (int)SendMessage((hwnd), LVM_GETNEXTITEM, (WPARAM)(int)(i), MAKELPARAM((flags), 0))
  1498. // ListView_FindInfo definitions
  1499. #define LVFI_PARAM      0x0001
  1500. #define LVFI_STRING     0x0002
  1501. #define LVFI_SUBSTRING  0x0004  /* ;Internal */
  1502. #define LVFI_PARTIAL    0x0008
  1503. #define LVFI_NOCASE     0x0010  /* ;Internal */
  1504. #define LVFI_WRAP       0x0020
  1505. #define LVFI_NEARESTXY  0x0040
  1506. typedef struct _LV_FINDINFO
  1507. {
  1508.     UINT flags;
  1509.     LPCSTR psz;
  1510.     LPARAM lParam;
  1511.     POINT pt;  //  only used for nearestxy
  1512.     UINT vkDirection; //  only used for nearestxy
  1513. } LV_FINDINFO;
  1514. // int ListView_FindItem(HWND hwnd, int iStart, const LV_FINDINFO FAR* plvfi);
  1515. #define LVM_FINDITEM        (LVM_FIRST + 13)
  1516. #define ListView_FindItem(hwnd, iStart, plvfi) 
  1517.     (int)SendMessage((hwnd), LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LV_FINDINFO FAR*)(plvfi))
  1518. // the following #define's must be packed sequentially.   // ;Internal
  1519. #define LVIR_BOUNDS     0
  1520. #define LVIR_ICON       1
  1521. #define LVIR_LABEL      2
  1522. #define LVIR_SELECTBOUNDS 3
  1523. #define LVIR_MAX  4                           // ;Internal
  1524.     // Rectangle bounding all or part of item, based on LVIR_* code.  Rect is returned in view coords
  1525.     // BOOL ListView_GetItemRect(HWND hwndLV, int i, RECT FAR* prc, int code);
  1526. #define LVM_GETITEMRECT     (LVM_FIRST + 14)
  1527. #define ListView_GetItemRect(hwnd, i, prc, code) 
  1528.     ((prc)->left = (code), (BOOL)SendMessage((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc)))
  1529.     // Move top-left corner of item to (x, y), specified in view rect relative coords
  1530.     // (icon and small view only)
  1531. // BOOL ListView_SetItemPosition(HWND hwndLV, int i, int x, int y);
  1532. #define LVM_SETITEMPOSITION (LVM_FIRST + 15)
  1533. #define ListView_SetItemPosition(hwndLV, i, x, y) 
  1534.     (BOOL)SendMessage((hwndLV), LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y)))
  1535. // BOOL ListView_GetItemPosition(HWND hwndLV, int i, POINT FAR* ppt);
  1536. #define LVM_GETITEMPOSITION (LVM_FIRST + 16)
  1537. #define ListView_GetItemPosition(hwndLV, i, ppt) 
  1538.     (BOOL)SendMessage((hwndLV), LVM_GETITEMPOSITION, (WPARAM)(int)(i), (LPARAM)(POINT FAR*)(ppt))
  1539.     // Get column width of string
  1540.     // int ListView_GetStringWidth(HWND hwndLV, LPCSTR psz);
  1541. #define LVM_GETSTRINGWIDTH  (LVM_FIRST + 17)
  1542. #define ListView_GetStringWidth(hwndLV, psz) 
  1543.     (int)SendMessage((hwndLV), LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCSTR)(psz))
  1544.     // Hit test item.  Returns item at (x,y), or -1 if not on an item.
  1545.     // Combination of LVHT_ values *pflags, indicating where the cursor
  1546.     // is relative to edges of ListView window (above, below, right, left)
  1547.     // or whether (x, y) is over icon, label, or inside window but not on item.
  1548.     // int ListView_HitTest(HWND hwndLV, LV_HITTESTINFO FAR* pinfo);
  1549.     // ItemHitTest flag values
  1550. #define LVHT_NOWHERE        0x0001
  1551. #define LVHT_ONITEMICON     0x0002
  1552. #define LVHT_ONITEMLABEL    0x0004
  1553. #define LVHT_ONITEMSTATEICON 0x0008
  1554. #define LVHT_ONITEM         (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
  1555. #define LVHT_ABOVE          0x0008
  1556. #define LVHT_BELOW          0x0010
  1557. #define LVHT_TORIGHT        0x0020
  1558. #define LVHT_TOLEFT         0x0040
  1559. typedef struct _LV_HITTESTINFO
  1560. {
  1561.     POINT pt;     // in: client coords
  1562.     UINT flags;     // out: LVHT_ flags
  1563.     int iItem;     // out: item
  1564. } LV_HITTESTINFO;
  1565.     // int ListView_HitTest(HWND hwndLV, LV_HITTESTINFO FAR* pinfo);
  1566. #define LVM_HITTEST     (LVM_FIRST + 18)
  1567. #define ListView_HitTest(hwndLV, pinfo) 
  1568.     (int)SendMessage((hwndLV), LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO FAR*)(pinfo))
  1569.     // Return view rectangle, relative to window
  1570.     // BOOL ListView_GetViewRect(HWND hwndLV, RECT FAR* prcVis);
  1571.     // Scroll an item into view if not wholly or partially visible
  1572.     // BOOL ListView_EnsureVisible(HWND hwndLV, int i, BOOL fPartialOK);
  1573. #define LVM_ENSUREVISIBLE   (LVM_FIRST + 19)
  1574. #define ListView_EnsureVisible(hwndLV, i, fPartialOK) 
  1575.     (BOOL)SendMessage((hwndLV), LVM_ENSUREVISIBLE, (WPARAM)(int)(i), MAKELPARAM((fPartialOK), 0))
  1576.     // Scroll listview -- offsets origin of view rectangle by dx, dy
  1577.     // BOOL ListView_Scroll(HWND hwndLV, int dx, int dy);
  1578. #define LVM_SCROLL          (LVM_FIRST + 20)
  1579. #define ListView_Scroll(hwndLV, dx, dy) 
  1580.     (BOOL)SendMessage((hwndLV), LVM_SCROLL, (WPARAM)(int)dx, (LPARAM)(int)dy)
  1581.     // Force eventual redraw of range of items (redraw doesn't occur
  1582.     // until WM_PAINT processed -- call UpdateWindow() after to redraw right away)
  1583.     // BOOL ListView_RedrawItems(HWND hwndLV, int iFirst, int iLast);
  1584. #define LVM_REDRAWITEMS     (LVM_FIRST + 21)
  1585. #define ListView_RedrawItems(hwndLV, iFirst, iLast) 
  1586.     (BOOL)SendMessage((hwndLV), LVM_REDRAWITEMS, (WPARAM)(int)iFirst, (LPARAM)(int)iLast)
  1587.     // Arrange style
  1588. #define LVA_DEFAULT         0x0000
  1589. #define LVA_ALIGNLEFT       0x0001
  1590. #define LVA_ALIGNTOP        0x0002
  1591. #define LVA_ALIGNRIGHT      0x0003    /* ;Internal */
  1592. #define LVA_ALIGNBOTTOM     0x0004    /* ;Internal */
  1593. #define LVA_SNAPTOGRID      0x0005
  1594. #define LVA_ALIGNMASK       0x0007  //;Internal
  1595. #define LVA_SORTASCENDING   0x0100  // ;Internal
  1596. #define LVA_SORTDESCENDING  0x0200  // ;Internal
  1597.     // Arrange icons according to LVA_* code
  1598.     // BOOL ListView_Arrange(HWND hwndLV, UINT code);
  1599. #define LVM_ARRANGE         (LVM_FIRST + 22)
  1600. #define ListView_Arrange(hwndLV, code) 
  1601.     (BOOL)SendMessage((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0L)
  1602.     // Begin editing the label of a control.  Implicitly selects and focuses
  1603.     // item.  i == -1 to cancel.
  1604.     // HWND ListView_EditLabel(HWND hwndLV, int i);
  1605. #define LVM_EDITLABEL       (LVM_FIRST + 23)
  1606. #define ListView_EditLabel(hwndLV, i) 
  1607.     (HWND)SendMessage((hwndLV), LVM_EDITLABEL, (WPARAM)(int)(i), 0L)
  1608.     // Return edit control being used for editing.  Subclass OK, but
  1609.     // don't destroy.  Will be destroyed when editing is finished.
  1610.     //HWND ListView_GetEditControl(HWND hwndLV);
  1611. #define LVM_GETEDITCONTROL  (LVM_FIRST + 24)
  1612. #define ListView_GetEditControl(hwndLV) 
  1613.     (HWND)SendMessage((hwndLV), LVM_GETEDITCONTROL, 0, 0L)
  1614. typedef struct _LV_COLUMN
  1615. {
  1616.     UINT mask;
  1617.     int fmt;
  1618.     int cx;
  1619.     LPSTR pszText;
  1620.     int cchTextMax;
  1621.     int iSubItem;       // subitem to display
  1622. } LV_COLUMN;
  1623. // LV_COLUMN mask values
  1624. #define LVCF_FMT        0x0001
  1625. #define LVCF_WIDTH      0x0002
  1626. #define LVCF_TEXT       0x0004
  1627. #define LVCF_SUBITEM    0x0008
  1628. #define LVCF_ALL        0x000f  /* ;Internal */
  1629. // Column format codes
  1630. #define LVCFMT_LEFT     0
  1631. #define LVCFMT_RIGHT    1
  1632. #define LVCFMT_CENTER   2
  1633. #define LVCFMT_JUSTIFYMASK 0x0003
  1634. // Set/Query column info
  1635. // BOOL ListView_GetColumn(HWND hwndLV, int iCol, LV_COLUMN FAR* pcol);
  1636. #define LVM_GETCOLUMN       (LVM_FIRST + 25)
  1637. #define ListView_GetColumn(hwnd, iCol, pcol) 
  1638.     (BOOL)SendMessage((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN FAR*)(pcol))
  1639. // BOOL ListView_SetColumn(HWND hwndLV, int iCol, LV_COLUMN FAR* pcol);
  1640. #define LVM_SETCOLUMN       (LVM_FIRST + 26)
  1641. #define ListView_SetColumn(hwnd, iCol, pcol) 
  1642.     (BOOL)SendMessage((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  1643. // insert/delete report view column
  1644. // int ListView_InsertColumn(HWND hwndLV, int iCol, const LV_COLUMN FAR* pcol);
  1645. #define LVM_INSERTCOLUMN    (LVM_FIRST + 27)
  1646. #define ListView_InsertColumn(hwnd, iCol, pcol) 
  1647.     (int)SendMessage((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  1648. // BOOL ListView_DeleteColumn(HWND hwndLV, int iCol);
  1649. #define LVM_DELETECOLUMN    (LVM_FIRST + 28)
  1650. #define ListView_DeleteColumn(hwnd, iCol) 
  1651.     (BOOL)SendMessage((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0)
  1652. #define LVM_GETCOLUMNWIDTH  (LVM_FIRST + 29)
  1653. #define ListView_GetColumnWidth(hwnd, iCol) 
  1654.     (int)SendMessage((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0)
  1655. #define     LVSCW_AUTOSIZE              -1
  1656. #define     LVSCW_AUTOSIZE_USEHEADER    -2
  1657. #define LVM_SETCOLUMNWIDTH  (LVM_FIRST + 30)
  1658. #define ListView_SetColumnWidth(hwnd, iCol, cx) 
  1659.     (BOOL)SendMessage((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0))
  1660. // HIMAGELIST ListView_CreateDragImage(HWND hwndLV, int iItem, LPPOINT lpptUpLeft);
  1661. #define LVM_CREATEDRAGIMAGE        (LVM_FIRST + 33)
  1662. #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) 
  1663.     (HIMAGELIST)SendMessage((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
  1664. // BOOL ListView_GetViewRect(HWND hwndLV, RECT FAR* prc);
  1665. #define LVM_GETVIEWRECT     (LVM_FIRST + 34)
  1666. #define ListView_GetViewRect(hwnd, prc) 
  1667.     (BOOL)SendMessage((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT FAR*)(prc))
  1668. // get/set text and textbk color for text drawing.  these override
  1669. // the standard window/windowtext settings.  they do NOT override
  1670. // when drawing selected text.
  1671. // COLORREF ListView_GetTextColor(HWND hwnd);
  1672. #define LVM_GETTEXTCOLOR      (LVM_FIRST + 35)
  1673. #define ListView_GetTextColor(hwnd)  
  1674.     (COLORREF)SendMessage((hwnd), LVM_GETTEXTCOLOR, 0, 0L)
  1675. // BOOL ListView_SetTextColor(HWND hwnd, COLORREF clrText);
  1676. #define LVM_SETTEXTCOLOR      (LVM_FIRST + 36)
  1677. #define ListView_SetTextColor(hwnd, clrText) 
  1678.     (BOOL)SendMessage((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  1679. // COLORREF ListView_GetTextBkColor(HWND hwnd);
  1680. #define LVM_GETTEXTBKCOLOR      (LVM_FIRST + 37)
  1681. #define ListView_GetTextBkColor(hwnd)  
  1682.     (COLORREF)SendMessage((hwnd), LVM_GETTEXTBKCOLOR, 0, 0L)
  1683. // BOOL ListView_SetTextBkColor(HWND hwnd, COLORREF clrTextBk);
  1684. #define LVM_SETTEXTBKCOLOR      (LVM_FIRST + 38)
  1685. #define ListView_SetTextBkColor(hwnd, clrTextBk) 
  1686.     (BOOL)SendMessage((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  1687. // messages for getting the index of the first visible item
  1688. #define LVM_GETTOPINDEX         (LVM_FIRST + 39)
  1689. #define ListView_GetTopIndex(hwndLV) 
  1690.     (int)SendMessage((hwndLV), LVM_GETTOPINDEX, 0, 0)
  1691. // Message for getting the count of items per page
  1692. #define LVM_GETCOUNTPERPAGE     (LVM_FIRST + 40)
  1693. #define ListView_GetCountPerPage(hwndLV) 
  1694.     (int)SendMessage((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)
  1695. // Message for getting the listview origin, which is needed for SetItemPos...
  1696. #define LVM_GETORIGIN           (LVM_FIRST + 41)
  1697. #define ListView_GetOrigin(hwndLV, ppt) 
  1698.     (BOOL)SendMessage((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT FAR*)(ppt))
  1699. // Message for getting the count of items per page
  1700. #define LVM_UPDATE     (LVM_FIRST + 42)
  1701. #define ListView_Update(hwndLV, i) 
  1702.     (BOOL)SendMessage((hwndLV), LVM_UPDATE, (WPARAM)i, 0L)
  1703. // set and item's state.  this macro will return VOID.  but the
  1704. // message returns BOOL success.
  1705. #define LVM_SETITEMSTATE                (LVM_FIRST + 43)
  1706. #define ListView_SetItemState(hwndLV, i, data, mask) 
  1707. { LV_ITEM _ms_lvi;
  1708.   _ms_lvi.stateMask = mask;
  1709.   _ms_lvi.state = data;
  1710.   SendMessage((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);
  1711. }
  1712. // get the item's state
  1713. #define LVM_GETITEMSTATE                (LVM_FIRST + 44)
  1714. #define ListView_GetItemState(hwndLV, i, mask) 
  1715.    (UINT)SendMessage((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask)
  1716. // get the item  text.
  1717. // if you want the int return value of how the buff size, you call it yourself.
  1718. #define LVM_GETITEMTEXT                 (LVM_FIRST + 45)
  1719. #define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) 
  1720. { LV_ITEM _ms_lvi;
  1721.   _ms_lvi.iSubItem = iSubItem_;
  1722.   _ms_lvi.cchTextMax = cchTextMax_;
  1723.   _ms_lvi.pszText = pszText_;
  1724.   SendMessage((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);
  1725. }
  1726. // get the item  text.
  1727. // if you want the int return value (BOOL) success do it yourself
  1728. #define LVM_SETITEMTEXT                 (LVM_FIRST + 46)
  1729. #define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) 
  1730. { LV_ITEM _ms_lvi;
  1731.   _ms_lvi.iSubItem = iSubItem_;
  1732.   _ms_lvi.pszText = pszText_;
  1733.   SendMessage((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);
  1734. }
  1735. // tell the listview that you are going to add nItems lot of items
  1736. #define LVM_SETITEMCOUNT                 (LVM_FIRST + 47)
  1737. #define ListView_SetItemCount(hwndLV, cItems) 
  1738.   SendMessage((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0)
  1739. typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
  1740. // tell the listview to resort the items
  1741. #define LVM_SORTITEMS                    (LVM_FIRST + 48)
  1742. #define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) 
  1743.   (BOOL)SendMessage((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, 
  1744.   (LPARAM)(PFNLVCOMPARE)_pfnCompare)
  1745. // void ListView_SetItemPosition(HWND hwndLV, int i, int x, int y);
  1746. #define LVM_SETITEMPOSITION32 (LVM_FIRST + 49)
  1747. #define ListView_SetItemPosition32(hwndLV, i, x, y) 
  1748. { POINT ptNewPos = {x,y}; 
  1749.     SendMessage((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); 
  1750. }
  1751. // get the number of items selected
  1752. #define LVM_GETSELECTEDCOUNT  (LVM_FIRST + 50)
  1753. #define ListView_GetSelectedCount(hwndLV) 
  1754.     (UINT)SendMessage((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
  1755. #define LVM_GETITEMSPACING (LVM_FIRST + 51)
  1756. #define ListView_GetItemSpacing(hwndLV, fSmall) 
  1757.         (DWORD)SendMessage((hwndLV), LVM_GETITEMSPACING, fSmall, 0L)
  1758. // returns true/false telling whether it's in search mode or not
  1759. #define LVM_GETISEARCHSTRING (LVM_FIRST + 52)
  1760. #define ListView_GetISearchString(hwndLV, lpsz) 
  1761.         (BOOL)SendMessage((hwndLV), LVM_GETISEARCHSTRING, 0, (LPARAM)(LPSTR)lpsz)
  1762. // ListView notification codes
  1763. // Structure used by all ListView control notifications.
  1764. // Not all fields supply useful info for all notifications:
  1765. // iItem will be -1 and others 0 if not used.
  1766. // Some return a BOOL, too.
  1767. //
  1768. typedef struct _NM_LISTVIEW
  1769. {
  1770.     NMHDR   hdr;
  1771.     int     iItem;
  1772.     int     iSubItem;
  1773.     UINT    uNewState;      // Combination of LVIS_* (if uChanged & LVIF_STATE)
  1774.     UINT    uOldState;      // Combination of LVIS_*
  1775.     UINT    uChanged;       // Combination of LVIF_* indicating what changed
  1776.     POINT   ptAction;       // Only valid for LVN_BEGINDRAG and LVN_BEGINRDRAG
  1777.     LPARAM  lParam;         // Only valid for LVN_DELETEITEM
  1778. } NM_LISTVIEW, FAR *LPNM_LISTVIEW;
  1779. #define LVN_ITEMCHANGING        (LVN_FIRST-0) // lParam -> NM_LISTVIEW: item changing.  Return FALSE to disallow
  1780. #define LVN_ITEMCHANGED         (LVN_FIRST-1) // item changed.
  1781. #define LVN_INSERTITEM          (LVN_FIRST-2)
  1782. #define LVN_DELETEITEM          (LVN_FIRST-3)
  1783. #define LVN_DELETEALLITEMS      (LVN_FIRST-4)
  1784. #define LVN_BEGINLABELEDIT      (LVN_FIRST-5) // lParam -> LV_DISPINFO: start of label editing
  1785. #define LVN_ENDLABELEDIT        (LVN_FIRST-6) // lParam -> LV_DISPINFO: end of label editing
  1786.                                          // (iItem == -1 if cancel)
  1787. //(LVN_FIRST-7) not used
  1788. #define LVN_COLUMNCLICK         (LVN_FIRST-8)   // column identified by iItem was clicked
  1789. #define LVN_BEGINDRAG           (LVN_FIRST-9)   // Start of drag operation requested
  1790.                                          // (return FALSE if the app handles it)
  1791. #define LVN_ENDDRAG             (LVN_FIRST-10)  // End of dragging operation.  /* ;Internal */
  1792. #define LVN_BEGINRDRAG          (LVN_FIRST-11)  // Start of button 2 dragging
  1793. #define LVN_ENDRDRAG            (LVN_FIRST-12)  // End of button 2 drag (not used yet)  /* ;Internal */
  1794. #ifdef PW2                                      // ;Internal
  1795. #define LVN_PEN                 (LVN_FIRST-20)  // pen notifications  // ;Internal
  1796. #endif //PW2                                    // ;Internal
  1797. // LVN_DISPINFO notification
  1798. #define LVN_GETDISPINFO         (LVN_FIRST-50) // lParam -> LV_DISPINFO
  1799. #define LVN_SETDISPINFO         (LVN_FIRST-51)  // lParam -> LV_DISPINFO
  1800. #define LVIF_DI_SETITEM      0x1000   // keeps values returned in this GetDispInfo call
  1801. typedef struct _LV_DISPINFO {
  1802.     NMHDR hdr;
  1803.     LV_ITEM item;
  1804. } LV_DISPINFO;
  1805. // LVN_KEYDOWN notification
  1806. #define LVN_KEYDOWN (LVN_FIRST-55)
  1807. typedef struct _LV_KEYDOWN
  1808. {
  1809.     NMHDR hdr;
  1810.     WORD wVKey;
  1811.     UINT flags;
  1812. } LV_KEYDOWN;
  1813. // ====== TREEVIEW APIs =================================================
  1814. //
  1815. // Class name: SysTreeView (WC_TREEVIEW)
  1816. //
  1817. // The SysTreeView control provides for a group of items which are
  1818. // displayed in a hierarchical organization.  Each item may contain
  1819. // independent "sub-item" entries which are displayed below and indented
  1820. // from the parent item.
  1821. //
  1822. // Operation of this control is similar to the SysListView control above,
  1823. // except that sub-items are distinct entries, not supporting text elements
  1824. // belonging to the owning object (which is the case for the Report View
  1825. // mode of the SysListView).
  1826. //
  1827. // There are notifications that allow applications to determine when an item
  1828. // has been clicked or double clicked, caption text changes have occured,
  1829. // drag tracking is occuring, widths of columns have changed, node items
  1830. // are expanded, etc.
  1831. //
  1832. // NOTE: All "messages" below are documented as APIs; eventually these
  1833. // will be changed to window messages, and corresponding macros will be
  1834. // written that have the same signature as the APIs shown below.
  1835. //
  1836. #ifdef _WIN32
  1837. #define WC_TREEVIEW     "SysTreeView32"
  1838. #else
  1839. #define WC_TREEVIEW     "SysTreeView"
  1840. #endif
  1841. // TreeView window styles
  1842. #define TVS_HASBUTTONS      0x0001 // draw "plus" & "minus" sign on nodes with children
  1843. #define TVS_HASLINES        0x0002 // draw lines between nodes
  1844. #define TVS_LINESATROOT     0x0004
  1845. #define TVS_EDITLABELS      0x0008 // alow text edit in place
  1846. #define TVS_DISABLEDRAGDROP 0x0010      // disable draggine notification of nodes
  1847. #define TVS_SHOWSELALWAYS   0x0020
  1848. typedef struct _TREEITEM FAR* HTREEITEM;
  1849. #define TVIF_TEXT           0x0001  // TV_ITEM.mask flags
  1850. #define TVIF_IMAGE         0x0002
  1851. #define TVIF_PARAM          0x0004
  1852. #define TVIF_STATE          0x0008
  1853. #define TVIF_HANDLE         0x0010  // :Internal
  1854. #define TVIF_SELECTEDIMAGE  0x0020
  1855. #define TVIF_CHILDREN     0x0040
  1856. #define TVIF_ALL     0x007F  // ;Internal
  1857. #define TVIF_RESERVED       0xf000  // all bits in high nibble is for notify specific stuff /* ;Internal */
  1858. // State flags
  1859. #define TVIS_FOCUSED     0x0001  // TV_ITEM.state flags
  1860. #define TVIS_SELECTED       0x0002
  1861. #define TVIS_CUT            0x0004  // TVIS_MARKED
  1862. #define TVIS_DROPHILITED    0x0008
  1863. #define TVIS_BOLD           0x0010
  1864. #define TVIS_EXPANDED       0x0020
  1865. #define TVIS_EXPANDEDONCE   0x0040
  1866. #define TVIS_DISABLED       0  // GOING AWAY // ;Internal
  1867. #define TVIS_OVERLAYMASK    0x0F00  // used as ImageList overlay image indexes
  1868. #define TVIS_STATEIMAGEMASK 0xF000
  1869. #define TVIS_USERMASK       0xF000
  1870. #define TVIS_ALL            0xFF7f  // ;Internal
  1871. #define I_CHILDRENCALLBACK  (-1)    // cChildren value for children callback
  1872. typedef struct _TV_ITEM {
  1873.     UINT      mask; // TVIF_ flags
  1874.     HTREEITEM hItem; // The item to be changed
  1875.     UINT      state; // TVIS_ flags
  1876.     UINT      stateMask; // TVIS_ flags (valid bits in state)
  1877.     LPSTR     pszText; // The text for this item
  1878.     int       cchTextMax; // The length of the pszText buffer
  1879.     int       iImage; // The index of the image for this item
  1880.     int       iSelectedImage; // the index of the selected imagex
  1881.     int       cChildren; // # of child nodes, I_CHILDRENCALLBACK for callback
  1882.     LPARAM    lParam; // App defined data
  1883. } TV_ITEM, FAR *LPTV_ITEM;
  1884. #define TVI_ROOT  ((HTREEITEM)0xFFFF0000)
  1885. #define TVI_FIRST ((HTREEITEM)0xFFFF0001)
  1886. #define TVI_LAST  ((HTREEITEM)0xFFFF0002)
  1887. #define TVI_SORT  ((HTREEITEM)0xFFFF0003)
  1888. typedef struct _TV_INSERTSTRUCT {
  1889.     HTREEITEM hParent; // a valid HTREEITEM or TVI_ value
  1890.     HTREEITEM hInsertAfter; // a valid HTREEITEM or TVI_ value
  1891.     TV_ITEM item;
  1892. } TV_INSERTSTRUCT, FAR *LPTV_INSERTSTRUCT;
  1893. #define TVM_INSERTITEM      (TV_FIRST + 0)
  1894. #define TreeView_InsertItem(hwnd, lpis) 
  1895.     (HTREEITEM)SendMessage((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis))
  1896. #define TVM_DELETEITEM      (TV_FIRST + 1)
  1897. #define TreeView_DeleteItem(hwnd, hitem) 
  1898.     (BOOL)SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem))
  1899. #define TreeView_DeleteAllItems(hwnd) 
  1900.     (BOOL)SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT)
  1901. #define TVM_EXPAND     (TV_FIRST + 2)
  1902. #define TreeView_Expand(hwnd, hitem, code) 
  1903.     (BOOL)SendMessage((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  1904. // TreeView_Expand codes
  1905. #define TVE_COLLAPSE        0x0001
  1906. #define TVE_EXPAND          0x0002
  1907. #define TVE_TOGGLE          0x0003
  1908. #define TVE_ACTIONMASK      0x0007 // ;Internal (TVE_COLLAPSE | TVE_EXPAND | TVE_TOGGLE)
  1909. #define TVE_COLLAPSERESET   0x8000 // remove all children when collapsing
  1910. #define TV_FINDITEM         (TV_FIRST + 3) // BUGBUG: Not implemented         /* ;Internal */
  1911. #define TVM_GETITEMRECT     (TV_FIRST + 4)
  1912. #define TreeView_GetItemRect(hwnd, hitem, prc, code) 
  1913.     (*(HTREEITEM FAR *)prc = (hitem), (BOOL)SendMessage((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT FAR*)(prc)))
  1914. #define TVM_GETCOUNT        (TV_FIRST + 5)
  1915. #define TreeView_GetCount(hwnd) 
  1916.     (UINT)SendMessage((hwnd), TVM_GETCOUNT, 0, 0)
  1917. #define TVM_GETINDENT       (TV_FIRST + 6)
  1918. #define TreeView_GetIndent(hwnd) 
  1919.     (UINT)SendMessage((hwnd), TVM_GETINDENT, 0, 0)
  1920. #define TVM_SETINDENT       (TV_FIRST + 7)
  1921. #define TreeView_SetIndent(hwnd, indent) 
  1922.     (BOOL)SendMessage((hwnd), TVM_SETINDENT, (WPARAM)indent, 0)
  1923. #define TVM_GETIMAGELIST    (TV_FIRST + 8)
  1924. #define TreeView_GetImageList(hwnd, iImage) 
  1925.     (HIMAGELIST)SendMessage((hwnd), TVM_GETIMAGELIST, iImage, 0)
  1926. #define TVSIL_NORMAL 0
  1927. #define TVSIL_STATE 2 // use TVIS_STATEIMAGEMASK as index into state imagelist
  1928. #define TVM_SETIMAGELIST    (TV_FIRST + 9)
  1929. #define TreeView_SetImageList(hwnd, himl, iImage) 
  1930.     (HIMAGELIST)SendMessage((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl))
  1931. #define TVM_GETNEXTITEM     (TV_FIRST + 10)
  1932. #define TreeView_GetNextItem(hwnd, hitem, code) 
  1933.     (HTREEITEM)SendMessage((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  1934. // TreeView_GetNextItem & TreeView_SelectItem codes
  1935. #define TVGN_ROOT 0x0000  // GetNextItem()
  1936. #define TVGN_NEXT 0x0001 // GetNextItem()
  1937. #define TVGN_PREVIOUS 0x0002 // GetNextItem()
  1938. #define TVGN_PARENT 0x0003 // GetNextItem()
  1939. #define TVGN_CHILD 0x0004 // GetNextItem()
  1940. #define TVGN_FIRSTVISIBLE 0x0005  // GetNextItem() & SelectItem()
  1941. #define TVGN_NEXTVISIBLE 0x0006 // GetNextItem()
  1942. #define TVGN_PREVIOUSVISIBLE 0x0007 // GetNextItem()
  1943. #define TVGN_DROPHILITE 0x0008 // GetNextItem() & SelectItem()
  1944. #define TVGN_CARET 0x0009 // GetNextItem() & SelectItem()
  1945. #define TreeView_GetChild(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)
  1946. #define TreeView_GetNextSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)
  1947. #define TreeView_GetPrevSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)
  1948. #define TreeView_GetParent(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)
  1949. #define TreeView_GetFirstVisible(hwnd) TreeView_GetNextItem(hwnd, NULL,  TVGN_FIRSTVISIBLE)
  1950. #define TreeView_GetNextVisible(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE)
  1951. #define TreeView_GetPrevVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE)
  1952. #define TreeView_GetSelection(hwnd) TreeView_GetNextItem(hwnd, NULL,  TVGN_CARET)
  1953. #define TreeView_GetDropHilight(hwnd) TreeView_GetNextItem(hwnd, NULL,  TVGN_DROPHILITE)
  1954. #define TreeView_GetRoot(hwnd)      TreeView_GetNextItem(hwnd, NULL,  TVGN_ROOT)
  1955. #define TVM_SELECTITEM      (TV_FIRST + 11)
  1956. #define TreeView_Select(hwnd, hitem, code) 
  1957.     (HTREEITEM)SendMessage((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  1958. #define TreeView_SelectItem(hwnd, hitem)     TreeView_Select(hwnd, hitem, TVGN_CARET)
  1959. #define TreeView_SelectDropTarget(hwnd, hitem)     TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
  1960. #define TreeView_SelectSetFirstVisible(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
  1961. #define TVM_GETITEM         (TV_FIRST + 12)
  1962. #define TreeView_GetItem(hwnd, pitem) 
  1963.     (BOOL)SendMessage((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM FAR*)(pitem))
  1964. #define TVM_SETITEM         (TV_FIRST + 13)
  1965. #define TreeView_SetItem(hwnd, pitem) 
  1966.     (BOOL)SendMessage((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM FAR*)(pitem))
  1967. #define TVM_EDITLABEL       (TV_FIRST + 14)
  1968. #define TreeView_EditLabel(hwnd, hitem) 
  1969.     (HWND)SendMessage((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
  1970. #define TVM_GETEDITCONTROL  (TV_FIRST + 15)
  1971. #define TreeView_GetEditControl(hwnd) 
  1972.     (HWND)SendMessage((hwnd), TVM_GETEDITCONTROL, 0, 0)
  1973. #define TVM_GETVISIBLECOUNT (TV_FIRST + 16)
  1974. #define TreeView_GetVisibleCount(hwnd) 
  1975.     (UINT)SendMessage((hwnd), TVM_GETVISIBLECOUNT, 0, 0)
  1976. #define TVM_HITTEST         (TV_FIRST + 17)
  1977. #define TreeView_HitTest(hwnd, lpht) 
  1978.     (HTREEITEM)SendMessage((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
  1979. typedef struct _TV_HITTESTINFO {
  1980.     POINT       pt; // in: client coords
  1981.     UINT flags; // out: TVHT_ flags
  1982.     HTREEITEM   hItem; // out:
  1983. } TV_HITTESTINFO, FAR *LPTV_HITTESTINFO;
  1984. #define TVHT_NOWHERE        0x0001
  1985. #define TVHT_ONITEMICON     0x0002
  1986. #define TVHT_ONITEMLABEL    0x0004
  1987. #define TVHT_ONITEM         (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
  1988. #define TVHT_ONITEMINDENT   0x0008
  1989. #define TVHT_ONITEMBUTTON   0x0010
  1990. #define TVHT_ONITEMRIGHT    0x0020
  1991. #define TVHT_ONITEMSTATEICON 0x0040
  1992. #define TVHT_ABOVE          0x0100
  1993. #define TVHT_BELOW          0x0200
  1994. #define TVHT_TORIGHT        0x0400
  1995. #define TVHT_TOLEFT         0x0800
  1996. #define TVM_CREATEDRAGIMAGE  (TV_FIRST + 18)
  1997. #define TreeView_CreateDragImage(hwnd, hitem) 
  1998.     (HIMAGELIST)SendMessage((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem))
  1999. #define TVM_SORTCHILDREN     (TV_FIRST + 19)
  2000. #define TreeView_SortChildren(hwnd, hitem, recurse) 
  2001.     (BOOL)SendMessage((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem))
  2002. #define TVM_ENSUREVISIBLE    (TV_FIRST + 20)
  2003. #define TreeView_EnsureVisible(hwnd, hitem) 
  2004.     (BOOL)SendMessage((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem))
  2005. #define TVM_SORTCHILDRENCB   (TV_FIRST + 21)
  2006. #define TreeView_SortChildrenCB(hwnd, psort, recurse) 
  2007.     (BOOL)SendMessage((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, 
  2008.     (LPARAM)(LPTV_SORTCB)(psort))
  2009. #define TVM_ENDEDITLABELNOW  (TV_FIRST + 22)
  2010. #define TreeView_EndEditLabelNow(hwnd, fCancel) 
  2011.     (BOOL)SendMessage((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0)
  2012. // returns true/false telling whether it's in search mode or not
  2013. #define TVM_GETISEARCHSTRING (TV_FIRST + 23)
  2014. #define TreeView_GetISearchString(hwndTV, lpsz) 
  2015.         (BOOL)SendMessage((hwndTV), TVM_GETISEARCHSTRING, 0, (LPARAM)(LPSTR)lpsz)
  2016. typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  2017. typedef struct _TV_SORTCB
  2018. {
  2019. HTREEITEM hParent;
  2020. PFNTVCOMPARE lpfnCompare;
  2021. LPARAM lParam;
  2022. } TV_SORTCB, FAR *LPTV_SORTCB;
  2023. // common notificaton structure for WM_NOTIFY sent to parent
  2024. // some fields are only valid on some notify messages
  2025. typedef struct _NM_TREEVIEW {
  2026.     NMHDR       hdr;
  2027.     UINT action;         // notification specific action
  2028.     TV_ITEM   itemOld;
  2029.     TV_ITEM   itemNew;
  2030.     POINT       ptDrag;
  2031. } NM_TREEVIEW, FAR *LPNM_TREEVIEW;
  2032. #define TVN_SELCHANGING     (TVN_FIRST-1)
  2033. #define TVN_SELCHANGED      (TVN_FIRST-2)
  2034. // lParam -> NM_TREEVIEW
  2035. // NM_TREEVIEW.itemNew.hItem & NM_TREEVIEW.itemNew.lParam are valid
  2036. // NM_TREEVIEW.itemOld.hItem & NM_TREEVIEW.itemOld.lParam are valid
  2037. // NM_TREEVIEW.action is a TVE_ value indicating how the selcection changed
  2038. // TVN_SELCHANGING & TVN_SELCHANGED action values
  2039. #define TVC_UNKNOWN     0x0000
  2040. #define TVC_BYMOUSE         0x0001
  2041. #define TVC_BYKEYBOARD      0x0002
  2042. #define TVN_GETDISPINFO     (TVN_FIRST-3)
  2043. #define TVN_SETDISPINFO     (TVN_FIRST-4)
  2044. // lParam -> TV_DISPINFO structure
  2045. // TV_DISPINFO.item.hItem & TV_DISPINFO.item.lParam are valid
  2046. #define TVIF_DI_SETITEM      0x1000   // keeps values returned in this GetDispInfo call
  2047. typedef struct _TV_DISPINFO {
  2048.     NMHDR hdr;
  2049.     TV_ITEM item;
  2050. } TV_DISPINFO;
  2051. #define TVN_ITEMEXPANDING   (TVN_FIRST-5)
  2052. #define TVN_ITEMEXPANDED    (TVN_FIRST-6)
  2053. // lParam -> NM_TREEVIEW
  2054. // NM_TREEVIEW.itemNew.hItem & NM_TREEVIEW.itemNew.state & NM_TREEVIEW.itemNew.lParam are valid
  2055. // NM_TREEVIEW.action is TVE_ action and flags
  2056. #define TVN_BEGINDRAG       (TVN_FIRST-7)
  2057. #define TVN_BEGINRDRAG      (TVN_FIRST-8)
  2058. // lParam -> NM_TREEVIEW
  2059. // NM_TREEVIEW.itemNew.hItem & NM_TREEVIEW.itemNew.lParam are valid
  2060. // NM_TREEVIEW.ptDrag is start of drag in client coords
  2061. #define TVN_DELETEITEM      (TVN_FIRST-9)
  2062. // lParam -> NM_TREEVIEW
  2063. // NM_TREEVIEW.itemOld.hItem & NM_TREEVIEW.itemOld.lParam are valid
  2064. #define TVN_BEGINLABELEDIT  (TVN_FIRST-10)
  2065. #define TVN_ENDLABELEDIT    (TVN_FIRST-11)
  2066. // lParam -> TV_DISPINFO
  2067. // TV_DISPINFO.item.hItem & TV_DISPINFO.item.state & TV_DISPINFO.item.lParam & TV_DISPINFO.item.pszText
  2068. // are valid
  2069. #define TVN_KEYDOWN         (TVN_FIRST-12)
  2070. // lParam -> TV_KEYDOWN
  2071. typedef struct _TV_KEYDOWN {
  2072.     NMHDR hdr;
  2073.     WORD wVKey;
  2074.     UINT flags;
  2075. } TV_KEYDOWN;
  2076. //============================================================================
  2077. //
  2078. // Class name: SysTabControl (WC_TABCONTROL)
  2079. //
  2080. #ifdef _WIN32
  2081. #define WC_TABCONTROL         "SysTabControl32"
  2082. #else
  2083. #define WC_TABCONTROL         "SysTabControl"
  2084. #endif
  2085. // window styles to control tab control behavior
  2086. #define TCS_FORCEICONLEFT       0x0010  // 0nly for fixed width mode
  2087. #define TCS_FORCELABELLEFT      0x0020  // 0nly for fixed width mode
  2088. #define TCS_SHAREIMAGELISTS     0x0040  // ;Internal
  2089. #define TCS_TABS 0x0000  // default
  2090. #define TCS_BUTTONS 0x0100
  2091. #define TCS_SINGLELINE 0x0000  // default
  2092. #define TCS_MULTILINE 0x0200
  2093. #define TCS_RIGHTJUSTIFY 0x0000  // default
  2094. #define TCS_FIXEDWIDTH 0x0400
  2095. #define TCS_RAGGEDRIGHT 0x0800
  2096. #define TCS_FOCUSONBUTTONDOWN   0x1000
  2097. #define TCS_OWNERDRAWFIXED      0x2000
  2098. #define TCS_TOOLTIPS            0x4000
  2099. #define TCS_FOCUSNEVER          0x8000
  2100. #define TCM_FIRST     0x1300     // Tab Control messages
  2101. // COLORREF TabCtrl_GetBkColor(HWND hwnd);                // ;Internal
  2102. #define TCM_GETBKCOLOR      (TCM_FIRST + 0)             // ;Internal
  2103. #define TabCtrl_GetBkColor(hwnd)   (COLORREF)SendMessage((hwnd), TCM_GETBKCOLOR, 0, 0L)  // ;Internal
  2104. // BOOL TabCtrl_SetBkColor(HWND hwnd, COLORREF clrBk);   // ;Internal
  2105. #define TCM_SETBKCOLOR      (TCM_FIRST + 1)              // ;Internal
  2106. #define TabCtrl_SetBkColor(hwnd, clrBk)  (BOOL)SendMessage((hwnd), TCM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))  // ;Internal
  2107. // HIMAGELIST TabCtrl_GetImageList(HWND hwnd);
  2108. #define TCM_GETIMAGELIST    (TCM_FIRST + 2)
  2109. #define TabCtrl_GetImageList(hwnd) 
  2110.     (HIMAGELIST)SendMessage((hwnd), TCM_GETIMAGELIST, 0, 0L)
  2111. // this returns the old image list (null if no previous)
  2112. // BOOL TabCtrl_SetImageList(HWND hwnd, HIMAGELIST himl);
  2113. #define TCM_SETIMAGELIST    (TCM_FIRST + 3)
  2114. #define TabCtrl_SetImageList(hwnd, himl) 
  2115.     (HIMAGELIST)SendMessage((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl))
  2116. // int TabCtrl_GetItemCount(HWND hwnd);
  2117. #define TCM_GETITEMCOUNT    (TCM_FIRST + 4)
  2118. #define TabCtrl_GetItemCount(hwnd) 
  2119.     (int)SendMessage((hwnd), TCM_GETITEMCOUNT, 0, 0L)
  2120. // TabView Item structure
  2121. #define TCIF_TEXT       0x0001  // TabView mask flags
  2122. #define TCIF_IMAGE      0x0002
  2123. #define TCIF_RTLREADING 0x0004 // MidEast languages only
  2124. #define TCIF_PARAM      0x0008
  2125. #define TCIF_ALL        0x000f  /* ;Internal */
  2126. typedef struct _TC_ITEMHEADER
  2127. {
  2128.     UINT mask; // TCIF_ bits
  2129.     UINT lpReserved1;
  2130.     UINT lpReserved2;
  2131.     LPSTR pszText;
  2132.     int cchTextMax;
  2133.     int iImage;
  2134. } TC_ITEMHEADER;
  2135. // BUGBUG: we need to pull the state code stuff out    ;Internal
  2136. typedef struct _TC_ITEM
  2137. {
  2138.     // This block must be identical to TC_TEIMHEADER
  2139.     UINT mask; // TCIF_ bits
  2140.     UINT lpReserved1;
  2141.     UINT lpReserved2;
  2142.     LPSTR pszText;
  2143.     int cchTextMax;
  2144.     int iImage;
  2145.     LPARAM lParam;
  2146. } TC_ITEM;
  2147. // BOOL TabCtrl_GetItem(HWND hwnd, int iItem, TC_ITEM FAR* pitem);
  2148. #define TCM_GETITEM         (TCM_FIRST + 5)
  2149. #define TabCtrl_GetItem(hwnd, iItem, pitem) 
  2150.     (BOOL)SendMessage((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  2151. // BOOL TabCtrl_SetItem(HWND hwnd, int iItem, TC_ITEM FAR* pitem);
  2152. #define TCM_SETITEM         (TCM_FIRST + 6)
  2153. #define TabCtrl_SetItem(hwnd, iItem, pitem) 
  2154.     (BOOL)SendMessage((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  2155. // int TabCtrl_InsertItem(HWND hwnd, int iItem, const TC_ITEM FAR* pitem);
  2156. #define TCM_INSERTITEM         (TCM_FIRST + 7)
  2157. #define TabCtrl_InsertItem(hwnd, iItem, pitem)   
  2158.     (int)SendMessage((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem))
  2159. // Deletes the specified item along with all its subitems.
  2160. //
  2161. // BOOL TabCtrl_DeleteItem(HWND hwnd, int i);
  2162. #define TCM_DELETEITEM      (TCM_FIRST + 8)
  2163. #define TabCtrl_DeleteItem(hwnd, i) 
  2164.     (BOOL)SendMessage((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L)
  2165. // BOOL TabCtrl_DeleteAllItems(HWND hwnd);
  2166. #define TCM_DELETEALLITEMS  (TCM_FIRST + 9)
  2167. #define TabCtrl_DeleteAllItems(hwnd) 
  2168.     (BOOL)SendMessage((hwnd), TCM_DELETEALLITEMS, 0, 0L)
  2169.     // Rectangle bounding all or part of item, based on code.  Rect is returned in view coords
  2170.     // BOOL TabCtrl_GetItemRect(HWND hwndTC, int i, RECT FAR* prc);
  2171. #define TCM_GETITEMRECT     (TCM_FIRST + 10)
  2172. #define TabCtrl_GetItemRect(hwnd, i, prc) 
  2173.     (BOOL)SendMessage((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc))
  2174.     // BOOL TabCtrl_GetCurSel(HWND hwndTC);
  2175. #define TCM_GETCURSEL     (TCM_FIRST + 11)
  2176. #define TabCtrl_GetCurSel(hwnd) 
  2177.     (int)SendMessage((hwnd), TCM_GETCURSEL, 0, 0)
  2178. #define TCM_SETCURSEL     (TCM_FIRST + 12)
  2179. #define TabCtrl_SetCurSel(hwnd, i) 
  2180.     (int)SendMessage((hwnd), TCM_SETCURSEL, (WPARAM)i, 0)
  2181.     // ItemHitTest flag values
  2182. #define TCHT_NOWHERE        0x0001
  2183. #define TCHT_ONITEMICON     0x0002
  2184. #define TCHT_ONITEMLABEL    0x0004
  2185. #define TCHT_ONITEM         (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
  2186. typedef struct _TC_HITTESTINFO
  2187. {
  2188.     POINT pt;     // in
  2189.     UINT flags;     // out
  2190. } TC_HITTESTINFO, FAR * LPTC_HITTESTINFO;
  2191.  // int TabCtrl_HitTest(HWND hwndTC, TC_HITTESTINFO FAR* pinfo);
  2192. #define TCM_HITTEST     (TCM_FIRST + 13)
  2193. #define TabCtrl_HitTest(hwndTC, pinfo) 
  2194.     (int)SendMessage((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
  2195. // Set the size of extra byte (abExtra[]) for each item.
  2196. #define TCM_SETITEMEXTRA    (TCM_FIRST + 14)
  2197. #define TabCtrl_SetItemExtra(hwndTC, cb) 
  2198.     (BOOL)SendMessage((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L)
  2199. #define TCM_ADJUSTRECT (TCM_FIRST + 40)
  2200. #define TabCtrl_AdjustRect(hwnd, bLarger, prc) 
  2201.     (void)SendMessage(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT FAR *)prc)
  2202. #define TCM_SETITEMSIZE (TCM_FIRST + 41)
  2203. #define TabCtrl_SetItemSize(hwnd, x, y) 
  2204.     (DWORD)SendMessage((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y))
  2205. #define TCM_REMOVEIMAGE         (TCM_FIRST + 42)
  2206. #define TabCtrl_RemoveImage(hwnd, i) 
  2207.         (void)SendMessage((hwnd), TCM_REMOVEIMAGE, i, 0L)
  2208. #define TCM_SETPADDING          (TCM_FIRST + 43)
  2209. #define TabCtrl_SetPadding(hwnd,  cx, cy) 
  2210.         (void)SendMessage((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy))
  2211. #define TCM_GETROWCOUNT         (TCM_FIRST + 44)
  2212. #define TabCtrl_GetRowCount(hwnd) 
  2213.         (int)SendMessage((hwnd), TCM_GETROWCOUNT, 0, 0L)
  2214. /* all params are NULL
  2215.  * returns the hwnd for tooltips control  or NULL
  2216.  */
  2217. #define TCM_GETTOOLTIPS (TCM_FIRST + 45)
  2218. #define TabCtrl_GetToolTips(hwnd) 
  2219.         (HWND)SendMessage((hwnd), TCM_GETTOOLTIPS, 0, 0L)
  2220. /* wParam: HWND of ToolTips control to use
  2221.  * lParam unused
  2222.  */
  2223. #define TCM_SETTOOLTIPS (TCM_FIRST + 46)
  2224. #define TabCtrl_SetToolTips(hwnd, hwndTT) 
  2225.         (void)SendMessage((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0L)
  2226. // this returns the item with the current focus.. which might not be
  2227. // the currently selected item, if the user is in the process of selecting a new
  2228. // item
  2229.     // BOOL TabCtrl_GetCurFocus(HWND hwndTC);
  2230. #define TCM_GETCURFOCUS     (TCM_FIRST + 47)
  2231. #define TabCtrl_GetCurFocus(hwnd) 
  2232.     (int)SendMessage((hwnd), TCM_GETCURFOCUS, 0, 0)
  2233. #define TCM_SETCURFOCUS     (TCM_FIRST + 48)
  2234. #define TabCtrl_SetCurFocus(hwnd, i) 
  2235.     SendMessage((hwnd),TCM_SETCURFOCUS, i, 0)
  2236. // TabView notification codes
  2237. #define TCN_KEYDOWN         (TCN_FIRST - 0)
  2238. typedef struct _TC_KEYDOWN
  2239. {
  2240.     NMHDR hdr;
  2241.     WORD wVKey;
  2242.     UINT flags;
  2243. } TC_KEYDOWN;
  2244. // selection has changed
  2245. #define TCN_SELCHANGE     (TCN_FIRST - 1)
  2246. // selection changing away from current tab
  2247. // return:  FALSE to continue, or TRUE to not change
  2248. #define TCN_SELCHANGING     (TCN_FIRST - 2)
  2249. /*/////////////////////////////////////////////////////////////////////////*/
  2250. // Animate control
  2251. #ifndef NOANIMATE
  2252. #ifdef _WIN32
  2253. /*
  2254. // OVERVIEW:
  2255. //
  2256. // The Animte control is a simple animation control, you can use it to
  2257. // have animaed controls in dialogs.
  2258. //
  2259. // what it animates are simple .AVI files from a resource.
  2260. // a simple AVI is a uncompressed or RLE compressed AVI file.
  2261. //
  2262. // the .AVI file must be placed in the resource with a type of "AVI"
  2263. //
  2264. // example:
  2265. //
  2266. //  myapp.rc:
  2267. //      MyAnimation AVI foobar.avi      // must be simple/RLE avifile
  2268. //
  2269. //  myapp.c:
  2270. //      Animate_Open(hwndA, "MyAnimation"); // open the resource
  2271. //      Animate_Play(hwndA, 0, -1, -1);     // play from start to finish and repeat
  2272. */
  2273. #define ANIMATE_CLASS "SysAnimate32"
  2274. /* STYLE BITS */
  2275. #define ACS_CENTER          0x0001      // center animation in window
  2276. #define ACS_TRANSPARENT     0x0002      // make animation transparent.
  2277. #define ACS_AUTOPLAY        0x0004      // start playing on open
  2278. /* MESSAGES */
  2279. #define ACM_OPEN    (WM_USER+100)
  2280. /* wParam: not used, 0
  2281.         // lParam: name of resource/file to open
  2282.         // return: bool
  2283.         */
  2284. #define ACM_PLAY            (WM_USER+101)
  2285.         /* wParam: repeat count        -1 = repeat forever.
  2286.         // lParam: LOWORD=frame start   0 = first frame.
  2287.         //         HIWORD=play end     -1 = last frame.
  2288.         // return: bool
  2289.         */
  2290. #define ACM_STOP            (WM_USER+102)
  2291.         /* wParam: not used
  2292.         // lParam: not used
  2293.         // return: bool
  2294.         */
  2295. /* notify codes, sent via WM_COMMAND */
  2296. #define ACN_START   1           // file has started playing
  2297. #define ACN_STOP    2           // file has stopped playing
  2298. /* HELPER MACROS */
  2299. #define Animate_Create(hwndP, id, dwStyle, hInstance)   
  2300.             CreateWindow(ANIMATE_CLASS, NULL,           
  2301.                 dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), hInstance, NULL)
  2302. #define Animate_Open(hwnd, szName)          (BOOL)SendMessage(hwnd, ACM_OPEN, 0, (LPARAM)(LPSTR)(szName))
  2303. #define Animate_Play(hwnd, from, to, rep)   (BOOL)SendMessage(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), (LPARAM)MAKELONG(from, to))
  2304. #define Animate_Stop(hwnd)                  (BOOL)SendMessage(hwnd, ACM_STOP, 0, 0)
  2305. #define Animate_Close(hwnd)                 Animate_Open(hwnd, NULL)
  2306. #define Animate_Seek(hwnd, frame)           Animate_Play(hwnd, frame, frame, 1)
  2307. #endif /* _WIN32 */
  2308. #endif /* NOANIMATE */
  2309. #ifndef NO_COMMCTRL_DA                                                   /* ;Internal */
  2310. //====== Dynamic Array routines ========================================== /* ;Internal */
  2311. // Dynamic structure array  /* ;Internal */
  2312. typedef struct _DSA FAR* HDSA;                                             /* ;Internal */
  2313.                                                                            /* ;Internal */
  2314. WINCOMMCTRLAPI HDSA   WINAPI DSA_Create(int cbItem, int cItemGrow);                  /* ;Internal */
  2315. WINCOMMCTRLAPI BOOL   WINAPI DSA_Destroy(HDSA hdsa);                                 /* ;Internal */
  2316. WINCOMMCTRLAPI BOOL   WINAPI DSA_GetItem(HDSA hdsa, int i, void FAR* pitem);         /* ;Internal */
  2317. WINCOMMCTRLAPI LPVOID WINAPI DSA_GetItemPtr(HDSA hdsa, int i);                       /* ;Internal */
  2318. WINCOMMCTRLAPI BOOL   WINAPI DSA_SetItem(HDSA hdsa, int i, void FAR* pitem);         /* ;Internal */
  2319. WINCOMMCTRLAPI int    WINAPI DSA_InsertItem(HDSA hdsa, int i, void FAR* pitem);      /* ;Internal */
  2320. WINCOMMCTRLAPI BOOL   WINAPI DSA_DeleteItem(HDSA hdsa, int i);                       /* ;Internal */
  2321. WINCOMMCTRLAPI BOOL   WINAPI DSA_DeleteAllItems(HDSA hdsa);                          /* ;Internal */
  2322. #define       DSA_GetItemCount(hdsa) (*(int FAR*)(hdsa))              /* ;Internal */
  2323.                                                                            /* ;Internal */
  2324. // Dynamic pointer array  /* ;Internal */
  2325. typedef struct _DPA FAR* HDPA;                                             /* ;Internal */
  2326.                                                                            /* ;Internal */
  2327. WINCOMMCTRLAPI HDPA   WINAPI DPA_Create(int cItemGrow);                              /* ;Internal */
  2328. WINCOMMCTRLAPI HDPA   WINAPI DPA_CreateEx(int cpGrow, HANDLE hheap);                       /* ;Internal */
  2329. WINCOMMCTRLAPI BOOL   WINAPI DPA_Destroy(HDPA hdpa);                                 /* ;Internal */
  2330. WINCOMMCTRLAPI HDPA   WINAPI DPA_Clone(HDPA hdpa, HDPA hdpaNew);                     /* ;Internal */
  2331. WINCOMMCTRLAPI LPVOID WINAPI DPA_GetPtr(HDPA hdpa, int i);                           /* ;Internal */
  2332. WINCOMMCTRLAPI int    WINAPI DPA_GetPtrIndex(HDPA hdpa, LPVOID p);                /* ;Internal */
  2333. WINCOMMCTRLAPI BOOL   WINAPI DPA_Grow(HDPA pdpa, int cp);                            /* ;Internal */
  2334. WINCOMMCTRLAPI BOOL   WINAPI DPA_SetPtr(HDPA hdpa, int i, LPVOID p);              /* ;Internal */
  2335. WINCOMMCTRLAPI int    WINAPI DPA_InsertPtr(HDPA hdpa, int i, LPVOID p);           /* ;Internal */
  2336. WINCOMMCTRLAPI LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, int i);                        /* ;Internal */
  2337. WINCOMMCTRLAPI BOOL   WINAPI DPA_DeleteAllPtrs(HDPA hdpa);                           /* ;Internal */
  2338. #define       DPA_GetPtrCount(hdpa)   (*(int FAR*)(hdpa))             /* ;Internal */
  2339. #define       DPA_GetPtrPtr(hdpa)     (*((LPVOID FAR* FAR*)((BYTE FAR*)(hdpa) + sizeof(int))))   /* ;Internal */
  2340. #define       DPA_FastGetPtr(hdpa, i) (DPA_GetPtrPtr(hdpa)[i])   /* ;Internal */
  2341. typedef int (CALLBACK *PFNDPACOMPARE)(LPVOID p1, LPVOID p2, LPARAM lParam); /* ;Internal */
  2342.                                                                            /* ;Internal */
  2343. WINCOMMCTRLAPI BOOL   WINAPI DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam); /* ;Internal */
  2344.                                                                            /* ;Internal */
  2345. // Search array.  If DPAS_SORTED, then array is assumed to be sorted       /* ;Internal */
  2346. // according to pfnCompare, and binary search algorithm is used.           /* ;Internal */
  2347. // Otherwise, linear search is used.                                       /* ;Internal */
  2348. //                                                                         /* ;Internal */
  2349. // Searching starts at iStart (-1 to start search at beginning).           /* ;Internal */
  2350. //                                                                         /* ;Internal */
  2351. // DPAS_INSERTBEFORE/AFTER govern what happens if an exact match is not    /* ;Internal */
  2352. // found.  If neither are specified, this function returns -1 if no exact  /* ;Internal */
  2353. // match is found.  Otherwise, the index of the item before or after the   /* ;Internal */
  2354. // closest (including exact) match is returned.                            /* ;Internal */
  2355. //                                                                         /* ;Internal */
  2356. // Search option flags                                                     /* ;Internal */
  2357. //                                                                         /* ;Internal */
  2358. #define DPAS_SORTED             0x0001                                    /* ;Internal */
  2359. #define DPAS_INSERTBEFORE       0x0002                                     /* ;Internal */
  2360. #define DPAS_INSERTAFTER        0x0004                                     /* ;Internal */
  2361.                                                                            /* ;Internal */
  2362. WINCOMMCTRLAPI int WINAPI DPA_Search(HDPA hdpa, LPVOID pFind, int iStart,  /* ;Internal */
  2363.       PFNDPACOMPARE pfnCompare,  /* ;Internal */
  2364.       LPARAM lParam, UINT options);    /* ;Internal */
  2365.                                                                            /* ;Internal */
  2366. //======================================================================   /* ;Internal */
  2367. // String management helper routines                                       /* ;Internal */
  2368.                                                                            /* ;Internal */
  2369. WINCOMMCTRLAPI int  WINAPI Str_GetPtr(LPCSTR psz, LPSTR pszBuf, int cchBuf);              /* ;Internal */
  2370. WINCOMMCTRLAPI BOOL WINAPI Str_SetPtr(LPSTR FAR* ppsz, LPCSTR psz);                       /* ;Internal */
  2371. #endif // NO_COMMCTRL_DA                                           /* ;Internal */
  2372.                                                                            /* ;Internal */
  2373. #ifndef NO_COMMCTRL_ALLOCFCNS                                                   /* ;Internal */
  2374. //====== Memory allocation functions ===================                        /* ;Internal */
  2375.                                                                                 /* ;Internal */
  2376. #ifdef _WIN32                                                                    /* ;Internal */
  2377. #define _huge                                                                   /* ;Internal */
  2378. #endif                                                                          /* ;Internal */
  2379.                                                                 /* ;Internal */
  2380. WINCOMMCTRLAPI void _huge* WINAPI Alloc(long cb);                               /* ;Internal */
  2381. WINCOMMCTRLAPI void _huge* WINAPI ReAlloc(void _huge* pb, long cb);              /* ;Internal */
  2382. WINCOMMCTRLAPI BOOL      WINAPI Free(void _huge* pb);                          /* ;Internal */
  2383. WINCOMMCTRLAPI DWORD      WINAPI GetSize(void _huge* pb);                       /* ;Internal */
  2384.                                                                 /* ;Internal */
  2385. #endif                                                          /* ;Internal */
  2386.                                                                                 /* ;Internal */
  2387. #ifndef NO_COMMCTRL_STRFCNS                                                     /* ;Internal */
  2388. // BUGBUG: move some place else                                                 /* ;Internal */
  2389. //=============== string routines ===================================     /* ;Internal */
  2390.                                                                           /* ;Internal */
  2391. // DBCS ready string routines...                                          /* ;Internal */
  2392.                                                                           /* ;Internal */
  2393. // these would be WINAPI but that conflicts with some private users of    /* ;Internal */
  2394. // these routines, and we don't need to load DS anyway                    /* ;Internal */
  2395.                                                                           /* ;Internal */
  2396. #define StrNCmp  StrCmpN                                                        /* ;Internal */
  2397. #define StrNCmpI StrCmpNI                                                       /* ;Internal */
  2398. #define StrNCpy  lstrcpyn                                                       /* ;Internal */
  2399. #define StrCpyN  lstrcpyn                                                       /* ;Internal */
  2400. WINCOMMCTRLAPI LPSTR FAR PASCAL StrChr(LPCSTR lpStart, WORD wMatch);                     /* ;Internal */
  2401. WINCOMMCTRLAPI LPSTR FAR PASCAL StrRChr(LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch);      /* ;Internal */
  2402. WINCOMMCTRLAPI LPSTR FAR PASCAL StrChrI(LPCSTR lpStart, WORD wMatch);                    /* ;Internal */
  2403. WINCOMMCTRLAPI LPSTR FAR PASCAL StrRChrI(LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch);     /* ;Internal */
  2404. WINCOMMCTRLAPI int   FAR PASCAL StrCmpN(LPCSTR lpStr1, LPCSTR lpStr2, int nChar);        /* ;Internal */
  2405. WINCOMMCTRLAPI int   FAR PASCAL StrCmpNI(LPCSTR lpStr1, LPCSTR lpStr2, int nChar);       /* ;Internal */
  2406. WINCOMMCTRLAPI LPSTR FAR PASCAL StrStr(LPCSTR lpFirst, LPCSTR lpSrch);                   /* ;Internal */
  2407. WINCOMMCTRLAPI LPSTR FAR PASCAL StrRStr(LPCSTR lpSource, LPCSTR lpLast, LPCSTR lpSrch);  /* ;Internal */
  2408. WINCOMMCTRLAPI LPSTR FAR PASCAL StrStrI(LPCSTR lpFirst, LPCSTR lpSrch);                  /* ;Internal */
  2409. WINCOMMCTRLAPI LPSTR FAR PASCAL StrRStrI(LPCSTR lpSource, LPCSTR lpLast, LPCSTR lpSrch); /* ;Internal */
  2410. WINCOMMCTRLAPI int   FAR PASCAL StrCSpn(LPCSTR lpStr, LPCSTR lpSet);                     /* ;Internal */
  2411. WINCOMMCTRLAPI int   FAR PASCAL StrCSpnI(LPCSTR lpStr, LPCSTR lpSet);                    /* ;Internal */
  2412. WINCOMMCTRLAPI int    WINAPI StrToInt(LPCSTR lpSrc);                                  /* ;Internal */
  2413. #define StrToLong StrToInt                                                      /* ;Internal */
  2414.                                                                                 /* ;Internal */
  2415. #endif //  NO_COMMCTRL_STRFCNS                                                  /* ;Internal */
  2416.                                                                                 /* ;Internal */
  2417. #ifndef _SIZE_T_DEFINED /* ;Internal */
  2418. #define _SIZE_T_DEFINED /* ;Internal */
  2419. typedef unsigned int size_t; /* ;Internal */
  2420. #endif /* ;Internal */
  2421.                                                                                 /* ;Internal */
  2422. #ifdef _WIN32                                                             /* ;Internal */
  2423. // BUGBUG: move some place else /* ;Internal */
  2424. //===================================================================      /* ;Internal */
  2425. typedef int (CALLBACK *MRUCMPPROC)(LPCSTR, LPCSTR);                        /* ;Internal */
  2426.                                                                 /* ;Internal */
  2427. // NB This is cdecl - to be compatible with the crts.                     /* ;Internal */
  2428. typedef int (cdecl FAR *MRUCMPDATAPROC)(const void FAR *, const void FAR *,  /* ;Internal */
  2429. size_t); /* ;Internal */
  2430. /* ;Internal */
  2431.                                                                 /* ;Internal */
  2432.                                                                                 /* ;Internal */
  2433. typedef struct _MRUINFO {                                                       /* ;Internal */
  2434.     DWORD cbSize;                                                               /* ;Internal */
  2435.     UINT uMax;                                                                  /* ;Internal */
  2436.     UINT fFlags;                                                                /* ;Internal */
  2437.     HKEY hKey;                                                                  /* ;Internal */
  2438.     LPCSTR lpszSubKey;                                                          /* ;Internal */
  2439.     MRUCMPPROC lpfnCompare;                                                     /* ;Internal */
  2440. } MRUINFO, FAR *LPMRUINFO;                                                      /* ;Internal */
  2441.                                                                                 /* ;Internal */
  2442. #define MRU_BINARY      0x0001                                                  /* ;Internal */
  2443. #define MRU_CACHEWRITE  0x0002                                                  /* ;Internal */
  2444.                                                                                 /* ;Internal */
  2445.                                                                                 /* ;Internal */
  2446. WINCOMMCTRLAPI HANDLE WINAPI CreateMRUList(LPMRUINFO lpmi);                                    /* ;Internal */
  2447. WINCOMMCTRLAPI void   WINAPI FreeMRUList(HANDLE hMRU);                                    /* ;Internal */
  2448. WINCOMMCTRLAPI int    WINAPI AddMRUString(HANDLE hMRU, LPCSTR szString);                  /* ;Internal */
  2449. WINCOMMCTRLAPI int    WINAPI DelMRUString(HANDLE hMRU, int nItem);                        /* ;Internal */
  2450. WINCOMMCTRLAPI int    WINAPI FindMRUString(HANDLE hMRU, LPCSTR szString, LPINT lpiSlot);  /* ;Internal */
  2451. WINCOMMCTRLAPI int    WINAPI EnumMRUList(HANDLE hMRU, int nItem, LPVOID lpData, UINT uLen); /* ;Internal */
  2452.                                                                                 /* ;Internal */
  2453. WINCOMMCTRLAPI int    WINAPI AddMRUData(HANDLE hMRU, const void FAR *lpData, UINT cbData); /* ;Internal */
  2454. WINCOMMCTRLAPI int    WINAPI FindMRUData(HANDLE hMRU, const void FAR *lpData, UINT cbData,  /* ;Internal */
  2455.   LPINT lpiSlot); /* ;Internal */
  2456. #endif                                                                        /* ;Internal */
  2457.                                                                            /* ;Internal */
  2458. //=========================================================================     /* ;Internal */
  2459. // for people that just gota use GetProcAddress()                               /* ;Internal */
  2460.                                                                                 /* ;Internal */
  2461. #ifdef _WIN32                                                                    /* ;Internal */
  2462. #define DPA_CreateORD                   328                                     /* ;Internal */
  2463. #define DPA_DestroyORD                  329                                     /* ;Internal */
  2464. #define DPA_GrowORD                     330                                     /* ;Internal */
  2465. #define DPA_CloneORD                    331                                     /* ;Internal */
  2466. #define DPA_GetPtrORD                   332                                     /* ;Internal */
  2467. #define DPA_GetPtrIndexORD              333                                     /* ;Internal */
  2468. #define DPA_InsertPtrORD                334                                     /* ;Internal */
  2469. #define DPA_SetPtrORD                   335                                     /* ;Internal */
  2470. #define DPA_DeletePtrORD                336                                     /* ;Internal */
  2471. #define DPA_DeleteAllPtrsORD            337                                     /* ;Internal */
  2472. #define DPA_SortORD                     338                                     /* ;Internal */
  2473. #define DPA_SearchORD                   339                                     /* ;Internal */
  2474. #define DPA_CreateExORD                 340                                     /* ;Internal */
  2475. #define SendNotifyORD                   341                                     /* ;Internal */
  2476. #define CreatePageORD                   163                                     /* ;Internal */
  2477. #define CreateProxyPageORD              164                                     /* ;Internal */
  2478. #endif                                                                          /* ;Internal */
  2479. #ifdef __cplusplus
  2480. } /* end of 'extern "C" {' */
  2481. #endif
  2482. #ifdef _WIN32
  2483. #include <poppack.h>
  2484. #endif
  2485. #endif
  2486. #endif /* _INC_COMMCTRL */