using System; using System.Runtime.InteropServices; using Vanara.Extensions; using Vanara.InteropServices; using static Vanara.PInvoke.User32; namespace Vanara.PInvoke { public static partial class ComCtl32 { /// /// Specifies that the size of the column array and the array itself (puColumns) are obtained by sending a LVN_GETDISPINFO notification. /// public const int I_COLUMNSCALLBACK = -1; /// The listview control sends the parent an LVN_GETDISPINFO notification code to retrieve the index of the group. public const int I_GROUPIDCALLBACK = -1; /// The item does not belong to a group. public const int I_GROUPIDNONE = -2; private const uint LVM_FIRST = 0x1000; private const int LVN_FIRST = -0x100; /// Values that specify alignment for LVM_ARRANGE. [PInvokeData("Commctrl.h")] public enum ListViewArrange { /// Aligns items according to the list-view control's current alignment styles (the default value). LVA_DEFAULT = 0x0000, /// Not implemented. Apply the LVS_ALIGNLEFT style instead. LVA_ALIGNLEFT = 0x0001, /// Not implemented. Apply the LVS_ALIGNTOP style instead. LVA_ALIGNTOP = 0x0002, /// Snaps all icons to the nearest grid position. LVA_SNAPTOGRID = 0x0005, } /// Flags for the member. [PInvokeData("Commctrl.h", MSDNShortId = "bb774742")] [Flags] public enum ListViewBkImageFlag : uint { /// The list-view control has no background image. LVBKIF_SOURCE_NONE = 0X00000000, /// /// A background bitmap is supplied via the hbm member of LVBKIMAGE. If the message LVM_SETBKIMAGE succeeds, then the list-view /// takes ownership of the bitmap. /// LVBKIF_SOURCE_HBITMAP = 0X00000001, /// The pszImage member contains the URL of the background image. LVBKIF_SOURCE_URL = 0X00000002, /// You can use the LVBKIF_SOURCE_MASK value to mask off all but the source flags. LVBKIF_SOURCE_MASK = 0X00000003, /// The background image is displayed normally. LVBKIF_STYLE_NORMAL = 0X00000000, /// The background image will be tiled to fill the entire background of the control. LVBKIF_STYLE_TILE = 0X00000010, /// You can use the LVBKIF_STYLE_MASK value to mask off all but the style flags. LVBKIF_STYLE_MASK = 0X00000010, /// /// Specify the coordinates of the first tile. This flag is valid only if the LVBKIF_STYLE_TILE flag is also specified. If this /// flag is not specified, the first tile begins at the upper-left corner of the client area. If you use ComCtl32.dll Version /// 6.0 the xOffsetPercent and yOffsetPercent fields contain pixels, not percentage values, to specify the coordinates of the /// first tile. Comctl32.dll version 6 is not redistributable but it is included in Windows or later. Also, you must specify /// Comctl32.dll version 6 in a manifest. For more information on manifests, see Enabling Visual Styles. /// LVBKIF_FLAG_TILEOFFSET = 0X00000100, /// /// A watermark background bitmap is supplied via the hbm member of LVBKIMAGE. If the LVM_SETBKIMAGE message succeeds, then the /// list-view control takes ownership of the bitmap. /// LVBKIF_TYPE_WATERMARK = 0X10000000, /// /// Valid only when LVBKIF_TYPE_WATERMARK is also specified. This flag indicates the bitmap provided via LVBKIF_TYPE_WATERMARK /// contains a valid alpha channel. /// LVBKIF_FLAG_ALPHABLEND = 0X20000000, } /// Mask flags used by . [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewColumMask { /// The fmt member is valid. LVCF_FMT = 0X0001, /// The cx member is valid. LVCF_WIDTH = 0X0002, /// The pszText member is valid. LVCF_TEXT = 0X0004, /// The iSubItem member is valid. LVCF_SUBITEM = 0X0008, /// Version 4.70. The iImage member is valid. LVCF_IMAGE = 0X0010, /// Version 4.70. The iOrder member is valid LVCF_ORDER = 0X0020, /// Version 6.00 and Windows Vista.The cxMin member is valid. LVCF_MINWIDTH = 0X0040, /// Version 6.00 and Windows Vista.The cxDefault member is valid. LVCF_DEFAULTWIDTH = 0X0080, /// Version 6.00 and Windows Vista.The cxIdeal member is valid LVCF_IDEALWIDTH = 0X0100, } /// /// Alignment of the column header and the subitem text in the column. The alignment of the leftmost column is always LVCFMT_LEFT; /// it cannot be changed. This member can be a combination of the following values. Note that not all combinations are valid. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774743")] [Flags] public enum ListViewColumnFormat { /// Text is left-aligned. LVCFMT_LEFT = 0X0000, /// Text is right-aligned. LVCFMT_RIGHT = 0X0001, /// Text is centered. LVCFMT_CENTER = 0X0002, /// /// A bitmask used to select those bits of fmt that control field justification. To check the format of a column, use a logical /// "and" to combine LCFMT_JUSTIFYMASK with fmt. You can then use a switch statement to determine whether the LVCFMT_LEFT, /// LVCFMT_RIGHT, or LVCFMT_CENTER bits are set. /// LVCFMT_JUSTIFYMASK = 0X0003, /// Version 4.70. The item displays an image from an image list. LVCFMT_IMAGE = 0X0800, /// /// Version 4.70. The bitmap appears to the right of text. This does not affect an image from an image list assigned to the /// header item. /// LVCFMT_BITMAP_ON_RIGHT = 0X1000, /// Version 4.70. The header item contains an image in the image list. LVCFMT_COL_HAS_IMAGES = 0X8000, /// Version 6.00 and Windows Vista. Can't resize the column; same as HDF_FIXEDWIDTH. LVCFMT_FIXED_WIDTH = 0X00100, /// Version 6.00 and Windows Vista. If not set, CCM_DPISCALE will govern scaling up fixed width. LVCFMT_NO_DPI_SCALE = 0X40000, /// Version 6.00 and Windows Vista. Width will augment with the row height. LVCFMT_FIXED_RATIO = 0X80000, /// Forces the column to wrap to the top of the next list of columns. LVCFMT_LINE_BREAK = 0X100000, /// Fills the remainder of the tile area. Might have a title. LVCFMT_FILL = 0X200000, /// Allows the column to wrap within the remaining space in its list of columns. LVCFMT_WRAP = 0X400000, /// Removes the title from the subitem. LVCFMT_NO_TITLE = 0X800000, /// Equivalent to a combination of LVCFMT_LINE_BREAK and LVCFMT_FILL. LVCFMT_TILE_PLACEMENTMASK = LVCFMT_LINE_BREAK | LVCFMT_FILL, /// /// Version 6.00 and Windows Vista. Column is a split button (same as HDF_SPLITBUTTON). The header of the column displays a /// split button (same as HDF_SPLITBUTTON). /// LVCFMT_SPLITBUTTON = 0X1000000, } /// Flags used in the member. [PInvokeData("Commctrl.h", MSDNShortId = "bb774745")] [Flags] public enum ListViewFindInfoFlag { /// Searches for a match between this structure's lParam member and the lParam member of an item's LVITEM structure. LVFI_PARAM = 0X0001, /// /// Searches based on the item text. Unless additional values are specified, the item text of the matching item must exactly /// match the string pointed to by the psz member. However, the search is case-insensitive. /// LVFI_STRING = 0X0002, /// Windows Vista and later. Equivalent to LVFI_PARTIAL. LVFI_SUBSTRING = 0X0004, /// /// Checks to see if the item text begins with the string pointed to by the psz member. This value implies use of LVFI_STRING. /// LVFI_PARTIAL = 0X0008, /// /// Continues the search at the beginning if no match is found. If this flag is used by itself, it is assumed that a string /// search is wanted. /// LVFI_WRAP = 0X0020, /// /// Finds the item nearest to the position specified in the pt member, in the direction specified by the vkDirection member. /// This flag is supported only by large icon and small icon modes. If LVFI_NEARESTXY is specified, all other flags are ignored. /// LVFI_NEARESTXY = 0X0040, } /// /// Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of /// the header flags. Footer flags are optional. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewGroupAlignment { /// Header text is aligned at the left of the window. LVGA_HEADER_LEFT = 0x00000001, /// Header text is centered horizontally in the window. LVGA_HEADER_CENTER = 0x00000002, /// Header text is aligned at the right of the window. LVGA_HEADER_RIGHT = 0x00000004, // Don't forget to validate exclusivity /// Footer text is aligned at the left of the window. LVGA_FOOTER_LEFT = 0x00000008, /// Footer text is centered horizontally in the window. LVGA_FOOTER_CENTER = 0x00000010, /// Footer text is aligned at the right of the window. LVGA_FOOTER_RIGHT = 0x00000020, // Don't forget to validate exclusivity } /// Used to set and retrieve groups. [PInvokeData("Commctrl.h", MSDNShortId = "bb774769")] [Flags] public enum ListViewGroupMask : uint { /// No other items are valid. LVGF_NONE = 0x00000000, /// pszHeader and cchHeader members are valid. LVGF_HEADER = 0x00000001, /// pszFooter and cchFooter members are valid. LVGF_FOOTER = 0x00000002, /// state and stateMask members are valid. LVGF_STATE = 0x00000004, /// uAlign member is valid. LVGF_ALIGN = 0x00000008, /// iGroupId member is valid. LVGF_GROUPID = 0x00000010, /// Version 6.00 and later. The pszSubtitle member is valid. LVGF_SUBTITLE = 0x00000100, /// Version 6.00 and later. The pszTask member is valid. LVGF_TASK = 0x00000200, /// Version 6.00 and later. The pszDescriptionTop member is valid. LVGF_DESCRIPTIONTOP = 0x00000400, /// Version 6.00 and later. The pszDescriptionBottom member is valid. LVGF_DESCRIPTIONBOTTOM = 0x00000800, /// Version 6.00 and later. The iTitleImage member is valid. LVGF_TITLEIMAGE = 0x00001000, /// Version 6.00 and later. The iExtendedImage member is valid. LVGF_EXTENDEDIMAGE = 0x00002000, /// Version 6.00 and later. The cItems member is valid. LVGF_ITEMS = 0x00004000, /// Version 6.00 and later. The pszSubsetTitle member is valid. LVGF_SUBSET = 0x00008000, /// Version 6.00 and later. The cchSubsetTitle member is valid. LVGF_SUBSETITEMS = 0x00010000, } /// Flags that specify which members contain or are to receive valid data. [PInvokeData("Commctrl.h", MSDNShortId = "bb774752")] [Flags] public enum ListViewGroupMetricsMask { /// No members are valid. LVGMF_NONE = 0x00000000, /// The Left, Top, Right, and Bottom members are valid. LVGMF_BORDERSIZE = 0x00000001, /// Not implemented. LVGMF_BORDERCOLOR = 0x00000002, /// Not implemented. LVGMF_TEXTCOLOR = 0x00000004, } /// Value used in LVM_GETGROUPRECT lparam value to specify coordinates of the rectangle to get. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewGroupRect { /// Coordinates of the entire expanded group. LVGGR_GROUP = 0, /// Coordinates of the header only (collapsed group). LVGGR_HEADER = 1, /// Coordinates of the label only. LVGGR_LABEL = 2, /// /// Coordinates of the subset link only (markup subset). A list-view control can limit the number of visible items displayed in /// each group. A link is presented to the user to allow the user to expand the group. This flag will return the bounding /// rectangle of the subset link if the group is a subset (group state of LVGS_SUBSETED, see structure LVGROUP, member state). /// This flag is provided so that accessibility applications can located the link. /// LVGGR_SUBSETLINK = 3, } /// [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewGroupState : uint { /// Groups are expanded, the group name is displayed, and all items in the group are displayed. LVGS_NORMAL = 0x00000000, /// The group is collapsed. LVGS_COLLAPSED = 0x00000001, /// The group is hidden. LVGS_HIDDEN = 0x00000002, /// Version 6.00 and later. The group does not display a header. LVGS_NOHEADER = 0x00000004, /// Version 6.00 and later. The group can be collapsed. LVGS_COLLAPSIBLE = 0x00000008, /// Version 6.00 and later. The group has keyboard focus. LVGS_FOCUSED = 0x00000010, /// Version 6.00 and later. The group is selected. LVGS_SELECTED = 0x00000020, /// Version 6.00 and later. The group displays only a portion of its items. LVGS_SUBSETED = 0x00000040, /// Version 6.00 and later. The subset link of the group has keyboard focus. LVGS_SUBSETLINKFOCUSED = 0x00000080, } /// The results of a hit test. This member can be one or more of the following values: [PInvokeData("Commctrl.h", MSDNShortId = "bb774754")] [Flags] public enum ListViewHitTestFlag : uint { /// The position is inside the list-view control's client window, but it is not over a list item. LVHT_NOWHERE = 0X00000001, /// The position is over a list-view item's icon. LVHT_ONITEMICON = 0X00000002, /// The position is over a list-view item's text. LVHT_ONITEMLABEL = 0X00000004, /// The position is over the state image of a list-view item. LVHT_ONITEMSTATEICON = 0X00000008, /// The position is over a list-view item. LVHT_ONITEM = LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON, /// The position is above the control's client area. LVHT_ABOVE = 0X00000008, /// The position is below the control's client area. LVHT_BELOW = 0X00000010, /// The position is to the right of the list-view control's client area. LVHT_TORIGHT = 0X00000020, /// The position is to the left of the list-view control's client area. LVHT_TOLEFT = 0X00000040, /// Windows Vista. The point is within the group header. LVHT_EX_GROUP_HEADER = 0X10000000, /// Windows Vista. The point is within the group footer. LVHT_EX_GROUP_FOOTER = 0X20000000, /// Windows Vista. The point is within the collapse/expand button of the group. LVHT_EX_GROUP_COLLAPSE = 0X40000000, /// Windows Vista. The point is within the area of the group where items are displayed. LVHT_EX_GROUP_BACKGROUND = 0X80000000, /// Windows Vista. The point is within the state icon of the group. LVHT_EX_GROUP_STATEICON = 0X01000000, /// Windows Vista. The point is within the subset link of the group. LVHT_EX_GROUP_SUBSETLINK = 0X02000000, /// /// Windows Vista. LVHT_EX_GROUP_BACKGROUND | LVHT_EX_GROUP_COLLAPSE | LVHT_EX_GROUP_FOOTER | LVHT_EX_GROUP_HEADER | /// LVHT_EX_GROUP_STATEICON | LVHT_EX_GROUP_SUBSETLINK. /// LVHT_EX_GROUP = LVHT_EX_GROUP_BACKGROUND | LVHT_EX_GROUP_COLLAPSE | LVHT_EX_GROUP_FOOTER | LVHT_EX_GROUP_HEADER | LVHT_EX_GROUP_STATEICON | LVHT_EX_GROUP_SUBSETLINK, /// Windows Vista. The point is within the icon or text content of the item and not on the background. LVHT_EX_ONCONTENTS = 0X04000000, /// Windows Vista. The point is within the footer of the list-view control. LVHT_EX_FOOTER = 0X08000000, } /// Type of image list. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewImageList { /// Image list with large icons. LVSIL_NORMAL, /// Image list with small icons. LVSIL_SMALL, /// Image list with state images. LVSIL_STATE, /// Image list for group header. LVSIL_GROUPHEADER } /// Flag that specifies where the insertion point should appear. [PInvokeData("Commctrl.h", MSDNShortId = "bb774758")] public enum ListViewInsertMarkFlag { /// The insertion point appears before the item LVIM_BEFORE, /// The insertion point appears after the item LVIM_AFTER } /// /// Set of flags that specify which members of the structure contain data to be set or which members are being /// requested. This member can have one or more of the following flags set: /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774760")] [Flags] public enum ListViewItemMask : uint { /// The pszText member is valid or must be set. LVIF_TEXT = 0x00000001, /// The iImage member is valid or must be set. LVIF_IMAGE = 0x00000002, /// The lParam member is valid or must be set. LVIF_PARAM = 0x00000004, /// The state member is valid or must be set. LVIF_STATE = 0x00000008, /// The iIndent member is valid or must be set. LVIF_INDENT = 0x00000010, /// /// The control will not generate LVN_GETDISPINFO to retrieve text information if it receives an LVM_GETITEM message. Instead, /// the pszText member will contain LPSTR_TEXTCALLBACK. /// LVIF_NORECOMPUTE = 0x00000800, /// /// The iGroupId member is valid or must be set. If this flag is not set when an LVM_INSERTITEM message is sent, the value of /// iGroupId is assumed to be I_GROUPIDCALLBACK. /// LVIF_GROUPID = 0x00000100, /// The cColumns member is valid or must be set. LVIF_COLUMNS = 0x00000200, /// /// Windows Vista and later. The piColFmt member is valid or must be set. If this flag is used, the cColumns member is valid or /// must be set. /// LVIF_COLFMT = 0x00010000, /// /// The operating system should store the requested list item information and not ask for it again. This flag is used only with /// the LVN_GETDISPINFO notification code. /// LVIF_DISETITEM = 0x1000, /// Complete mask. LVIF_ALL = 0x0001FFFF } /// Used by LVM_GETITEMINDEXRECT. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewItemRect { /// Returns the bounding rectangle of the entire subitem, including the icon and label. LVIR_BOUNDS, /// Returns the bounding rectangle of the icon or small icon of the subitem. LVIR_ICON, /// Returns the bounding rectangle of the subitem text. LVIR_LABEL, /// Returns the union of the LVIR_ICON and LVIR_LABEL rectangles, but excludes columns in report view. LVIR_SELECTBOUNDS } /// /// An item's state value consists of the item's state, an optional overlay mask index, and an optional state image mask index. An /// item's state determines its appearance and functionality. The state can be zero or one or more of the following values: /// [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewItemState : uint { /// No flags set. LVIS_NONE = 0x0000, /// /// The item has the focus, so it is surrounded by a standard focus rectangle. Although more than one item may be selected, only /// one item can have the focus. /// LVIS_FOCUSED = 0x0001, /// /// The item is selected. The appearance of a selected item depends on whether it has the focus and also on the system colors /// used for selection. /// LVIS_SELECTED = 0x0002, /// The item is marked for a cut-and-paste operation. LVIS_CUT = 0x0004, /// The item is highlighted as a drag-and-drop target. LVIS_DROPHILITED = 0x0008, /// Undocumented. LVIS_GLOW = 0x0010, // /// // Not currently supported. // Activating = 0x0020, /// The item's overlay image index is retrieved by a mask. LVIS_OVERLAYMASK = 0x0F00, /// The item's state image index is retrieved by a mask. LVIS_STATEIMAGEMASK = 0xF000, /// All flags. LVIS_ALL = 0xFFFFFFFF } /// LVM_ Messages for SendMessage [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewMessage : uint { /// /// Sets the UNICODE character format flag for the control. This message allows you to change the character set used by the /// control at run time rather than having to re-create the control. You can send this message explicitly or use the /// ListView_SetUnicodeFormat macro. /// Parameters /// wParam /// /// Determines the character set that is used by the control. If this value is nonzero, the control will use Unicode characters. /// If this value is zero, the control will use ANSI characters. /// /// lParam /// Must be zero. /// Returns /// Returns the previous Unicode format flag for the control. /// /// See the remarks for CCM_SETUNICODEFORMAT for a discussion of this message. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setunicodeformat LVM_SETUNICODEFORMAT = 0X2005, // CCM_SETUNICODEFORMAT, /// /// Retrieves the UNICODE character format flag for the control. You can send this message explicitly or use the /// ListView_GetUnicodeFormat macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns the Unicode format flag for the control. If this value is nonzero, the control is using Unicode characters. If this /// value is zero, the control is using ANSI characters. /// /// /// See the remarks for CCM_GETUNICODEFORMAT for a discussion of this message. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getunicodeformat LVM_GETUNICODEFORMAT = 0X2006, // CCM_GETUNICODEFORMAT, /// /// Gets the background color of a list-view control. You can send this message explicitly or by using the /// ListView_GetBkColor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the background color of the list-view control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getbkcolor LVM_GETBKCOLOR = LVM_FIRST + 0, /// /// Sets the background color of a list-view control. You can send this message explicitly or by using the /// ListView_SetBkColor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Background color to set or the CLR_NONE value for no background color. List-view controls with background colors redraw /// themselves significantly faster than those without background colors. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setbkcolor LVM_SETBKCOLOR = LVM_FIRST + 1, /// /// Retrieves the handle to an image list used for drawing list-view items. You can send this message explicitly or by using the /// ListView_GetImageList macro. /// Parameters /// wParam /// Image list to retrieve. This parameter can be one of the following values: /// /// /// Value /// Meaning /// /// /// LVSIL_NORMAL /// Image list with large icons. /// /// /// LVSIL_SMALL /// Image list with small icons. /// /// /// LVSIL_STATE /// Image list with state images. /// /// /// LVSIL_GROUPHEADER /// Image list for group header. /// /// /// lParam /// Must be zero. /// Returns /// Returns the handle to the specified image list if successful, or NULL otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getimagelist LVM_GETIMAGELIST = LVM_FIRST + 2, /// /// Assigns an image list to a list-view control. You can send this message explicitly or by using the /// ListView_SetImageList macro. /// Parameters /// wParam /// Type of image list. This parameter can be one of the following values: /// /// /// Value /// Meaning /// /// /// LVSIL_NORMAL /// Image list with large icons. /// /// /// LVSIL_SMALL /// Image list with small icons. /// /// /// LVSIL_STATE /// Image list with state images. /// /// /// LVSIL_GROUPHEADER /// Image list for group header. /// /// /// lParam /// Handle to the image list to assign. /// Returns /// Returns the handle to the image list previously associated with the control if successful, or NULL otherwise. /// /// /// The current image list will be destroyed when the list-view control is destroyed unless the LVS_SHAREIMAGELISTS style /// is set. If you use this message to replace one image list with another, your application must explicitly destroy all image /// lists other than the current one. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setimagelist LVM_SETIMAGELIST = LVM_FIRST + 3, /// /// Retrieves the number of items in a list-view control. You can send this message explicitly or by using the /// ListView_GetItemCount macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the number of items. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemcount LVM_GETITEMCOUNT = LVM_FIRST + 4, /// /// Retrieves some or all of a list-view item's attributes. You can send this message explicitly or by using the /// ListView_GetItem macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to an LVITEM structure that specifies the information to retrieve and receives information about the list-view item. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// /// When the LVM_GETITEM message is sent, the iItem and iSubItem members identify the item or subitem to /// retrieve information about and the mask member specifies which attributes to retrieve. For a list of possible values, /// see the description of the LVITEM structure. /// /// /// If the LVIF_TEXT flag is set in the mask member of the LVITEM structure, the pszText member must point /// to a valid buffer and the cchTextMax member must be set to the number of characters in that buffer. Applications /// should not assume that the text will necessarily be placed in the specified buffer. The control may instead change the /// pszText member of the structure to point to the new text, rather than place it in the buffer. /// /// /// If the mask member specifies the LVIF_STATE value, the stateMask member must specify the item state bits to /// retrieve. On output, the state member contains the values of the specified state bits. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitem LVM_GETITEM = LVM_FIRST + 75, /// /// Sets some or all of a list-view item's attributes. You can also send LVM_SETITEM to set the text of a subitem. You can send /// this message explicitly or by using the ListView_SetItem macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to an LVITEM structure that contains the new item attributes. The iItem and iSubItem members /// identify the item or subitem, and the mask member specifies which attributes to set. If the mask member /// specifies the LVIF_TEXT value, the pszText member is the address of a null-terminated string and the cchTextMax /// member is ignored. If the mask member specifies the LVIF_STATE value, the stateMask member specifies which item /// states to change and the state member contains the values for those states. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// /// To set the attributes of a list-view item, set the iItem member of the LVITEM structure to the index of the /// item, and set the iSubItem member to zero. For an item, you can set the state, pszText, iImage, /// and lParam members of the LVITEM structure. /// /// /// To set the text of a subitem, set the iItem and iSubItem members to indicate the specific subitem, and use the /// pszText member to specify the text. Alternatively, you can use the ListView_SetItemText macro to set the text /// of a subitem. You cannot set the state or lParam members for subitems because subitems do not have these /// attributes. In version 4.70 and later, you can set the iImage member for subitems. The subitem image will be displayed /// if the list-view control has the LVS_EX_SUBITEMIMAGES extended style. Previous versions will ignore the subitem image. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitem LVM_SETITEM = LVM_FIRST + 76, /// /// Inserts a new item in a list-view control. You can send this message explicitly or by using the ListView_InsertItem macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to an LVITEM structure that specifies the attributes of the list-view item. Use the iItem member to /// specify the zero-based index at which the new item should be inserted. If this value is greater than the number of items /// currently contained by the listview, the new item will be appended to the end of the list and assigned the correct index. /// Examine the message's return value to determine the actual index assigned to the item. /// /// Returns /// Returns the index of the new item if successful, or -1 otherwise. /// /// /// /// You cannot use ListView_InsertItem or LVM_INSERTITEM to insert subitems. The iSubItem member of the /// LVITEM structure must be zero. See LVM_SETITEM for information on setting subitems. /// /// /// If a list-view control has the LVS_EX_CHECKBOXES style set, any value placed in bits 12 through 15 of the state /// member of the LVITEM structure will be ignored. When an item is added with this style set, it will always be set to /// the unchecked state. /// /// /// If a list-view control has either the LVS_SORTASCENDING or LVS_SORTDESCENDING window style, an /// LVM_INSERTITEM message will fail if you try to insert an item that has LPSTR_TEXTCALLBACK as the value for its /// pszText member. /// /// /// The LVM_INSERTITEM message will insert the new item in the proper position in the sort order if the following /// conditions hold: /// /// /// /// You are using one of the LVS_SORTXXX styles. /// /// /// You are not using the LVS_OWNERDRAW style. /// /// /// The pszText member of the structure pointed to by pitem is not set to LPSTR_TEXTCALLBACK. /// /// /// /// If the LVITEM structure does not contain LVIF_GROUPID in the mask member, the value of the iGroupId /// member is I_GROUPIDCALLBACK by default. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-insertitem LVM_INSERTITEM = LVM_FIRST + 77, /// /// Removes an item from a list-view control. You can send this message explicitly or by using the ListView_DeleteItem macro. /// Parameters /// wParam /// The index of the list-view item to delete. /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-deleteitem LVM_DELETEITEM = LVM_FIRST + 8, /// /// Removes all items from a list-view control. You can send this message explicitly or by using the /// ListView_DeleteAllItems macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// When a list-view control receives the LVM_DELETEALLITEMS message, it sends the LVN_DELETEALLITEMS notification /// code to its parent window. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-deleteallitems LVM_DELETEALLITEMS = LVM_FIRST + 9, /// /// Gets the callback mask for a list-view control. You can send this message explicitly or by using the /// ListView_GetCallbackMask macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the callback mask. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getcallbackmask LVM_GETCALLBACKMASK = LVM_FIRST + 10, /// /// Changes the callback mask for a list-view control. You can send this message explicitly or by using the /// ListView_SetCallbackMask macro. /// Parameters /// wParam /// /// Value of the callback mask. The bits of the mask indicate the item states or images for which the application stores the /// current state data. This value can be any combination of the following constants: /// /// /// /// Value /// Meaning /// /// /// LVIS_CUT /// The item is marked for a cut-and-paste operation. /// /// /// LVIS_DROPHILITED /// The item is highlighted as a drag-and-drop target. /// /// /// LVIS_FOCUSED /// The item has the focus. /// /// /// LVIS_SELECTED /// The item is selected. /// /// /// LVIS_OVERLAYMASK /// The application stores the image list index of the current overlay image for each item. /// /// /// LVIS_STATEIMAGEMASK /// The application stores the image list index of the current state image for each item. /// /// /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// /// The callback mask of a list-view control is a set of bit flags that specify the item states for which the application, rather /// than the control, stores the current data. The callback mask applies to all of the control's items, unlike the callback item /// designation, which applies to a specific item. The callback mask is zero by default, meaning that the list-view control /// stores all item state information. After creating a list-view control and initializing its items, you can send the /// LVM_SETCALLBACKMASK message to change the callback mask. To retrieve the current callback mask, send the /// LVM_GETCALLBACKMASK message. /// /// For more information about overlay images and state images, see Adding List-View Image Lists. /// For more information on list-view callbacks, see Callback Items and the Callback Mask. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setcallbackmask LVM_SETCALLBACKMASK = LVM_FIRST + 11, /// /// Searches for a list-view item that has the specified properties and bears the specified relationship to a specified item. You /// can send this message explicitly or by using the ListView_GetNextItem macro. /// Parameters /// wParam /// /// Index of the item to begin the search with, or -1 to find the first item that matches the specified flags. The specified item /// itself is excluded from the search. /// /// lParam /// Specifies the relationship to the item specified in wParam. This can be one or a combination of the following values: /// /// /// Value /// Meaning /// /// /// Searches by index. /// /// /// /// LVNI_ALL /// Searches for a subsequent item by index, the default value. /// /// /// LVNI_PREVIOUS /// /// Windows Vista and later: Searches for an item that is ordered before the item specified in wParam. The /// LVNI_PREVIOUS flag is not directional (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item /// ordered before.) The LVNI_PREVIOUS flag basically reverses the logic of the search performed by the LVM_GETNEXTITEM or /// LVM_GETNEXTITEMINDEX messages. /// /// /// /// Searches by physical relationship to the index of the item where the search is to begin. /// /// /// /// LVNI_ABOVE /// Searches for an item that is above the specified item. /// /// /// LVNI_BELOW /// Searches for an item that is below the specified item. /// /// /// LVNI_TOLEFT /// Searches for an item to the left of the specified item. /// /// /// LVNI_TORIGHT /// Searches for an item to the right of the specified item. /// /// /// LVNI_DIRECTIONMASK /// /// Windows Vista and later: A directional flag mask with value as follows: LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT. /// /// /// /// The state of the item to find can be specified with one or a combination of the following values: /// /// /// /// LVNI_CUT /// The item has the LVIS_CUT state flag set. /// /// /// LVNI_DROPHILITED /// The item has the LVIS_DROPHILITED state flag set /// /// /// LVNI_FOCUSED /// The item has the LVIS_FOCUSED state flag set. /// /// /// LVNI_SELECTED /// The item has the LVIS_SELECTED state flag set. /// /// /// LVNI_STATEMASK /// /// Windows Vista and later: A state flag mask with value as follows: LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED. /// /// /// /// Searches by appearance of items or by group /// /// /// /// LVNI_VISIBLEORDER /// Windows Vista and later: Search the visible order. /// /// /// LVNI_VISIBLEONLY /// Windows Vista and later: Search the visible items. /// /// /// LVNI_SAMEGROUPONLY /// Windows Vista and later: Search the current group. /// /// /// If an item does not have all of the specified state flags set, the search continues with the next item. /// /// /// /// Returns /// Returns the index of the next item if successful, or -1 otherwise. /// /// /// Note that the following flags, for use only with Windows Vista, are mutually exclusive of any other flags in use: /// LVNI_VISIBLEONLY, LVNI_SAMEGROUPONLY, LVNI_VISIBLEORDER, LVNI_DIRECTIONMASK, and LVNI_STATEMASK. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getnextitem LVM_GETNEXTITEM = LVM_FIRST + 12, /// /// Searches for a list-view item with the specified characteristics. You can send this message explicitly or by using the /// ListView_FindItem macro. /// Parameters /// wParam /// /// The index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from /// the search. /// /// lParam /// A pointer to an LVFINDINFO structure that contains information about what to search for. /// Returns /// Returns the index of the item if successful, or -1 otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-finditem LVM_FINDITEM = LVM_FIRST + 83, /// /// Retrieves the bounding rectangle for all or part of an item in the current view. You can send this message explicitly or by /// using the ListView_GetItemRect macro. /// Parameters /// wParam /// Index of the list-view item. /// lParam /// /// Pointer to a RECT structure that receives the bounding rectangle. When the message is sent, the left member of /// this structure is used to specify the portion of the list-view item from which to retrieve the bounding rectangle. It must be /// set to one of the following values: /// /// /// /// Value /// Meaning /// /// /// LVIR_BOUNDS /// Returns the bounding rectangle of the entire item, including the icon and label. /// /// /// LVIR_ICON /// Returns the bounding rectangle of the icon or small icon. /// /// /// LVIR_LABEL /// Returns the bounding rectangle of the item text. /// /// /// LVIR_SELECTBOUNDS /// Returns the union of the LVIR_ICON and LVIR_LABEL rectangles, but excludes columns in report view. /// /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemrect LVM_GETITEMRECT = LVM_FIRST + 14, /// /// Moves an item to a specified position in a list-view control (must be in icon or small icon view). You can send this message /// explicitly or by using the ListView_SetItemPosition macro. /// Parameters /// wParam /// Index of the list-view item. /// lParam /// /// The LOWORD specifies the new x-position of the item's upper-left corner, in view coordinates. The HIWORD /// specifies the new y-position of the item's upper-left corner, in view coordinates. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// /// If the list-view control has the LVS_AUTOARRANGE style, the items in the list-view control are arranged after the /// position of the item is set. /// /// /// On Windows Vista, sending this message to a list-view control with the LVS_AUTOARRANGE style does nothing, and the /// return value is FALSE. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitemposition LVM_SETITEMPOSITION = LVM_FIRST + 15, /// /// Retrieves the position of a list-view item. You can send this message explicitly or by using the /// ListView_GetItemPosition macro. /// Parameters /// wParam /// Index of the list-view item. /// lParam /// Pointer to a POINT structure that receives the position of the item's upper-left corner, in view coordinates. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemposition LVM_GETITEMPOSITION = LVM_FIRST + 16, /// /// Determines the width of a specified string using the specified list-view control's current font. You can send this message /// explicitly or by using the ListView_GetStringWidth macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a null-terminated string. /// Returns /// Returns the string width if successful, or zero otherwise. /// /// /// The LVM_GETSTRINGWIDTH message returns the exact width, in pixels, of the specified string. If you use the returned string /// width as the column width in the LVM_SETCOLUMNWIDTH message, the string will be truncated. To retrieve the column /// width that can contain the string without truncating it, you must add padding to the returned string width. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getstringwidth LVM_GETSTRINGWIDTH = LVM_FIRST + 87, /// /// Determines which list-view item, if any, is at a specified position. You can send this message explicitly or by using the /// ListView_HitTest macro. /// Parameters /// wParam /// /// Must be 0. **Windows Vista.** Should be -1 if the **iGroup** and **iSubItem** members of the *lParam* structure are to be retrieved. /// /// lParam /// /// Pointer to an LVHITTESTINFO structure that contains the position to hit test and receives information about the /// results of the hit test. /// /// Returns /// Returns the index of the item at the specified position, if any, or -1 otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-hittest LVM_HITTEST = LVM_FIRST + 18, /// /// Ensures that a list-view item is either entirely or partially visible, scrolling the list-view control if necessary. You can /// send this message explicitly or by using the ListView_EnsureVisible macro. /// Parameters /// wParam /// The index of the list-view item. /// lParam /// /// A value specifying whether the item must be entirely visible. If this parameter is TRUE, no scrolling occurs if the /// item is at least partially visible. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// The message fails if the window style includes LVS_NOSCROLL. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-ensurevisible LVM_ENSUREVISIBLE = LVM_FIRST + 19, /// /// Scrolls the content of a list-view control. You can send this message explicitly or by using the ListView_Scroll macro. /// Parameters /// wParam /// /// Value of type int that specifies the amount of horizontal scrolling, in pixels, relative to the current position of /// the list view content. If the list-view control is in list view, this value is rounded up to the nearest number of pixels /// that form a whole column. /// /// lParam /// /// Value of type int that specifies the amount of vertical scrolling, in pixels, relative to the current position of the /// list view content. /// /// Returns /// Returns TRUE if successful; otherwise, FALSE. /// /// /// When the list-view control is in report view, the control can only be scrolled vertically in whole line increments. /// Therefore, the lParam parameter will be rounded to the nearest number of pixels that form a whole line increment. For /// example, if the height of a line is 16 pixels and 8 is passed for lParam, the list will be scrolled by 16 pixels (1 line). If /// 7 is passed for lParam, the list will be scrolled 0 pixels (0 lines). /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-scroll LVM_SCROLL = LVM_FIRST + 20, /// /// Forces a list-view control to redraw a range of items. You can send this message explicitly or by using the /// ListView_RedrawItems macro. /// Parameters /// wParam /// Index of the first item to redraw. /// lParam /// Index of the last item to redraw. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// The specified items are not actually redrawn until the list-view window receives a WM_PAINT message to repaint. To /// repaint immediately, call the UpdateWindow function after using this macro. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-redrawitems LVM_REDRAWITEMS = LVM_FIRST + 21, /// /// Arranges items in icon view. You can send this message explicitly or by using the ListView_Arrange macro. /// Parameters /// wParam /// One of the following values that specifies alignment: /// /// /// Value /// Meaning /// /// /// LVA_ALIGNLEFT /// Not implemented. Apply the LVS_ALIGNLEFT style instead. /// /// /// LVA_ALIGNTOP /// Not implemented. Apply the LVS_ALIGNTOP style instead. /// /// /// LVA_DEFAULT /// Aligns items according to the list-view control's current alignment styles (the default value). /// /// /// LVA_SNAPTOGRID /// Snaps all icons to the nearest grid position. /// /// /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful; otherwise, FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-arrange LVM_ARRANGE = LVM_FIRST + 22, /// /// Begins in-place editing of the specified list-view item's text. The message implicitly selects and focuses the specified /// item. You can send this message explicitly or by using the ListView_EditLabel macro. /// Parameters /// wParam /// The index of the list-view item. To cancel editing, set the index to -1. /// lParam /// Must be zero. /// Returns /// Returns the handle to the edit control that is used to edit the item text if successful, or NULL otherwise. /// /// /// /// When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid. You can subclass /// the edit control, but you should not destroy it. /// /// /// The control must have the focus before you send this message to the control. Focus can be set using the SetFocus function. /// /// If wParam is -1, an LVN_ENDLABELEDIT notification code is sent. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-editlabel LVM_EDITLABEL = LVM_FIRST + 118, /// /// Gets the handle to the edit control being used to edit a list-view item's text. You can send this message explicitly or by /// using the ListView_GetEditControl macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle to the edit control if successful, or NULL otherwise. /// /// /// /// When label editing begins, an edit control is created, positioned, and initialized. Before it is displayed, the list-view /// control sends its parent window an LVN_BEGINLABELEDIT notification code. /// /// /// To customize label editing, implement a handler for LVN_BEGINLABELEDIT and have it send an LVM_GETEDITCONTROL message /// to the list-view control. If a label is being edited, the return value will be a handle to the edit control. Use this handle /// to customize the edit control by sending the usual EM_XXX messages. /// /// /// When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid. You can subclass /// the edit control, but you should not destroy it. To cancel editing, send the list-view control a WM_CANCELMODE message. /// /// /// The list-view item being edited is the currently focused item that is, the item in the focused state. To find an item based /// on its state, use the LVM_GETNEXTITEM message. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-geteditcontrol LVM_GETEDITCONTROL = LVM_FIRST + 24, /// /// Gets the attributes of a list-view control's column. You can send this message explicitly or by using the /// ListView_GetColumn macro. /// Parameters /// wParam /// The index of the column. /// lParam /// /// A pointer to an LVCOLUMN structure that specifies the information to retrieve and receives information about the /// column. The mask member specifies which column attributes to retrieve. If the mask member specifies the /// LVCF_TEXT value, the pszText member must contain the address of the buffer that receives the item text and the /// cchTextMax member must specify the size of the buffer. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getcolumn LVM_GETCOLUMN = LVM_FIRST + 95, /// /// Sets the attributes of a list-view column. You can send this message explicitly or by using the ListView_SetColumn macro. /// Parameters /// wParam /// Index of the column. /// lParam /// /// Pointer to an LVCOLUMN structure that contains the new column attributes. The mask member specifies which /// column attributes to set. If the mask member specifies the LVCF_TEXT value, the pszText member is the address /// of a null-terminated string and the cchTextMax member is ignored. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setcolumn LVM_SETCOLUMN = LVM_FIRST + 96, /// /// Inserts a new column in a list-view control. You can send this message explicitly or by using the /// ListView_InsertColumn macro. /// Parameters /// wParam /// Index of the new column. /// lParam /// Pointer to an LVCOLUMN structure that contains the attributes of the new column. /// Returns /// Returns the index of the new column if successful, or -1 otherwise. /// /// Columns are visible only in report (details) view. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-insertcolumn LVM_INSERTCOLUMN = LVM_FIRST + 97, /// /// Removes a column from a list-view control. You can send this message explicitly or by using the ListView_DeleteColumn macro. /// Parameters /// wParam /// The index of the column to delete. /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// Deleting column zero of a list-view control is supported only in ComCtl32.dll version 6 and later. Version 5 also supports /// deleting column zero, but only after you use CCM_SETVERSION to set the version to 5 or later. In versions prior to /// version 5, if you must delete column zero, insert a zero length dummy column zero and delete column one and above. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-deletecolumn LVM_DELETECOLUMN = LVM_FIRST + 28, /// /// Gets the width of a column in report or list view. You can send this message explicitly or by using the /// ListView_GetColumnWidth macro. /// Parameters /// wParam /// The index of the column. This parameter is ignored in list view. /// lParam /// Must be zero. /// Returns /// /// Returns the column width if successful, or zero otherwise. If this message is sent to a list-view control with the /// LVS_REPORT style and the specified column does not exist, the return value is undefined. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getcolumnwidth LVM_GETCOLUMNWIDTH = LVM_FIRST + 29, /// /// Changes the width of a column in report-view mode or the width of all columns in list-view mode. You can send this message /// explicitly or use the ListView_SetColumnWidth macro. /// Parameters /// wParam /// Zero-based index of a valid column. For list-view mode, this parameter must be set to zero. /// lParam /// New width of the column, in pixels. For report-view mode, the following special values are supported: /// /// /// Value /// Meaning /// /// /// LVSCW_AUTOSIZE /// Automatically sizes the column. /// /// /// LVSCW_AUTOSIZE_USEHEADER /// /// Automatically sizes the column to fit the header text. If you use this value with the last column, its width is set to fill /// the remaining width of the list-view control. /// /// /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// Assume that you have a 2-column list-view control with a width of 500 pixels. If the width of column zero is set to 200 /// pixels, and you send this message with wParam = 1 and lParam = LVSCW_AUTOSIZE_USEHEADER, the second (and last) column will be /// 300 pixels wide. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setcolumnwidth LVM_SETCOLUMNWIDTH = LVM_FIRST + 30, /// /// Gets the handle to the header control used by the list-view control. You can send this message explicitly or use the /// ListView_GetHeader macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle to the header control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getheader LVM_GETHEADER = LVM_FIRST + 31, /// /// Creates a drag image list for the specified item. You can send this message explicitly or by using the /// ListView_CreateDragImage macro. /// Parameters /// wParam /// The index of the item. /// lParam /// /// A pointer to a POINT structure that receives the initial location of the upper-left corner of the image, in view coordinates. /// /// Returns /// Returns the handle to the drag image list if successful, or NULL otherwise. /// /// Your application is responsible for destroying the image list when it is no longer needed. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-createdragimage LVM_CREATEDRAGIMAGE = LVM_FIRST + 33, /// /// Retrieves the bounding rectangle of all items in the list-view control. The list view must be in icon or small icon view. You /// can send this message explicitly or by using the ListView_GetViewRect macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to a RECT structure that receives the bounding rectangle. All coordinates are relative to the visible area of /// the list-view control. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getviewrect LVM_GETVIEWRECT = LVM_FIRST + 34, /// /// Retrieves the text color of a list-view control. You can send this message explicitly or by using the /// ListView_GetTextColor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the text color. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gettextcolor LVM_GETTEXTCOLOR = LVM_FIRST + 35, /// /// Sets the text color of a list-view control. You can send this message explicitly or by using the ListView_SetTextColor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// A COLORREF that specifies the new text color. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-settextcolor LVM_SETTEXTCOLOR = LVM_FIRST + 36, /// /// Retrieves the text background color of a list-view control. You can send this message explicitly or by using the /// ListView_GetTextBkColor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the background color of the text. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gettextbkcolor LVM_GETTEXTBKCOLOR = LVM_FIRST + 37, /// /// Sets the background color of text in a list-view control. You can send this message explicitly or by using the /// ListView_SetTextBkColor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// New text background color. This can be CLR_NONE for no background color. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-settextbkcolor LVM_SETTEXTBKCOLOR = LVM_FIRST + 38, /// /// Retrieves the index of the topmost visible item when in list or report view. You can send this message explicitly or by using /// the ListView_GetTopIndex macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns the index of the item if successful. Returns zero if the list-view control is in icon or small icon view, or if the /// list-view control is in details view with groups enabled. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gettopindex LVM_GETTOPINDEX = LVM_FIRST + 39, /// /// Calculates the number of items that can fit vertically in the visible area of a list-view control when in list or report /// view. Only fully visible items are counted. You can send this message explicitly or by using the /// ListView_GetCountPerPage macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns the number of fully visible items if successful. If the current view is icon or small icon view, the return value is /// the total number of items in the list-view control. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getcountperpage LVM_GETCOUNTPERPAGE = LVM_FIRST + 40, /// /// Retrieves the current view origin for a list-view control. You can send this message explicitly or by using the /// ListView_GetOrigin macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a POINT structure that receives the view origin. /// Returns /// Returns TRUE if successful, or FALSE if the current view is list or report view. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getorigin LVM_GETORIGIN = LVM_FIRST + 41, /// /// Updates a list-view item. If the list-view control has the LVS_AUTOARRANGE style, this macro causes the list-view /// control to be arranged. You can send this message explicitly or by using the ListView_Update macro. /// Parameters /// wParam /// Index of the item to update. /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-update LVM_UPDATE = LVM_FIRST + 42, /// /// Changes the state of an item in a list-view control. You can send this message explicitly or by using the /// ListView_SetItemState macro. /// Parameters /// wParam /// Index of the list-view item. If this parameter is -1, then the state change is applied to all items. /// lParam /// /// Pointer to an LVITEM structure. The stateMask member specifies which state bits to change, and the state /// member contains the new values for those bits. The other members are ignored. /// /// Returns /// If you send this message explicitly, it returns TRUE if successful or FALSE otherwise. /// /// /// An item's state value includes a set of bit flags that indicate the item's state. The state value can also include image list /// indexes that indicate the item's state image and overlay image. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitemstate LVM_SETITEMSTATE = LVM_FIRST + 43, /// /// Retrieves the state of a list-view item. You can send this message explicitly or by using the ListView_GetItemState macro. /// Parameters /// wParam /// Index of the list-view item. /// lParam /// State information to retrieve. This parameter can be a combination of the following values: /// /// /// Value /// Meaning /// /// /// LVIS_CUT /// The item is marked for a cut-and-paste operation. /// /// /// LVIS_DROPHILITED /// The item is highlighted as a drag-and-drop target. /// /// /// LVIS_FOCUSED /// /// The item has the focus, so it is surrounded by a standard focus rectangle. Although more than one item may be selected, only /// one item can have the focus. /// /// /// /// LVIS_SELECTED /// /// The item is selected. The appearance of a selected item depends on whether it has the focus and also on the system colors /// used for selection. /// /// /// /// LVIS_OVERLAYMASK /// Use this mask to retrieve the item's overlay image index. /// /// /// LVIS_STATEIMAGEMASK /// Use this mask to retrieve the item's state image index. /// /// /// Returns /// /// Returns the current state for the specified item. The only valid bits in the return value are those that correspond to the /// bits set in the lParam parameter. /// /// /// /// An item's state information includes a set of bit flags as well as image list indexes that indicate the item's state image /// and overlay image. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemstate LVM_GETITEMSTATE = LVM_FIRST + 44, /// /// Retrieves the text of a list-view item or subitem. You can send this message explicitly or by using the /// ListView_GetItemText macro. /// Parameters /// wParam /// Index of the list-view item. /// lParam /// /// Pointer to an LVITEM structure. To retrieve the item text, set iSubItem to zero. To retrieve the text of a /// subitem, set iSubItem to the subitem's index. The pszText member points to a buffer that receives the text. The /// cchTextMax member specifies the number of characters in the buffer. /// /// Returns /// /// If you send this message explicitly, it returns the number of characters in the pszText member of the LVITEM structure. /// /// /// /// /// You can also send this message by calling the ListView_GetItemText macro. However, this macro does not return the /// string length. /// /// LVM_GETITEMTEXT is not supported under the LVS_OWNERDATA style. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemtext LVM_GETITEMTEXT = LVM_FIRST + 115, /// /// Changes the text of a list-view item or subitem. You can send this message explicitly or by using the /// ListView_SetItemText macro. /// Parameters /// wParam /// Zero-based index of the list-view item. /// lParam /// /// Pointer to an LVITEM structure. The iSubItem member is the index of the subitem, or it can be zero to set the /// item label. The pszText member is the address of a null-terminated string containing the new text; it can also be /// NULL. The pszText member can also be LPSTR_TEXTCALLBACK to indicate a callback item for which the parent window /// stores the text. In this case, the list-view control sends the parent an LVN_GETDISPINFO notification code when it /// needs the text. /// /// Returns /// If you send this message explicitly, it returns TRUE if successful or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitemtext LVM_SETITEMTEXT = LVM_FIRST + 116, /// /// Causes the list-view control to allocate memory for the specified number of items or sets the virtual number of items in a /// virtual list-view control. /// Parameters /// wParam /// Number of items that the list-view control will ultimately contain. /// lParam /// /// Version 4.70. Values that specify the behavior of the list-view control after resetting the item count. This value can be a /// combination of the following: /// /// /// /// Value /// Meaning /// /// /// LVSICF_NOINVALIDATEALL /// The list-view control will not repaint unless affected items are currently in view. /// /// /// LVSICF_NOSCROLL /// The list-view control will not change the scroll position when the item count changes. /// /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// /// How the memory is allocated depends on how the list-view control was created. You can send this message explicitly or use the /// ListView_SetItemCount or ListView_SetItemCountEx macros. For more information, see Virtual List-View Style. /// /// /// If the list-view control was created without the LVS_OWNERDATA style, sending this message causes the control to /// allocate its internal data structures for the specified number of items. This prevents the control from having to allocate /// the data structures every time an item is added. /// /// /// If the list-view control was created with the LVS_OWNERDATA style (a virtual list view), sending this message sets the /// virtual number of items that the control contains. /// /// /// The lParam parameter is intended only for list-view controls that use the LVS_OWNERDATA and LVS_REPORT or /// LVS_LIST styles. /// /// /// When the common control list-view is a virtualized list-view ( LVS_OWNERDATA), there is a 100,000,000 item limit on /// the list-view. In this scenario, LVM_SETITEMCOUNT will return FALSE when it has a wParam of 100,000,001. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitemcount LVM_SETITEMCOUNT = LVM_FIRST + 47, /// /// Uses an application-defined comparison function to sort the items of a list-view control. The index of each item changes to /// reflect the new sequence. You can send this message explicitly or by using the ListView_SortItems macro. /// Parameters /// wParam /// Application-defined value that is passed to the comparison function. /// lParam /// /// Pointer to the application-defined comparison function. The comparison function is called during the sort operation each time /// the relative order of two list items needs to be compared. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// The comparison function has the following form: /// /// int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); /// /// /// The lParam1 parameter is the value associated with the first item being compared, and the lParam2 parameter is the value /// associated with the second item. These are the values that were specified in the lParam member of the items' /// LVITEM structure when they were inserted into the list. The ListView_SortItems's wParam parameter is passed to /// the callback function as its third parameter. /// /// /// The comparison function must return a negative value if the first item should precede the second, a positive value if the /// first item should follow the second, or zero if the two items are equivalent. /// /// /// Note /// /// During the sorting process, the list-view contents are unstable. If the callback function sends any messages to the list-view /// control aside from LVM_GETITEM ( ListView_GetItem), the results are unpredictable. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-sortitems LVM_SORTITEMS = LVM_FIRST + 48, /// /// Moves an item to a specified position in a list-view control (must be in icon or small icon view). This message differs from /// the LVM_SETITEMPOSITION message in that it uses 32-bit coordinates. You can send this message explicitly or by using /// the ListView_SetItemPosition32 macro. /// Parameters /// wParam /// Index of the list-view item for which to set the position. /// lParam /// Pointer to a POINT structure that contains the new position of the item, in list-view coordinates. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitemposition32 LVM_SETITEMPOSITION32 = LVM_FIRST + 49, /// /// Determines the number of selected items in a list-view control. You can send this message explicitly or by using the /// ListView_GetSelectedCount macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the number of selected items. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getselectedcount LVM_GETSELECTEDCOUNT = LVM_FIRST + 50, /// /// Determines the spacing between items in a list-view control. You can send this message explicitly or by using the /// ListView_GetItemSpacing macro. /// Parameters /// wParam /// /// View for which to retrieve the item spacing. This parameter is TRUE for small icon view, or FALSE for icon view. /// /// lParam /// Must be zero. /// Returns /// /// Returns the amount of spacing between items. The horizontal spacing is contained in the LOWORD and the vertical /// spacing is contained in the HIWORD. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemspacing LVM_GETITEMSPACING = LVM_FIRST + 51, /// /// Retrieves the incremental search string of a list-view control. You can send this message explicitly or by using the /// ListView_GetISearchString macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to a buffer that receives the incremental search string. To just retrieve the length of the string, set lParam to NULL. /// /// Returns /// /// Returns the number of characters in the incremental search string, not including the terminating NULL character, or zero if /// the list-view control is not in incremental search mode. /// /// /// /// /// Security Warning: Using this message incorrectly might compromise the security of your program. This message does not /// provide a way for you to know the size of the buffer. If you use this message, first call the message passing NULL in /// the lParam, this returns the number of characters, excluding NULL that are required. Then call the message a second /// time to retrieve the string. You should review the Security Considerations: Microsoft Windows Controls before continuing. /// /// /// The incremental search string is the character sequence that the user types while the list view has the input focus. Each /// time the user types a character, the system appends the character to the search string and then searches for a matching item. /// If the system finds a match, it selects the item and, if necessary, scrolls it into view. /// /// /// A time-out period is associated with each character that the user types. If the time-out period elapses before the user types /// another character, the incremental search string is reset. /// /// /// Make sure that the buffer is large enough to hold the string and the terminating NULL character. If it is too small, an /// immediate invalid page fault will result. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getisearchstring LVM_GETISEARCHSTRING = LVM_FIRST + 117, /// /// Sets the spacing between icons in list-view controls that have the LVS_ICON style. You can send this message /// explicitly or by using the ListView_SetIconSpacing macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// The LOWORD specifies the distance, in pixels, to set between icons on the x-axis. The HIWORD specifies the /// distance, in pixels, to set between icons on the y-axis. See Remarks. /// /// Returns /// /// Returns a DWORD value that contains the previous x-axis distance in the low word, and the previous y-axis distance in /// the high word. /// /// /// /// /// Values for lParam are relative to the upper-left corner of an icon bitmap. Therefore, to set spacing between icons that do /// not overlap, the lParam values must include the size of the icon, plus the amount of empty space desired between icons. /// Values that do not include the width of the icon will result in overlaps. /// /// /// When defining the icon spacing, the lParam values must set to 4 or larger. Smaller values will not yield the desired layout. /// To reset the icons to the default spacing, set the lParam values to -1. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-seticonspacing LVM_SETICONSPACING = LVM_FIRST + 53, /// /// Sets extended styles in list-view controls. You can send this message explicitly or use the /// ListView_SetExtendedListViewStyle or ListView_SetExtendedListViewStyleEx macro. /// Parameters /// wParam /// /// DWORD value that specifies which styles in lParam are to be affected. This parameter can be a combination of /// Extended List-View Styles. Only the extended styles in wParam will be changed. All other styles will be maintained as /// they are. If this parameter is zero, all of the styles in lParam will be affected. /// /// lParam /// /// DWORD value that specifies the extended list-view control styles to set. This parameter can be a combination of /// Extended List-View Styles. Styles that are not set, but that are specified in wParam, are removed. /// /// Returns /// Returns a DWORD value that contains the previous extended list-view control styles. /// /// /// /// The wParam parameter allows you to modify one or more extended styles without having to retrieve the existing styles first. /// For example, if you pass LVS_EX_FULLROWSELECT for wParam and 0 for lParam, the LVS_EX_FULLROWSELECT style will /// be cleared but all other styles will remain the same. /// /// /// For backward compatibility reasons, the ListView_SetExtendedListViewStyle macro has not been updated to use wParam. To /// use the wParam value, use the ListView_SetExtendedListViewStyleEx macro. /// /// /// When you use this message to set the LVS_EX_CHECKBOXES style, any previously set state image index will be discarded. /// All check boxes will be initialized to the unchecked state. The state image index is contained in bits 12 through 15 of the /// state member of the LVITEM structure. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setextendedlistviewstyle LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54, // OPTIONAL WPARAM == MASK /// /// Gets the extended styles that are currently in use for a given list-view control. You can send this message explicitly or use /// the ListView_GetExtendedListViewStyle macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns a DWORD that represents the styles currently in use for a given list-view control. This value can be a /// combination of Extended List-View Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getextendedlistviewstyle LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55, /// /// Retrieves information about the bounding rectangle for a subitem in a list-view control. You can send this message explicitly /// or by using the ListView_GetSubItemRect macro (recommended). This message is intended to be used only with list-view /// controls that use the LVS_REPORT style. /// Parameters /// wParam /// Index of the subitem's parent item. /// lParam /// /// Pointer to a RECT structure that will receive the subitem bounding rectangle information. Its members must be /// initialized according to the following member/value relationships: /// /// /// /// Value /// Meaning /// /// /// top /// The one-based index of the subitem. /// /// /// left /// Flag value (see remarks). Indicates the portion of the list-view subitem for which to retrieve the bounding rectangle. /// /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// Following are the flag values that may be set. /// /// /// Requirement /// Value /// /// /// Flag Value /// Meaning /// /// /// LVIR_BOUNDS /// Returns the bounding rectangle of the entire item, including the icon and label. /// /// /// LVIR_ICON /// Returns the bounding rectangle of the icon or small icon. /// /// /// LVIR_LABEL /// Returns the bounding rectangle of the entire item, including the icon and label. This is identical to LVIR_BOUNDS. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getsubitemrect LVM_GETSUBITEMRECT = LVM_FIRST + 56, /// /// Determines which list-view item or subitem is at a given position. You can send this message explicitly or by using the /// ListView_SubItemHitTest macro. /// Parameters /// wParam /// Must be 0. **Windows Vista.** Should be -1 if the **iGroup** member of *lParam* is to be retrieved. /// lParam /// /// Pointer to an LVHITTESTINFO structure. The POINT structure within LVHITTESTINFO should be set to the /// client coordinates to be hit-tested. /// /// Returns /// /// Returns the index of the item or subitem tested, if any, or -1 otherwise. If an item or subitem is at the given coordinates, /// the fields of the LVHITTESTINFO structure will be filled with the applicable hit information. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-subitemhittest LVM_SUBITEMHITTEST = LVM_FIRST + 57, /// /// Sets the left-to-right order of columns in a list-view control. You can send this message explicitly or use the /// ListView_SetColumnOrderArray macro. /// Parameters /// wParam /// Size, in elements, of the buffer at lParam. /// lParam /// /// Pointer to an array that specifies the order in which columns should be displayed, from left to right. For example, if the /// contents of the array are {2,0,1}, the control displays column 2, column 0, and column 1 in that order. /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setcolumnorderarray LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58, /// /// Gets the current left-to-right order of columns in a list-view control. You can send this message explicitly or use the /// ListView_GetColumnOrderArray macro. /// Parameters /// wParam /// The number of columns in the list-view control. /// lParam /// /// A pointer to an array of integers that receives the index values of the columns in the list-view control. The array must be /// large enough to hold wParam elements. /// /// Returns /// /// If successful, returns nonzero, and the buffer at lParam receives the column index of each column in the control in the order /// they appear from left to right. Otherwise, the return value is zero. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getcolumnorderarray LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59, /// /// Sets the hot item for a list-view control. You can send this message explicitly or use the ListView_SetHotItem macro. /// Parameters /// wParam /// Zero-based index of the item to be set as the hot item. /// lParam /// Must be zero. /// Returns /// Returns the index of the item that was previously hot. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-sethotitem LVM_SETHOTITEM = LVM_FIRST + 60, /// /// Retrieves the index of the hot item. You can send this message explicitly or use the ListView_GetHotItem macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the index of the item that is hot. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gethotitem LVM_GETHOTITEM = LVM_FIRST + 61, /// /// Sets the HCURSOR value that the list-view control uses when the pointer is over an item while hot tracking is enabled. You /// can send this message explicitly or use the ListView_SetHotCursor macro. To check whether hot tracking is enabled, /// call SystemParametersInfo. /// Parameters /// wParam /// Must be zero. /// lParam /// Handle to the cursor to be set. /// Returns /// Returns an HCURSOR value that is the previous hot cursor. /// /// A list-view control uses hot tracking and hover selection when the LVS_EX_TRACKSELECT style is set. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-sethotcursor LVM_SETHOTCURSOR = LVM_FIRST + 62, /// /// Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled. You can send this message /// explicitly or use the ListView_GetHotCursor macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns an HCURSOR value that is the handle to the cursor that the list-view control uses when hot tracking is enabled. /// /// A list-view control uses hot tracking and hover selection when the LVS_EX_TRACKSELECT style is set. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gethotcursor LVM_GETHOTCURSOR = LVM_FIRST + 63, /// /// Calculates the approximate width and height required to display a given number of items. You can send this message explicitly /// or use the ListView_ApproximateViewRect macro. /// Parameters /// wParam /// /// The number of items to be displayed in the control. If this parameter is set to -1, the message uses the total number of /// items in the control. /// /// lParam /// /// The LOWORD is the proposed x-dimension of the control, in pixels. This parameter can be set to -1 to allow the message /// to use the current width value. /// /// /// The HIWORD is the proposed y-dimension of the control, in pixels. This parameter can be set to -1 to allow the message /// to use the current height value. /// /// Returns /// /// Returns a DWORD value that holds the approximate width (in the LOWORD) and height (in the HIWORD) needed /// to display the items, in pixels. /// /// /// /// Setting the size of the list-view control based on the dimensions provided by this message can optimize redraw and reduce flicker. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-approximateviewrect LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64, /// /// Sets the working areas within a list-view control. You can send this message explicitly or use the /// ListView_SetWorkAreas macro. /// Parameters /// wParam /// /// The number of structures in the array at lprc. The maximum number of working areas allowed is defined by the LV_MAX_WORKAREAS value. /// /// lParam /// /// Pointer to an array of RECT structures that contain the new working areas of the list-view control. Values in these /// structures are in client coordinates. If this parameter is NULL, the working area will be set to the client area of /// the control. wParam specifies the number of structures in this array. /// /// Returns /// The return value for this message is not used. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setworkareas LVM_SETWORKAREAS = LVM_FIRST + 65, /// /// Retrieves the working areas from a list-view control. You can send this message explicitly or use the /// ListView_GetWorkAreas macro. /// Parameters /// wParam /// The number of RECT structures in the array at lParam. /// lParam /// /// Pointer to an array of RECT structures that receive the current working areas of the list-view control. Values in /// these structures are in client coordinates. wParam specifies the number of structures in this array. /// /// Returns /// The return value for this message is not used. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getworkareas LVM_GETWORKAREAS = LVM_FIRST + 70, /// /// Retrieves the number of working areas in a list-view control. You can send this message explicitly or use the /// ListView_GetNumberOfWorkAreas macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to a UINT value that receives the number of working areas in the list-view control. If zero is placed in this /// variable, then no working areas are currently set. This value cannot be NULL. /// /// Returns /// The return value for this message is not used. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getnumberofworkareas LVM_GETNUMBEROFWORKAREAS = LVM_FIRST + 73, /// /// Retrieves the selection mark from a list-view control. You can send this message explicitly or use the /// ListView_GetSelectionMark macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the zero-based selection mark, or -1 if there is no selection mark. /// /// The selection mark is the item index from which a multiple selection starts. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getselectionmark LVM_GETSELECTIONMARK = LVM_FIRST + 66, /// /// Sets the selection mark in a list-view control. You can send this message explicitly or use the /// ListView_SetSelectionMark macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Zero-based index of the new selection mark. If set to -1, the selection mark is removed. /// Returns /// Returns the previous selection mark, or -1 if there is no previous selection mark. /// /// /// The selection mark is the item index from which a multiple selection starts. This message does not affect the selection state /// of the item. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setselectionmark LVM_SETSELECTIONMARK = LVM_FIRST + 67, /// /// Sets the amount of time which the mouse cursor must hover over an item before it is selected. You can send this message /// explicitly or use the ListView_SetHoverTime macro. /// Parameters /// wParam /// Must be zero. /// lParam /// /// The new amount of time, in milliseconds, that the mouse cursor must hover over an item before it is selected. If this value /// is ( DWORD)-1, then the hover time is set to the default hover time. /// /// Returns /// Returns the previous hover time. /// /// /// The hover time only affects list-view controls that have the LVS_EX_TRACKSELECT, LVS_EX_ONECLICKACTIVATE, or /// LVS_EX_TWOCLICKACTIVATE extended list-view style. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-sethovertime LVM_SETHOVERTIME = LVM_FIRST + 71, /// /// Retrieves the amount of time that the mouse cursor must hover over an item before it is selected. You can send this message /// explicitly or use the ListView_GetHoverTime macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns the amount of time, in milliseconds, that the mouse cursor must hover over an item before it is selected. If the /// return value is ( DWORD)-1, then the hover time is the default hover time. /// /// /// /// The hover time only affects list-view controls that have the LVS_EX_TRACKSELECT, LVS_EX_ONECLICKACTIVATE, or /// LVS_EX_TWOCLICKACTIVATE extended list-view style. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gethovertime LVM_GETHOVERTIME = LVM_FIRST + 72, /// /// Sets the tooltip control that the list-view control will use to display tooltips. You can send this message explicitly or use /// the ListView_SetToolTips macro. /// Parameters /// wParam /// Handle to the tooltip control to be set. /// lParam /// Must be zero. /// Returns /// Returns the handle to the previous tooltip control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-settooltips LVM_SETTOOLTIPS = LVM_FIRST + 74, /// /// Retrieves the tooltip control that the list-view control uses to display tooltips. You can send this message explicitly or /// use the ListView_GetToolTips macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle of the tooltip control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gettooltips LVM_GETTOOLTIPS = LVM_FIRST + 78, /// /// Uses an application-defined comparison function to sort the items of a list-view control. The index of each item changes to /// reflect the new sequence. You can send this message explicitly or by using the ListView_SortItemsEx macro. /// Parameters /// wParam /// Application-defined value that is passed to the comparison function. /// lParam /// /// Pointer to an application-defined comparison function. It is called during the sort operation each time the relative order of /// two list items needs to be compared. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// The comparison function has the following form: /// /// int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); /// /// /// This message is similar to LVM_SORTITEMS, except for the type of information passed to the comparison function. With /// LVM_SORTITEMSEX, lParam1 is the current index of the first item, and lParam2 is the current index of the second item. /// You can send an LVM_GETITEMTEXT message to retrieve more information on an item, if needed. /// /// /// The comparison function must return a negative value if the first item should precede the second, a positive value if the /// first item should follow the second, or zero if the two items are equivalent. /// /// /// Note /// /// During the sorting process, the list-view contents are unstable. If the callback function sends any messages to the list-view /// control aside from LVM_GETITEM ( ListView_GetItem), the results are unpredictable. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-sortitemsex LVM_SORTITEMSEX = LVM_FIRST + 81, /// /// Sets the background image in a list-view control. You can send this message explicitly or by using the /// ListView_SetBkImage macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a LVBKIMAGE structure that contains the new background image information. /// Returns /// /// Returns nonzero if successful, or zero otherwise. Returns zero if the ulFlags member of the LVBKIMAGE structure /// is LVBKIF_SOURCE_NONE. /// /// /// /// Because the list-view control uses OLE COM to manipulate the background images, the calling application must call /// CoInitialize or OleInitialize before sending this message. It is best to call one of these functions when the /// application is initialized and call either CoUninitialize or OleUninitialize when the application is terminating. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setbkimage LVM_SETBKIMAGE = LVM_FIRST + 138, /// /// Gets the background image in a list-view control. You can send this message explicitly or by using the /// ListView_GetBkImage macro. /// Parameters /// wParam /// Must be zero. /// lParam /// A pointer to an LVBKIMAGE structure that will receive the background image information. /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getbkimage LVM_GETBKIMAGE = LVM_FIRST + 139, /// /// Sets the index of the selected column. /// Parameters /// wParam /// Value of type **int** that specifies the column index. /// lParam /// Must be zero. /// Returns /// The return value is not used. /// /// /// The column indices are stored in an int array. See the puColumns member of LVITEM. /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setselectedcolumn LVM_SETSELECTEDCOLUMN = LVM_FIRST + 140, /// /// Sets the view of a list-view control. /// Parameters /// wParam /// **DWORD** that specifies the view. /// lParam /// Must be zero. /// Returns /// Returns 1 if successful, or -1 otherwise. For example, -1 is returned if the view is invalid. /// /// /// Following are the values for views. /// /// /// LV_VIEW_DETAILS /// /// /// LV_VIEW_ICON /// /// /// LV_VIEW_LIST /// /// /// LV_VIEW_SMALLICON /// /// /// LV_VIEW_TILE /// /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comctl32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setview LVM_SETVIEW = LVM_FIRST + 142, /// /// Retrieves the current view of a list-view control. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns a DWORD that specifies the current view. /// /// /// Following are the values for views. /// /// /// LV_VIEW_DETAILS /// /// /// LV_VIEW_ICON /// /// /// LV_VIEW_LIST /// /// /// LV_VIEW_SMALLICON /// /// /// LV_VIEW_TILE /// /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getview LVM_GETVIEW = LVM_FIRST + 143, /// /// Inserts a group into a list-view control. /// Parameters /// wParam /// Index where the group is to be added. If this is -1, the group is added at the end of the list. /// lParam /// Pointer to a /// **LVGROUP** /// structure that contains the group to add. /// Returns /// Returns the index of the item that the group was added to, or -1 if the operation failed. /// /// /// To turn on group mode, call LVM_ENABLEGROUPVIEW or ListView_EnableGroupView. /// A group cannot be inserted into an empty list-view control. /// /// Be sure to set the iGroupId in the item(s) the group was added to. Otherwise after LVM_ENABLEGROUPVIEW message /// processing with TRUE the listview control will not show any items. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32 version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-insertgroup LVM_INSERTGROUP = LVM_FIRST + 145, /// /// Sets group information. Send this message explicitly or by using the ListView_SetGroupInfo macro. /// Parameters /// wParam /// ID that specifies the group whose information is to be set. /// lParam /// /// Pointer to a [**LVGROUP**](windows/win32/api/commctrl/ns-commctrl-lvgroup) structure that contains the information to set. /// /// Returns /// Returns the ID of the group if successful, or -1 otherwise. /// /// /// /// To change a group ID of an existing group add LVGF_GROUPID to LVGROUP.mask and set LVGROUP.iGroupId to /// the new ID. The call will fail if LVGROUP.iGroupId contains ID of an existing group. /// /// /// To update other properties of an existing group (e.g. update an alignment of the header or footer text for the group, /// uAlign) LVGROUP.mask must not contain LVGF_GROUPID, else the update will fail. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setgroupinfo LVM_SETGROUPINFO = LVM_FIRST + 147, /// /// Gets group information. /// Parameters /// wParam /// An ID that specifies the group whose information is retrieved. /// lParam /// A pointer an /// **LVGROUP** /// structure that receives the retrieved information. Set the **cbSize** member of this structure to sizeof(LVGROUP). /// Returns /// Returns the ID of the group if successful, or -1 otherwise. /// /// /// Before attempting to retrieve the header for a group, first ensure that the group does not have the LBGS_NOHEADER style. /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getgroupinfo LVM_GETGROUPINFO = LVM_FIRST + 149, /// /// Removes a group from a list-view control. /// Parameters /// wParam /// ID that specifies the group to remove. /// lParam /// Must be NULL. /// Returns /// Returns the index of the group if successful, or -1 otherwise. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-removegroup LVM_REMOVEGROUP = LVM_FIRST + 150, /// This message is not implemented. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-movegroup LVM_MOVEGROUP = LVM_FIRST + 151, /// /// Gets the number of groups. /// Parameters /// wParam /// Not used. Should be 0. /// lParam /// Not used. Should be 0. /// Returns /// Returns the number of groups. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getgroupcount LVM_GETGROUPCOUNT = LVM_FIRST + 152, /// /// Gets information on a specified group. Send this message explicitly or by using the ListView_GetGroupInfoByIndex macro. /// Parameters /// wParam /// The index of the group. /// lParam /// /// A pointer to an LVGROUP structure to receive information on the group specified by wParam. The calling process is /// responsible for allocating memory for the structure and any buffers in the structure, such as the one pointed to by the /// pszHeader member. Set any contingent members of the structure, such as cchHeader the size of the buffer pointed /// to by pszHeader in WCHARs including the terminating NULL. Set cbSize to sizeof(LVGROUP). /// /// The message receiver is responsible for setting the structure members with information for the group specified by wParam. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getgroupinfobyindex LVM_GETGROUPINFOBYINDEX = LVM_FIRST + 153, /// This message is not implemented. // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-moveitemtogroup LVM_MOVEITEMTOGROUP = LVM_FIRST + 154, /// /// Gets the rectangle for a specified group. Send this message explicitly or by using the ListView_GetGroupRect macro. /// Parameters /// wParam /// Specifies the group by iGroupId (see LVGROUP structure). /// lParam /// /// A pointer to a RECT structure to receive information on the group specified by wParam. The message receiver is /// responsible for setting the structure members with information for the group specified by wParam. /// /// /// The calling process is responsible for allocating memory for the structure. Set the top member of the RECT to /// one of the following flags to specify the coordinates of the rectangle to get. /// /// /// /// Value /// Meaning /// /// /// LVGGR_GROUP /// Coordinates of the entire expanded group. /// /// /// LVGGR_HEADER /// Coordinates of the header only (collapsed group). /// /// /// LVGGR_LABEL /// Coordinates of the label only. /// /// /// LVGGR_SUBSETLINK /// /// Coordinates of the subset link only (markup subset). A list-view control can limit the number of visible items displayed in /// each group. A link is presented to the user to allow the user to expand the group. This flag will return the bounding /// rectangle of the subset link if the group is a subset (group state of LVGS_SUBSETED, see structure LVGROUP, member /// state). This flag is provided so that accessibility applications can located the link. /// /// /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getgrouprect LVM_GETGROUPRECT = LVM_FIRST + 98, /// /// Sets information about the display of groups. /// Parameters /// wParam /// Must be **NULL**. /// lParam /// Pointer to an /// **LVGROUPMETRICS** /// structure that contains the metrics to set. /// Returns /// The return value is not used. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setgroupmetrics LVM_SETGROUPMETRICS = LVM_FIRST + 155, /// /// Gets information about the display of groups. /// Parameters /// wParam /// Must be **NULL**. /// lParam /// A pointer to an /// **LVGROUPMETRICS** /// structure that receives the retrieved metrics. /// Returns /// The return value is not used. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getgroupmetrics LVM_GETGROUPMETRICS = LVM_FIRST + 156, /// /// Enables or disables whether the items in a list-view control display as a group. /// Parameters /// wParam /// /// A **BOOL** that indicates whether to enable a list-view control to group displayed items. Use **TRUE** to enable grouping, /// **FALSE** to disable it. /// /// lParam /// Must be **NULL**. /// Returns /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// 0 /// The ability to display list-view items as a group is already enabled or disabled. /// /// /// 1 /// The state of the control was successfully changed. /// /// /// -1 /// The operation failed. /// /// /// /// /// LVM_ENABLEGROUPVIEW is not supported under the LVS_OWNERDATA style. /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-enablegroupview LVM_ENABLEGROUPVIEW = LVM_FIRST + 157, /// /// Uses an application-defined comparison function to sort groups by ID within a list-view control. /// Parameters /// wParam /// Pointer to an application-defined comparison function, /// LVGroupCompare /// . /// lParam /// Void pointer to the application-defined information. /// Returns /// Returns 1 if successful, or 0 otherwise. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-sortgroups LVM_SORTGROUPS = LVM_FIRST + 158, /// /// Inserts a group into an ordered list of groups. /// Parameters /// wParam /// Pointer to an /// LVINSERTGROUPSORTED /// structure that contains the group to insert. /// lParam /// Must be **NULL**. /// Returns /// The return value is not used. /// /// /// /// The ordering of the list is based on the ID of the group. The order is defined by the application-defined ordering function, /// LVGroupCompare, that is passed in the LVINSERTGROUPSORTED structure by the wParam parameter. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-insertgroupsorted LVM_INSERTGROUPSORTED = LVM_FIRST + 159, /// /// Removes all groups from a list-view control. /// Parameters /// wParam /// Must be **NULL**. /// lParam /// Must be **NULL**. /// Returns /// The return value is not used. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-removeallgroups LVM_REMOVEALLGROUPS = LVM_FIRST + 160, /// /// Determines whether the list-view control has a specified group. /// Parameters /// wParam /// ID of the group. /// lParam /// Must be **NULL**. /// Returns /// Returns TRUE if the list-view control has the specified group, or FALSE otherwise. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-hasgroup LVM_HASGROUP = LVM_FIRST + 161, /// /// Gets the state for a specified group. Send this message explicitly or by using the ListView_GetGroupState macro. /// Parameters /// wParam /// Specifies the group by iGroupId (see LVGROUP structure). /// lParam /// Specifies the state values to retrieve. This is a combination of the flags listed for the state member of LVGROUP. /// Returns /// /// Returns the combination of state values that are set. For example, if lParam is LVGS_COLLAPSED and the value returned is /// zero, the LVGS_COLLAPSED state is not set. Zero is returned if the group is not found. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getgroupstate LVM_GETGROUPSTATE = LVM_FIRST + 92, /// /// Gets the group that has the focus. Send this message explicitly or by using the ListView_GetFocusedGroup macro. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the index of the group with state of LVGS_FOCUSED, or -1 if there is no group with state of LVGS_FOCUSED. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getfocusedgroup LVM_GETFOCUSEDGROUP = LVM_FIRST + 93, /// /// Sets information that a list-view control uses in tile view. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to an /// **LVTILEVIEWINFO** /// structure that contains the information to set. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-settileviewinfo LVM_SETTILEVIEWINFO = LVM_FIRST + 162, /// /// Retrieves information about a list-view control in tile view. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to an /// **LVTILEVIEWINFO** /// structure that receives the retrieved information. /// Returns /// Return value not used. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gettileviewinfo LVM_GETTILEVIEWINFO = LVM_FIRST + 163, /// /// Sets information for an existing tile of a list-view control. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to an /// **LVTILEINFO** /// structure that contains the information to set. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// LVM_SETTILEINFO is not supported under the LVS_OWNERDATA style. /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-settileinfo LVM_SETTILEINFO = LVM_FIRST + 164, /// /// Retrieves information about a tile in a list-view control. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to an /// **LVTILEINFO** /// structure that receives the retrieved information. /// Returns /// Return value not used. /// /// /// /// Tile view is a new way of arranging and displaying items in a list-view control. The other views are icon, small icon, /// details, and list. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-gettileinfo LVM_GETTILEINFO = LVM_FIRST + 165, /// /// Sets the insertion point to the defined position. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a /// LVINSERTMARK /// structure that specifies where to set the insertion point. /// Returns /// /// Returns TRUE if successful, or FALSE otherwise. FALSE is returned if the size in the cbSize /// member of the LVINSERTMARK structure does not equal the actual size of the structure, or when an insertion point does /// not apply in the current view. /// /// /// /// /// An insertion point can only appear if the list-view control is in icon view, small icon view, or tile view, and is not in /// group-view mode. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setinsertmark LVM_SETINSERTMARK = LVM_FIRST + 166, /// /// Retrieves the position of the insertion point. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a /// LVINSERTMARK /// structure that receives the position of the insertion point. /// Returns /// /// Returns TRUE if successful, or FALSE otherwise. FALSE is returned if the size in the cbSize /// member of the LVINSERTMARK structure does not equal the actual size of the structure. /// /// /// /// /// An insertion point can appear only if the list-view control is in icon view, small icon view, or tile view, and is not in /// group-view mode. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getinsertmark LVM_GETINSERTMARK = LVM_FIRST + 167, /// /// Retrieves the insertion point closest to a specified point. /// Parameters /// wParam /// Pointer to a **POINT** structure that contains the hit test coordinates. /// lParam /// Pointer to an /// LVINSERTMARK /// structure that specifies the insertion point closest to the coordinates defined by the *wParam* parameter. /// Returns /// /// Returns TRUE if successful, or FALSE otherwise. FALSE is returned if the size in the cbSize /// member of the LVINSERTMARK structure does not equal the actual size of the structure, or when an insertion point does /// not apply in the current view. /// /// /// /// /// An insertion point can only appear if the list-view control is in icon view, small icon view, or tile view and is not in /// group-view mode. /// /// /// If insertion points do not apply for the view, the LVINSERTMARK structure contains a -1 in the iItem member. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-insertmarkhittest LVM_INSERTMARKHITTEST = LVM_FIRST + 168, /// /// Retrieves the rectangle that bounds the insertion point. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Pointer to a /// **RECT** /// structure that contains the coordinates of a rectangle that bounds the insertion point. /// Returns /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// 0 /// No insertion point found. /// /// /// 1 /// Insertion point found. /// /// /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getinsertmarkrect LVM_GETINSERTMARKRECT = LVM_FIRST + 169, /// /// Sets the color of the insertion point. /// Parameters /// wParam /// Must be zero. /// lParam /// **COLORREF** structure that specifies the color to set the insertion point. /// Returns /// Returns COLORREF structure set to the previous color. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setinsertmarkcolor LVM_SETINSERTMARKCOLOR = LVM_FIRST + 170, /// /// Retrieves the color of the insertion point. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns a COLORREF structure that contains the color of the insertion point. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getinsertmarkcolor LVM_GETINSERTMARKCOLOR = LVM_FIRST + 171, /// /// Retrieves an integer that specifies the selected column. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns an UINT that specifies the selected column. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getselectedcolumn LVM_GETSELECTEDCOLUMN = LVM_FIRST + 174, /// /// Checks whether the list-view control has group view enabled. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns TRUE if group view is enabled, or FALSE otherwise. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-isgroupviewenabled LVM_ISGROUPVIEWENABLED = LVM_FIRST + 175, /// /// Retrieves the color of the border of a list-view control if the LVS_EX_BORDERSELECT extended window style is set. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns a COLORREF structure that contains the color of the border of a list-view control. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getoutlinecolor LVM_GETOUTLINECOLOR = LVM_FIRST + 176, /// /// Sets the color of the border of a list-view control if the LVS_EX_BORDERSELECT extended window style is set. /// Parameters /// wParam /// Must be zero. /// lParam /// **COLORREF** structure that specifies the color to set the border. /// Returns /// Returns COLORREF structure that contains the outline color. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setoutlinecolor LVM_SETOUTLINECOLOR = LVM_FIRST + 177, /// /// Cancels an item text editing operation. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// This message causes a an LVN_ENDLABELEDIT notification to be sent. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-canceleditlabel LVM_CANCELEDITLABEL = LVM_FIRST + 179, /// /// Maps the index of an item to a unique ID. /// Parameters /// wParam /// The index of an item. /// lParam /// Must be zero. /// Returns /// Returns a unique ID. /// /// /// /// List-view controls internally track items by index. This can present problems because indexes can change during the control's lifetime. /// /// /// The list-view control can tag an item with an ID when the item is created. You can use this ID to guarantee uniqueness during /// the lifetime of the list-view control. /// /// /// To uniquely identify an item, take the index that is returned from a call such as IComponent::GetDisplayInfo and call /// LVM_MAPINDEXTOID. The return value is a unique ID. /// /// /// Note /// /// In a multithreaded environment, the index is only guaranteed on the thread that hosts the list-view control, not on /// background threads. /// /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-mapindextoid LVM_MAPINDEXTOID = LVM_FIRST + 180, /// /// Maps the ID of an item to an index. /// Parameters /// wParam /// The unique ID of an item. /// lParam /// Must be zero. /// Returns /// Returns the most current index. /// /// /// /// List-view controls internally track items by index. This can present problems because indexes can change during the control's lifetime. /// /// /// The list-view control can tag an item with an ID when the item is created. You can use this ID to guarantee uniqueness during /// the lifetime of the list-view control. /// /// /// To uniquely identify an item, take the index that is returned from a call such as IComponent::GetDisplayInfo and call /// LVM_MAPINDEXTOID. The return value is a unique ID. /// /// /// If you need the index of an item after an ID is created you can call LVM_MAPIDTOINDEX with the unique ID and it /// returns the most current index. /// /// LVM_MAPIDTOINDEX is not supported under the LVS_OWNERDATA style. /// /// Note /// /// In a multithreaded environment, the index is only guaranteed on the thread that hosts the list-view control, not on /// background threads. /// /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-mapidtoindex LVM_MAPIDTOINDEX = LVM_FIRST + 181, /// /// Indicates if an item in the list-view control is visible. Send this message explicitly or by using the /// ListView_IsItemVisible macro. /// Parameters /// wParam /// An index of the item in the list-view control. /// lParam /// Must be zero. /// Returns /// Returns TRUE if visible, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-isitemvisible LVM_ISITEMVISIBLE = LVM_FIRST + 182, /// LVM_GETACCVERSION = LVM_FIRST + 193, /// /// Gets the text meant for display when the list-view control appears empty. Send this message explicitly or by using the /// ListView_GetEmptyText macro. /// Parameters /// wParam /// The size of the buffer pointed to by lParam, including the terminating NULL. /// lParam /// /// A pointer to a null-terminated, Unicode buffer of size specified by wParam to receive the text. The caller is responsible for /// allocating the buffer. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getemptytext LVM_GETEMPTYTEXT = LVM_FIRST + 204, /// /// Retrieves the coordinates of the footer for a list-view control. Send this message explicitly or by using the /// ListView_GetFooterRect macro. /// Parameters /// wParam /// Not used. Must be 0. /// lParam /// /// A pointer to a RECT structure to receive the coordinates. The calling process is responsible for allocating this /// structure. The coordinates received are expressed as client coordinates. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getfooterrect LVM_GETFOOTERRECT = LVM_FIRST + 205, /// /// Gets information about the footer of a list-view control. Send this message explicitly or by using the /// ListView_GetFooterInfo macro. /// Parameters /// wParam /// Not used. Must be 0. /// lParam /// /// A pointer to a LVFOOTERINFO structure to receive information depending on the value of the mask member. The /// calling process is responsible for allocating this structure and setting the mask member. /// /// Returns /// Returns TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getfooterinfo LVM_GETFOOTERINFO = LVM_FIRST + 206, /// /// Gets the coordinates of a footer for a specified item in a list-view control. Send this message explicitly or by using the /// ListView_GetFooterItemRect macro. /// Parameters /// wParam /// The index of the item in the list-view control. /// lParam /// /// A pointer to a RECT structure to receive the coordinates. The calling application is responsible for allocating this /// structure. The coordinates received are expressed as client coordinates. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getfooteritemrect LVM_GETFOOTERITEMRECT = LVM_FIRST + 207, /// /// Gets information on a footer item in a list-view control. Send this message explicitly or by using the /// ListView_GetFooterItem macro. /// Parameters /// wParam /// The index of the item. /// lParam /// /// A pointer to a LVFOOTERITEM structure to receive a value for the state and/or pszText members according /// to the value of the mask member. The calling process is responsible for allocating this structure and setting its /// members to indicate to the receiver what information to return. For more information, see LVFOOTERITEM. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getfooteritem LVM_GETFOOTERITEM = LVM_FIRST + 208, /// /// Retrieves the bounding rectangle for all or part of a subitem in the current view of a list-view control. Send this message /// explicitly or by using the ListView_GetItemIndexRect macro. /// Parameters /// wParam /// /// A pointer to a LVITEMINDEX structure for the parent item of the subitem. The calling process is responsible for /// allocating this structure and setting its members. wParam must not be NULL. /// /// lParam /// /// A pointer to a RECT structure to receive the coordinates. The calling process is responsible for allocating this /// structure. lParam must not be NULL. Set the top member to the index of the subitem. Set the left member /// to one of the following values, indicating the part of the subitem for which the bounding rectangle is to be retrieved. /// /// /// /// Value /// Meaning /// /// /// LVIR_BOUNDS /// Returns the bounding rectangle of the entire subitem, including the icon and label. /// /// /// LVIR_ICON /// Returns the bounding rectangle of the icon or small icon of the subitem. /// /// /// LVIR_LABEL /// Returns the bounding rectangle of the subitem text. /// /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getitemindexrect LVM_GETITEMINDEXRECT = LVM_FIRST + 209, /// /// Sets the state of a list-view item. Send this message explicitly or by using the ListView_SetItemIndexState macro. /// Parameters /// wParam /// /// A pointer to an LVITEMINDEX structure for the item. The calling process is responsible for allocating this structure /// and setting the members. /// /// lParam /// /// A pointer to an LVITEM structure. The calling process is responsible for allocating memory for the structure. Set the /// state member to one or more (as a bitwise combination) of the List-View Item States flags. Set the stateMask /// member of the structure to indicate the valid bits of the state member. For more information, see the stateMask /// member of the LVITEM structure. /// /// Returns /// Returns one of the following values of type HRESULT. /// /// /// Return code /// Description /// /// /// E_FAIL /// The state could not be set. /// /// /// E_UNEXPECTED /// The list-view control was not ready for the operation. /// /// /// S_OK /// The operation was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setitemindexstate LVM_SETITEMINDEXSTATE = LVM_FIRST + 210, /// /// Retrieves the index of an item in a specified list-view control that matches the specified properties and relationship to /// another item. Send this message explicitly or by using the ListView_GetNextItemIndex macro. /// Parameters /// wParam /// /// A pointer to the LVITEMINDEX structure for the item to begin the search with, or -1 to find the first item that /// matches the specified flags. The calling process is responsible for allocating this structure and setting its members. /// /// lParam /// /// Specifies the relationship to the item listed in parameter wParam. This can be one or a combination of the following values: /// /// /// /// Value /// Meaning /// /// /// Searches by index. /// /// /// /// LVNI_ALL /// Searches for a subsequent item by index, the default value. /// /// /// Searches by physical relationship to the index of the item where the search is to begin. /// /// /// /// LVNI_ABOVE /// Searches for an item that is above the specified item. /// /// /// LVNI_BELOW /// Searches for an item that is below the specified item. /// /// /// LVNI_TOLEFT /// Searches for an item to the left of the specified item. /// /// /// LVNI_PREVIOUS /// /// Windows Vista and later: Searches for an item that is ordered before the item specified in wParam. The /// LVNI_PREVIOUS flag is not directional (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item /// ordered before.) The LVNI_PREVIOUS flag basically reverses the logic of the search performed by the LVM_GETNEXTITEM or /// LVM_GETNEXTITEMINDEX messages. /// /// /// /// LVNI_TORIGHT /// Searches for an item to the right of the specified item. /// /// /// LVNI_DIRECTIONMASK /// /// Windows Vista and later: A directional flag mask with value as follows: LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT. /// /// /// /// The state of the item to find can be specified with one or a combination of the following values: /// /// /// /// LVNI_CUT /// The item has the LVIS_CUT state flag set. /// /// /// LVNI_DROPHILITED /// The item has the LVIS_DROPHILITED state flag set /// /// /// LVNI_FOCUSED /// The item has the LVIS_FOCUSED state flag set. /// /// /// LVNI_SELECTED /// The item has the LVIS_SELECTED state flag set. /// /// /// LVNI_STATEMASK /// /// Windows Vista and later: A state flag mask with value as follows: LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED. /// /// /// /// Searches by appearance of items or by group. /// /// /// /// LVNI_VISIBLEORDER /// Windows Vista and later: Search the visible order. /// /// /// LVNI_VISIBLEONLY /// Windows Vista and later: Search the visible items. /// /// /// LVNI_SAMEGROUPONLY /// Windows Vista and later: Search the current group. /// /// /// If an item does not have all of the specified state flags set, the search continues with the next item. /// /// /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// Note that the following flags, for use only with Windows Vista, are mutually exclusive of any other flags in use: /// LVNI_PREVIOUS, LVNI_VISIBLEONLY, LVNI_SAMEGROUPONLY, LVNI_VISIBLEORDER, LVNI_DIRECTIONMASK, and LVNI_STATEMASK. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getnextitemindex LVM_GETNEXTITEMINDEX = LVM_FIRST + 211, /// LVM_SETPRESERVEALPHA = LVM_FIRST + 212, /*LVM_SetBkImage = SETBKIMAGEW, LVM_GetBkImage = GETBKIMAGEW,*/ } /// Specifies the relationship to the item listed in parameter wParam in LVM_GETNEXTITEMINDEX. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewNextItemFlag { /// Searches for a subsequent item by index, the default value. LVNI_ALL = 0X0000, /// The item has the LVIS_FOCUSED state flag set. LVNI_FOCUSED = 0X0001, /// The item has the LVIS_SELECTED state flag set. LVNI_SELECTED = 0X0002, /// The item has the LVIS_CUT state flag set. LVNI_CUT = 0X0004, /// The item has the LVIS_DROPHILITED state flag set LVNI_DROPHILITED = 0X0008, /// Windows Vista and later: A state flag mask with value as follows: LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED. LVNI_STATEMASK = LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED, /// Windows Vista and later: Search the visible order. LVNI_VISIBLEORDER = 0X0010, /// /// Windows Vista and later: Searches for an item that is ordered before the item specified in wParam. The LVNI_PREVIOUS flag is /// not directional (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item ordered before.) The /// LVNI_PREVIOUS flag basically reverses the logic of the search performed by the LVM_GETNEXTITEM or LVM_GETNEXTITEMINDEX messages. /// LVNI_PREVIOUS = 0X0020, /// Windows Vista and later: Search the visible items. LVNI_VISIBLEONLY = 0X0040, /// Windows Vista and later: Search the current group. LVNI_SAMEGROUPONLY = 0X0080, /// Searches for an item that is above the specified item. LVNI_ABOVE = 0X0100, /// Searches for an item that is below the specified item. LVNI_BELOW = 0X0200, /// Searches for an item to the left of the specified item. LVNI_TOLEFT = 0X0400, /// Searches for an item to the right of the specified item. LVNI_TORIGHT = 0X0800, /// /// Windows Vista and later: A directional flag mask with value as follows: LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT. /// LVNI_DIRECTIONMASK = LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT, } /// ListView notification identifiers. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewNotification { /// /// /// Notifies a list-view control's parent window that a drag-and-drop operation involving the left mouse button is being /// initiated. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_BEGINDRAG pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure. The iItem member identifies the item being dragged, and the other members /// are zero. /// /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-begindrag LVN_BEGINDRAG = LVN_FIRST - 9, /// /// /// Notifies a list-view control's parent window about the start of label editing for an item. This notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_BEGINLABELEDIT pdi = (LPNMLVDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose /// iItem member identifies the item being edited. Note that subitems cannot be edited; the iSubItem member is /// always set to zero. /// /// Returns /// To allow the user to edit the label, return FALSE. /// To prevent the user from editing the label, return TRUE. /// /// /// /// When label editing begins, an edit control is created, positioned, and initialized. Before it is displayed, the list-view /// control sends its parent window an LVN_BEGINLABELEDIT notification code. /// /// /// To customize label editing, implement a handler for LVN_BEGINLABELEDIT and have it send an LVM_GETEDITCONTROL message /// to the list-view control. If a label is being edited, the return value will be a handle to the edit control. Use this handle /// to customize the edit control by sending the usual EM_XXX messages. /// /// When the user cancels or completes the editing, the parent window receives an LVN_ENDLABELEDIT notification code. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-beginlabeledit LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITW, /// /// /// Notifies a list-view control's parent window about the start of label editing for an item. This notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_BEGINLABELEDIT pdi = (LPNMLVDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose /// iItem member identifies the item being edited. Note that subitems cannot be edited; the iSubItem member is /// always set to zero. /// /// Returns /// To allow the user to edit the label, return FALSE. /// To prevent the user from editing the label, return TRUE. /// /// /// /// When label editing begins, an edit control is created, positioned, and initialized. Before it is displayed, the list-view /// control sends its parent window an LVN_BEGINLABELEDIT notification code. /// /// /// To customize label editing, implement a handler for LVN_BEGINLABELEDIT and have it send an LVM_GETEDITCONTROL message /// to the list-view control. If a label is being edited, the return value will be a handle to the edit control. Use this handle /// to customize the edit control by sending the usual EM_XXX messages. /// /// When the user cancels or completes the editing, the parent window receives an LVN_ENDLABELEDIT notification code. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-beginlabeledit LVN_BEGINLABELEDITA = LVN_FIRST - 5, /// /// /// Notifies a list-view control's parent window about the start of label editing for an item. This notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_BEGINLABELEDIT pdi = (LPNMLVDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose /// iItem member identifies the item being edited. Note that subitems cannot be edited; the iSubItem member is /// always set to zero. /// /// Returns /// To allow the user to edit the label, return FALSE. /// To prevent the user from editing the label, return TRUE. /// /// /// /// When label editing begins, an edit control is created, positioned, and initialized. Before it is displayed, the list-view /// control sends its parent window an LVN_BEGINLABELEDIT notification code. /// /// /// To customize label editing, implement a handler for LVN_BEGINLABELEDIT and have it send an LVM_GETEDITCONTROL message /// to the list-view control. If a label is being edited, the return value will be a handle to the edit control. Use this handle /// to customize the edit control by sending the usual EM_XXX messages. /// /// When the user cancels or completes the editing, the parent window receives an LVN_ENDLABELEDIT notification code. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-beginlabeledit LVN_BEGINLABELEDITW = LVN_FIRST - 75, /// /// /// Notifies a list-view control's parent window that a drag-and-drop operation involving the right mouse button is being /// initiated. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_BEGINRDRAG pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure. The iItem member identifies the item being dragged, and the other members /// are zero. /// /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-beginrdrag LVN_BEGINRDRAG = LVN_FIRST - 11, /// /// /// Notifies a list-view control's parent window when a scrolling operation starts. This notification code is sent in the form of /// a WM_NOTIFY message. /// /// /// LVN_BEGINSCROLL pnmLVScroll = (LPNMLVSCROLL) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLVSCROLL structure that contains the horizontal or vertical position of where the scroll operation starts. /// /// Returns /// Return value not used. /// /// /// Note /// /// To use this notification code, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on /// manifests, see Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-beginscroll LVN_BEGINSCROLL = LVN_FIRST - 80, /// /// /// Notifies a list-view control's parent window that a column header was clicked while the list-view control was in report mode. /// This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_COLUMNCLICK pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure. The iItem member is -1, and the iSubItem member identifies the /// column. All other members are zero. /// /// Returns /// No return value. /// /// /// Using header control formats such as HDF_CHECKBOX to modify the format of column headers in a list-view control causes the /// control to send the HDN_ITEMSTATEICONCLICK notification code instead of LVN_COLUMNCLICK when a header item is clicked. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-columnclick LVN_COLUMNCLICK = LVN_FIRST - 8, /// /// /// Sent by a list-view control when the list-view's drop-down button is pressed. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_COLUMNDROPDOWN pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLISTVIEW structure that describes the notification code. The caller is responsible for allocating this /// structure, including the contained NMHDR structure. Set the members of the NMHDR structure. The code /// member must be set to LVN_COLUMNDROPDOWN. /// /// /// Set the iItem member of the NMLISTVIEW structure to -1. Set the iSubItem member to the index of the /// subitem. Set the uNewState, uOldState, and lParam members to zero. The remaining members of the /// NMLISTVIEW structure are not used. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLISTVIEW structure. The wParam parameter contains the ID of /// the control that sends the notification code. /// /// /// If a header control is a child of the list-view, the header control should send this notidication code to the list-view /// control when the header control receives the HDN_DROPDOWN notification code. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-columndropdown LVN_COLUMNDROPDOWN = LVN_FIRST - 64, /// /// /// Sent by a list-view control when its overflow button is clicked. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_COLUMNOVERFLOWCLICK pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLISTVIEW structure that describes the notification code. The caller is responsible for allocating this /// structure, including the contained NMHDR structure. Set the members of the NMHDR structure. The code /// member must be set to LVN_COLUMNOVERFLOWCLICK. /// /// /// Set the iItem member of the NMLISTVIEW structure to -1. Set the iSubItem member to the index of the /// subitem. Set the uNewState, uOldState, and lParam members to zero. The remaining members of the /// NMLISTVIEW structure are not used. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLISTVIEW structure. The wParam parameter contains the ID of /// the control that sends the notification code. /// /// /// If a header control is a child of the listview, the header control should send this notification code to the listview control /// when the header control receives the HDN_OVERFLOWCLICK notification code. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-columnoverflowclick LVN_COLUMNOVERFLOWCLICK = LVN_FIRST - 66, /// /// /// Notifies a list-view control's parent window that all items in the control are about to be deleted. This notification code is /// sent in the form of a WM_NOTIFY message. /// /// /// LVN_DELETEALLITEMS pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// Pointer to an NMLISTVIEW structure. The iItem member is -1, and the other members are zero. /// Returns /// To suppress subsequent LVN_DELETEITEM notification codes, return TRUE. /// To receive subsequent LVN_DELETEITEM notification codes, return FALSE. /// /// /// /// A list-view control sends the LVM_DELETEALLITEMS notification code when it is destroyed or when it receives the /// LVM_DELETEALLITEMS message. If LVM_DELETEALLITEMS does not return TRUE, the control will also send an /// LVN_DELETEITEM notification code as each item is deleted. /// /// /// If the LVM_DELETEALLITEMS message handler is in a dialog box procedure, return TRUE from the dialog box /// procedure, and use the SetWindowLong function with DWL_MSGRESULT to set the message return value. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-deleteallitems LVN_DELETEALLITEMS = LVN_FIRST - 4, /// /// /// Notifies a list-view control's parent window that an item is about to be deleted. This notification code is sent in the form /// of a WM_NOTIFY message. /// /// /// LVN_DELETEITEM pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure. The iItem member identifies the item being deleted. If the control does not /// have the LVS_OWNERDATA style, then the lParam is the application-defined data associated with the item. All other /// members of this structure are zero. /// /// Returns /// No return value. /// /// Do not add, delete, or rearrange items in the list view while processing this notification code. // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-deleteitem LVN_DELETEITEM = LVN_FIRST - 3, /// /// /// Notifies a list-view control's parent window about the end of label editing for an item. This notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_ENDLABELEDIT pdi = (LPNMLVDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose /// iItem member identifies the item being edited. The pszText member of item contains a valid value when /// the LVN_ENDLABELEDIT notification code is sent, regardless of whether the LVIF_TEXT flag is set in the mask member of /// the LVITEM structure. If the user cancels editing, the pszText member of the LVITEM structure is /// NULL; otherwise, pszText is the address of the edited text. /// /// Returns /// /// If the pszText member of the LVITEM structure is non- NULL, return TRUE to set the item's label /// to the edited text. Return FALSE to reject the edited text and revert to the original label. /// /// If the pszText member of the LVITEM structure is NULL, the return value is ignored. /// /// /// /// The return value of the dialog procedure is whether the message was handled. The second return value must be set by calling /// SetwindowLongPtr with DWLP_MSGRESULT. /// /// /// When the user begins editing an item label, the parent window of the list-view control receives an LVN_BEGINLABELEDIT /// notification code. When the user cancels or completes the editing, the parent window receives an LVN_ENDLABELEDIT /// notification code. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-endlabeledit LVN_ENDLABELEDIT = LVN_ENDLABELEDITW, /// /// /// Notifies a list-view control's parent window about the end of label editing for an item. This notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_ENDLABELEDIT pdi = (LPNMLVDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose /// iItem member identifies the item being edited. The pszText member of item contains a valid value when /// the LVN_ENDLABELEDIT notification code is sent, regardless of whether the LVIF_TEXT flag is set in the mask member of /// the LVITEM structure. If the user cancels editing, the pszText member of the LVITEM structure is /// NULL; otherwise, pszText is the address of the edited text. /// /// Returns /// /// If the pszText member of the LVITEM structure is non- NULL, return TRUE to set the item's label /// to the edited text. Return FALSE to reject the edited text and revert to the original label. /// /// If the pszText member of the LVITEM structure is NULL, the return value is ignored. /// /// /// /// The return value of the dialog procedure is whether the message was handled. The second return value must be set by calling /// SetwindowLongPtr with DWLP_MSGRESULT. /// /// /// When the user begins editing an item label, the parent window of the list-view control receives an LVN_BEGINLABELEDIT /// notification code. When the user cancels or completes the editing, the parent window receives an LVN_ENDLABELEDIT /// notification code. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-endlabeledit LVN_ENDLABELEDITA = LVN_FIRST - 6, /// /// /// Notifies a list-view control's parent window about the end of label editing for an item. This notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_ENDLABELEDIT pdi = (LPNMLVDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose /// iItem member identifies the item being edited. The pszText member of item contains a valid value when /// the LVN_ENDLABELEDIT notification code is sent, regardless of whether the LVIF_TEXT flag is set in the mask member of /// the LVITEM structure. If the user cancels editing, the pszText member of the LVITEM structure is /// NULL; otherwise, pszText is the address of the edited text. /// /// Returns /// /// If the pszText member of the LVITEM structure is non- NULL, return TRUE to set the item's label /// to the edited text. Return FALSE to reject the edited text and revert to the original label. /// /// If the pszText member of the LVITEM structure is NULL, the return value is ignored. /// /// /// /// The return value of the dialog procedure is whether the message was handled. The second return value must be set by calling /// SetwindowLongPtr with DWLP_MSGRESULT. /// /// /// When the user begins editing an item label, the parent window of the list-view control receives an LVN_BEGINLABELEDIT /// notification code. When the user cancels or completes the editing, the parent window receives an LVN_ENDLABELEDIT /// notification code. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-endlabeledit LVN_ENDLABELEDITW = LVN_FIRST - 76, /// /// /// Notifies a list-view control's parent window when a scrolling operation ends. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_ENDSCROLL pnmLVScroll = (LPNMLVSCROLL) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLVSCROLL structure that contains the horizontal or vertical position of where the scroll operation ends. /// /// Returns /// Return value not used. /// /// /// Note /// /// To use this notification code, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on /// manifests, see Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-endscroll LVN_ENDSCROLL = LVN_FIRST - 81, /// /// /// Sent by a list-view control to its parent window. It is a request for the parent window to provide information needed to /// display or sort a list-view item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_GETDISPINFO pdi = (NMLVDISPINFO*) lParam /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. On input, the LVITEM structure contained in this structure specifies the /// type of information required and identifies the item or subitem of interest. Use the LVITEM structure to return the /// requested information to the control. If your message handler sets the LVIF_DI_SETITEM flag in the mask member of the /// LVITEM structure, the list-view control stores the requested information and will not ask for it again. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the /// notification code. /// /// /// A list-view control sends the LVN_GETDISPINFO notification code to retrieve item information that is stored by the /// application rather than the control. The information can be text or icon information for an item. It can also be item state /// information. See the LVM_SETCALLBACKMASK message for more information on implementing item state on a callback basis. /// /// For more information on list-view callbacks, see Callback Items and the Callback Mask. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getdispinfo LVN_GETDISPINFO = LVN_GETDISPINFOW, /// /// /// Sent by a list-view control to its parent window. It is a request for the parent window to provide information needed to /// display or sort a list-view item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_GETDISPINFO pdi = (NMLVDISPINFO*) lParam /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. On input, the LVITEM structure contained in this structure specifies the /// type of information required and identifies the item or subitem of interest. Use the LVITEM structure to return the /// requested information to the control. If your message handler sets the LVIF_DI_SETITEM flag in the mask member of the /// LVITEM structure, the list-view control stores the requested information and will not ask for it again. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the /// notification code. /// /// /// A list-view control sends the LVN_GETDISPINFO notification code to retrieve item information that is stored by the /// application rather than the control. The information can be text or icon information for an item. It can also be item state /// information. See the LVM_SETCALLBACKMASK message for more information on implementing item state on a callback basis. /// /// For more information on list-view callbacks, see Callback Items and the Callback Mask. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getdispinfo LVN_GETDISPINFOA = LVN_FIRST - 50, /// /// /// Sent by a list-view control to its parent window. It is a request for the parent window to provide information needed to /// display or sort a list-view item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_GETDISPINFO pdi = (NMLVDISPINFO*) lParam /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure. On input, the LVITEM structure contained in this structure specifies the /// type of information required and identifies the item or subitem of interest. Use the LVITEM structure to return the /// requested information to the control. If your message handler sets the LVIF_DI_SETITEM flag in the mask member of the /// LVITEM structure, the list-view control stores the requested information and will not ask for it again. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the /// notification code. /// /// /// A list-view control sends the LVN_GETDISPINFO notification code to retrieve item information that is stored by the /// application rather than the control. The information can be text or icon information for an item. It can also be item state /// information. See the LVM_SETCALLBACKMASK message for more information on implementing item state on a callback basis. /// /// For more information on list-view callbacks, see Callback Items and the Callback Mask. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getdispinfo LVN_GETDISPINFOW = LVN_FIRST - 77, /// /// /// Sent by list-view control to its parent window when the control has no items. The LVN_GETEMPTYMARKUP notification code is a /// request for the parent window to provide markup text. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_GETEMPTYMARKUP pnmMarkup = (NMLVEMPTYMARKUP*) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLVEMPTYMARKUP structure. Set the members of this structure to provide markup text for the list-view control. /// /// Returns /// Return TRUE to set the markup text in the list-view control, or FALSE otherwise. /// /// /// The notification receiver casts lParam to retrieve the NMLVEMPTYMARKUP structure. The wParam parameter contains the ID /// of the control that sends this message. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getemptymarkup LVN_GETEMPTYMARKUP = LVN_FIRST - 87, /// /// /// Sent by a large icon view list-view control that has the LVS_EX_INFOTIP extended style. This notification code is sent /// when the list-view control is requesting additional text information to be displayed in a tooltip. It is sent in the form of /// a WM_NOTIFY message. /// /// /// LVN_GETINFOTIP pGetInfoTip = (LPNMLVGETINFOTIP) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVGETINFOTIP structure that contains information about this notification code. /// Returns /// The return value for this notification is not used. /// /// /// This notification code is only sent by list-view controls that have the LVS_EX_INFOTIP extended style. The /// LVN_GETINFOTIP notification code is sent only for subitem 0. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getinfotip LVN_GETINFOTIP = LVN_GETINFOTIPW, /// /// /// Sent by a large icon view list-view control that has the LVS_EX_INFOTIP extended style. This notification code is sent /// when the list-view control is requesting additional text information to be displayed in a tooltip. It is sent in the form of /// a WM_NOTIFY message. /// /// /// LVN_GETINFOTIP pGetInfoTip = (LPNMLVGETINFOTIP) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVGETINFOTIP structure that contains information about this notification code. /// Returns /// The return value for this notification is not used. /// /// /// This notification code is only sent by list-view controls that have the LVS_EX_INFOTIP extended style. The /// LVN_GETINFOTIP notification code is sent only for subitem 0. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getinfotip LVN_GETINFOTIPA = LVN_FIRST - 57, /// /// /// Sent by a large icon view list-view control that has the LVS_EX_INFOTIP extended style. This notification code is sent /// when the list-view control is requesting additional text information to be displayed in a tooltip. It is sent in the form of /// a WM_NOTIFY message. /// /// /// LVN_GETINFOTIP pGetInfoTip = (LPNMLVGETINFOTIP) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVGETINFOTIP structure that contains information about this notification code. /// Returns /// The return value for this notification is not used. /// /// /// This notification code is only sent by list-view controls that have the LVS_EX_INFOTIP extended style. The /// LVN_GETINFOTIP notification code is sent only for subitem 0. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-getinfotip LVN_GETINFOTIPW = LVN_FIRST - 58, /// /// /// Sent by a list-view control when the user moves the mouse over an item. This notification code is only sent by list-view /// controls that have the LVS_EX_TRACKSELECT extended list-view style. It is sent in the form of a WM_NOTIFY message. /// /// /// LVN_HOTTRACK lpnmlv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure that contains information about this notification code. The iItem, /// iSubItem, and ptAction members of this structure contain information about the item. The receiving application /// can modify the iItem member to specify the item that will be selected. If iItem is set to -1, no item will be selected. /// /// Returns /// /// Return zero to allow the list view to perform its normal track select processing. If the application returns nonzero, the /// item will not be selected. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-hottrack LVN_HOTTRACK = LVN_FIRST - 21, /// /// /// Notifies a list-view control's parent window that an incremental search has started. This notification code is sent in the /// form of a WM_NOTIFY message. /// /// /// LVN_INCREMENTALSEARCH pnmv = (LPNMLVFINDITEM) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLVFINDITEM structure that describes the notification code. The caller is responsible for allocating /// this structure, including the contained NMHDR and LVFINDINFO structures. Set the members of the NMHDR /// structure. The code member must be set to LVN_INCREMENTALSEARCH. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLVFINDITEM structure. The wParam parameter contains the ID of /// the control that sends this notification code. /// /// /// This notification code gives an application (or the notification receiver) the opportunity to customize an incremental /// search. For example, if the search items are numeric, the application can perform a numerical search instead of a string search. /// /// /// The application sets the lParam member of the LVFINDINFO structure contained in NMLVFINDITEM structure /// to the result of the search, or to another application defined value to fail the search and indicate to the control how to proceed. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-incrementalsearch LVN_INCREMENTALSEARCH = LVN_INCREMENTALSEARCHW, /// /// /// Notifies a list-view control's parent window that an incremental search has started. This notification code is sent in the /// form of a WM_NOTIFY message. /// /// /// LVN_INCREMENTALSEARCH pnmv = (LPNMLVFINDITEM) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLVFINDITEM structure that describes the notification code. The caller is responsible for allocating /// this structure, including the contained NMHDR and LVFINDINFO structures. Set the members of the NMHDR /// structure. The code member must be set to LVN_INCREMENTALSEARCH. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLVFINDITEM structure. The wParam parameter contains the ID of /// the control that sends this notification code. /// /// /// This notification code gives an application (or the notification receiver) the opportunity to customize an incremental /// search. For example, if the search items are numeric, the application can perform a numerical search instead of a string search. /// /// /// The application sets the lParam member of the LVFINDINFO structure contained in NMLVFINDITEM structure /// to the result of the search, or to another application defined value to fail the search and indicate to the control how to proceed. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-incrementalsearch LVN_INCREMENTALSEARCHA = LVN_FIRST - 62, /// /// /// Notifies a list-view control's parent window that an incremental search has started. This notification code is sent in the /// form of a WM_NOTIFY message. /// /// /// LVN_INCREMENTALSEARCH pnmv = (LPNMLVFINDITEM) lParam; /// /// Parameters /// lParam /// /// Pointer to a NMLVFINDITEM structure that describes the notification code. The caller is responsible for allocating /// this structure, including the contained NMHDR and LVFINDINFO structures. Set the members of the NMHDR /// structure. The code member must be set to LVN_INCREMENTALSEARCH. /// /// Returns /// No return value. /// /// /// /// The notification receiver casts lParam to retrieve the NMLVFINDITEM structure. The wParam parameter contains the ID of /// the control that sends this notification code. /// /// /// This notification code gives an application (or the notification receiver) the opportunity to customize an incremental /// search. For example, if the search items are numeric, the application can perform a numerical search instead of a string search. /// /// /// The application sets the lParam member of the LVFINDINFO structure contained in NMLVFINDITEM structure /// to the result of the search, or to another application defined value to fail the search and indicate to the control how to proceed. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-incrementalsearch LVN_INCREMENTALSEARCHW = LVN_FIRST - 63, /// /// /// Notifies a list-view control's parent window that a new item was inserted. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_INSERTITEM pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure. The iItem member identifies the new item, and the other members are zero. /// /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-insertitem LVN_INSERTITEM = LVN_FIRST - 2, /// /// /// Sent by a list-view control when the user activates an item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_ITEMACTIVATE #if (_WIN32_IE >= 0x0400) lpnmia = (LPNMITEMACTIVATE)lParam; #else lpnm = (LPNMHDR)lParam; #endif /// /// Parameters /// lParam /// Version 4.71. Pointer to an NMITEMACTIVATE structure that contains information about this notification code. /// Version 4.70 and earlier. Pointer to an NMHDR structure that contains information about this notification code. /// Returns /// The application receiving this notification code must return zero. /// /// /// To obtain the items being activated, the receiving application should use the LVM_GETSELECTEDCOUNT message to retrieve /// the number of items that are selected and then send the LVM_GETNEXTITEM message with LVNI_SELECTED until all of /// the items have been retrieved. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-itemactivate LVN_ITEMACTIVATE = LVN_FIRST - 14, /// /// /// Notifies a list-view control's parent window that an item has changed. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_ITEMCHANGED pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLISTVIEW structure that identifies the item and specifies which of its attributes have changed. If the /// iItem member of the structure pointed to by lParam is -1, the change has been applied to all items in the list view. /// /// Returns /// No return value. /// /// /// If a list-view control has the LVS_OWNERDATA style, and the user selects a range of items by holding down the SHIFT /// key and clicking the mouse, LVN_ITEMCHANGED notification codes are not sent for each selected or deselected item. Instead, /// you will receive a single LVN_ODSTATECHANGED notification code, indicating that a range of items has changed state. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-itemchanged LVN_ITEMCHANGED = LVN_FIRST - 1, /// /// /// Notifies a list-view control's parent window that an item is changing. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_ITEMCHANGING pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// Pointer to an NMLISTVIEW structure that identifies the item and specifies which of its attributes are changing. /// Returns /// Returns TRUE to prevent the change, or FALSE to allow the change. /// /// If the list-view control has the LVS_OWNERDATA style, LVN_ITEMCHANGING notification codes are not sent. // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-itemchanging LVN_ITEMCHANGING = LVN_FIRST - 0, /// /// /// Notifies a list-view control's parent window that a key has been pressed. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_KEYDOWN pnkd = (LPNMLVKEYDOWN) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVKEYDOWN structure. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-keydown LVN_KEYDOWN = LVN_FIRST - 55, /// /// /// Notifies a list-view control's parent window that a link has been clicked on. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// LVN_LINKCLICK pLinkInfo = (NMLVLINK*) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMLVLINK structure. The identifier of the group containing the link is in the iSubItem member. /// /// Returns /// No return value. /// /// /// /// The following example shows how an application might respond to this notification code in its WM_NOTIFY message /// handler. The example toggles the collapsed state of the group and sets the appropriate link text. /// /// /// case LVN_LINKCLICK: { NMLVLINK* pLinkInfo = (NMLVLINK*)lParam; HWND hList = pLinkInfo->hdr.hwndFrom; LVGROUP groupInfo; groupInfo.cbSize = sizeof(groupInfo); groupInfo.mask = LVGF_TASK; int groupIndex = pLinkInfo->iSubItem; if (ListView_GetGroupState(hList, groupIndex, LVGS_COLLAPSED)) { ListView_SetGroupState(hList, groupIndex, LVGS_COLLAPSED, 0); groupInfo.pszTask = L"Hide"; } else { ListView_SetGroupState(hList, groupIndex, LVGS_COLLAPSED, LVGS_COLLAPSED); groupInfo.pszTask = L"Show"; } ListView_SetGroupInfo(hList, groupIndex, &groupInfo); break; } /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-linkclick LVN_LINKCLICK = LVN_FIRST - 84, /// /// /// Notifies a list-view control's parent window that a bounding box (marquee) selection has begun. This notification code is /// sent in the form of a WM_NOTIFY message. /// /// /// LVN_MARQUEEBEGIN pnmv = (LPNMLISTVIEW) lParam; /// /// Parameters /// lParam /// Pointer to an NMHDR structure. /// Returns /// To accept the notification code, return zero. To quit the bounding box selection, return nonzero. /// /// /// A bounding box selection is the process of clicking the list-view window's client area and dragging to select multiple items simultaneously. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-marqueebegin LVN_MARQUEEBEGIN = LVN_FIRST - 56, /// /// /// Sent by a virtual list-view control when the contents of its display area have changed. For example, a list-view control /// sends this notification code when the user scrolls the control's display. The LVN_ODCACHEHINT notification code is sent in /// the form of a WM_NOTIFY message. /// /// /// LVN_ODCACHEHINT pCachehint = (NMLVCACHEHINT *) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVCACHEHINT structure containing information about the range of items to be cached. /// Returns /// The application receiving this notification code must return zero. /// /// /// /// Handling this message allows the application to update the item information held in cache so that it is readily available /// when an LVN_GETDISPINFO notification code is sent. /// /// /// Note that this notification code is not always an exact representation of the items that will be requested by /// LVN_GETDISPINFO. Therefore, if the requested item is not cached while handling LVN_GETDISPINFO, the application must be /// prepared to supply the requested information from a source outside the cache. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-odcachehint LVN_ODCACHEHINT = LVN_FIRST - 13, /// /// /// Sent by a virtual list-view control when it needs the owner to find a particular callback item. For example, the control will /// send this notification code when it receives shortcut keyboard input or when it receives an LVM_FINDITEM message. The /// LVN_ODFINDITEM notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_ODFINDITEM pFindInfo = (PNMLVFINDITEM) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVFINDITEM structure that includes information to be used for the search. /// Returns /// Return the index of the item found, or -1 if no item is found. /// /// /// Search information is sent in the form of an LVFINDINFO structure, which is a member of the NMLVFINDITEM structure. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-odfinditem LVN_ODFINDITEM = LVN_ODFINDITEMW, /// /// /// Sent by a virtual list-view control when it needs the owner to find a particular callback item. For example, the control will /// send this notification code when it receives shortcut keyboard input or when it receives an LVM_FINDITEM message. The /// LVN_ODFINDITEM notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_ODFINDITEM pFindInfo = (PNMLVFINDITEM) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVFINDITEM structure that includes information to be used for the search. /// Returns /// Return the index of the item found, or -1 if no item is found. /// /// /// Search information is sent in the form of an LVFINDINFO structure, which is a member of the NMLVFINDITEM structure. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-odfinditem LVN_ODFINDITEMA = LVN_FIRST - 52, /// /// /// Sent by a virtual list-view control when it needs the owner to find a particular callback item. For example, the control will /// send this notification code when it receives shortcut keyboard input or when it receives an LVM_FINDITEM message. The /// LVN_ODFINDITEM notification code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_ODFINDITEM pFindInfo = (PNMLVFINDITEM) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVFINDITEM structure that includes information to be used for the search. /// Returns /// Return the index of the item found, or -1 if no item is found. /// /// /// Search information is sent in the form of an LVFINDINFO structure, which is a member of the NMLVFINDITEM structure. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-odfinditem LVN_ODFINDITEMW = LVN_FIRST - 79, /// /// /// Sent by a list-view control when the state of an item or range of items has changed. This notification code is sent in the /// form of a WM_NOTIFY message. /// /// /// LVN_ODSTATECHANGED lpStateChange = (LPNMLVODSTATECHANGE) lParam; /// /// Parameters /// lParam /// Pointer to an NMLVODSTATECHANGE structure that contains information about the item or items that have changed. /// Returns /// The application receiving this notification code must return zero. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-odstatechanged LVN_ODSTATECHANGED = LVN_FIRST - 15, /// /// /// Notifies a list-view control's parent window that it must update the information it maintains for an item. This notification /// code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_SETDISPINFO pdi = (NMLVDISPINFO*) lParam /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure that specifies information for the changed item. The item member of this /// structure is an LVITEM structure that contains information about the item that was changed. The pszText member /// of item contains a valid value, regardless of whether the LVIF_TEXT flag is set in the mask member of this structure. /// /// Returns /// No return value. /// /// /// The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the /// message code. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-setdispinfo LVN_SETDISPINFO = LVN_SETDISPINFOW, /// /// /// Notifies a list-view control's parent window that it must update the information it maintains for an item. This notification /// code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_SETDISPINFO pdi = (NMLVDISPINFO*) lParam /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure that specifies information for the changed item. The item member of this /// structure is an LVITEM structure that contains information about the item that was changed. The pszText member /// of item contains a valid value, regardless of whether the LVIF_TEXT flag is set in the mask member of this structure. /// /// Returns /// No return value. /// /// /// The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the /// message code. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-setdispinfo LVN_SETDISPINFOA = LVN_FIRST - 51, /// /// /// Notifies a list-view control's parent window that it must update the information it maintains for an item. This notification /// code is sent in the form of a WM_NOTIFY message. /// /// /// LVN_SETDISPINFO pdi = (NMLVDISPINFO*) lParam /// /// Parameters /// lParam /// /// Pointer to an NMLVDISPINFO structure that specifies information for the changed item. The item member of this /// structure is an LVITEM structure that contains information about the item that was changed. The pszText member /// of item contains a valid value, regardless of whether the LVIF_TEXT flag is set in the mask member of this structure. /// /// Returns /// No return value. /// /// /// The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the /// message code. /// // https://docs.microsoft.com/en-us/windows/win32/controls/lvn-setdispinfo LVN_SETDISPINFOW = LVN_FIRST - 78, } /// The following window styles are specific to list-view controls. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewStyle : uint { /// Items are left-aligned in icon and small icon view. LVS_ALIGNLEFT = 0x0800, /// The control's current alignment. LVS_ALIGNMASK = 0x0c00, /// Items are aligned with the top of the list-view control in icon and small icon view. LVS_ALIGNTOP = 0x0000, /// Icons are automatically kept arranged in icon and small icon view. LVS_AUTOARRANGE = 0x0100, /// Item text can be edited in place. The parent window must process the LVN_ENDLABELEDIT notification code. LVS_EDITLABELS = 0x0200, /// This style specifies icon view. LVS_ICON = 0x0000, /// This style specifies list view. LVS_LIST = 0x0003, /// Column headers are not displayed in report view. By default, columns have headers in report view. LVS_NOCOLUMNHEADER = 0x4000, /// Item text is displayed on a single line in icon view. By default, item text may wrap in icon view. LVS_NOLABELWRAP = 0x0080, /// /// Scrolling is disabled. All items must be within the client area. This style is not compatible with the LVS_LIST or /// LVS_REPORT styles. See Knowledge Base Article Q137520 for further discussion. /// LVS_NOSCROLL = 0x2000, /// /// Column headers do not work like buttons. This style can be used if clicking a column header in report view does not carry /// out an action, such as sorting. /// LVS_NOSORTHEADER = 0x8000, /// /// Version 4.70. This style specifies a virtual list-view control. For more information about this list control style, see /// About List-View Controls. /// LVS_OWNERDATA = 0x1000, /// /// The owner window can paint items in report view. The list-view control sends a WM_DRAWITEM message to paint each item; it /// does not send separate messages for each subitem. The iItemData member of the DRAWITEMSTRUCT structure contains the item /// data for the specified list-view item. /// LVS_OWNERDRAWFIXED = 0x0400, /// /// This style specifies report view. When using the LVS_REPORT style with a list-view control, the first column is always /// left-aligned. You cannot use LVCFMT_RIGHT to change this alignment. See LVCOLUMN for further information on column alignment. /// LVS_REPORT = 0x0001, /// /// The image list will not be deleted when the control is destroyed. This style enables the use of the same image lists with /// multiple list-view controls. /// LVS_SHAREIMAGELISTS = 0x0040, /// The selection, if any, is always shown, even if the control does not have the focus. LVS_SHOWSELALWAYS = 0x0008, /// Only one item at a time can be selected. By default, multiple items may be selected. LVS_SINGLESEL = 0x0004, /// This style specifies small icon view. LVS_SMALLICON = 0x0002, /// Item indexes are sorted based on item text in ascending order. LVS_SORTASCENDING = 0x0010, /// Item indexes are sorted based on item text in descending order. LVS_SORTDESCENDING = 0x0020, /// Determines the control's current window style. LVS_TYPEMASK = 0x0003, /// Determines the window styles that control item alignment and header appearance and behavior. LVS_TYPESTYLEMASK = 0xfc00, } /// /// Extended List-View Styles. Use the LVM_SETEXTENDEDLISTVIEWSTYLE message or one of the ListView_SetExtendedListViewStyle or /// ListView_SetExtendedListViewStyleEx macros to employ these extended list-view control styles. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewStyleEx : uint { /// Windows Vista and later. Automatically arrange icons if no icon positions have been set (Similar to LVS_AUTOARRANGE). LVS_EX_AUTOAUTOARRANGE = 0X01000000, /// Windows Vista and later. Automatically select check boxes on single click. LVS_EX_AUTOCHECKSELECT = 0X08000000, /// Windows Vista and later. Automatically size listview columns. LVS_EX_AUTOSIZECOLUMNS = 0X10000000, /// Version 4.71 and later. Changes border color when an item is selected, instead of highlighting the item. LVS_EX_BORDERSELECT = 0X00008000, /// /// Version 4.70. Enables check boxes for items in a list-view control. When set to this style, the control creates and sets a /// state image list with two images using DrawFrameControl. State image 1 is the unchecked box, and state image 2 is the /// checked box. Setting the state image to zero removes the check box. /// /// Version 6.00 and later Check boxes are visible and functional with all list view modes except the tile view mode introduced /// in ComCtl32.dll version 6. Clicking a checkbox in tile view mode only selects the item; the state does not change. /// /// /// You can obtain the state of the check box for a given item with ListView_GetCheckState. To set the check state, use /// ListView_SetCheckState. If this style is set, the list-view control automatically toggles the check state when the user /// clicks the check box or presses the space bar. /// /// LVS_EX_CHECKBOXES = 0X00000004, /// /// Indicates that an overflow button should be displayed in icon/tile view if there is not enough client width to display the /// complete set of header items. The list-view control sends the LVN_COLUMNOVERFLOWCLICK notification when the overflow button /// is clicked. This flag is only valid when LVS_EX_HEADERINALLVIEWS is also specified. /// LVS_EX_COLUMNOVERFLOW = 0X80000000, /// Windows Vista and later. Snap to minimum column width when the user resizes a column. LVS_EX_COLUMNSNAPPOINTS = 0X40000000, /// /// Version 6.00 and later. Paints via double-buffering, which reduces flicker. This extended style also enables alpha-blended /// marquee selection on systems where it is supported. /// LVS_EX_DOUBLEBUFFER = 0X00010000, /// /// Enables flat scroll bars in the list view. If you need more control over the appearance of the list view's scroll bars, you /// should manipulate the list view's scroll bars directly using the Flat Scroll Bar APIs. If the system metrics change, you are /// responsible for adjusting the scroll bar metrics with FlatSB_SetScrollProp. See Flat Scroll Bars for further details. /// LVS_EX_FLATSB = 0X00000100, /// /// When an item is selected, the item and all its subitems are highlighted. This style is available only in conjunction with /// the LVS_REPORT style. /// LVS_EX_FULLROWSELECT = 0X00000020, /// /// Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style. /// LVS_EX_GRIDLINES = 0X00000001, /// /// Enables drag-and-drop reordering of columns in a list-view control. This style is only available to list-view controls that /// use the LVS_REPORT style. /// LVS_EX_HEADERDRAGDROP = 0X00000010, /// Windows Vista and later. Show column headers in all view modes. LVS_EX_HEADERINALLVIEWS = 0X02000000, /// Version 6.00 and later. Hides the labels in icon and small icon view. LVS_EX_HIDELABELS = 0X00020000, /// /// When a list-view control uses the LVS_EX_INFOTIP style, the LVN_GETINFOTIP notification code is sent to the parent window /// before displaying an item's tooltip. /// LVS_EX_INFOTIP = 0X00000400, /// Windows Vista and later. Icons are lined up in columns that use up the whole view. LVS_EX_JUSTIFYCOLUMNS = 0X00200000, /// /// If a partially hidden label in any list view mode lacks tooltip text, the list-view control will unfold the label. If this /// style is not set, the list-view control will unfold partly hidden labels only for the large icon mode. /// LVS_EX_LABELTIP = 0X00004000, /// /// If the list-view control has the LVS_AUTOARRANGE style, the control will not autoarrange its icons until one or more work /// areas are defined (see LVM_SETWORKAREAS). To be effective, this style must be set before any work areas are defined and any /// items have been added to the control. /// LVS_EX_MULTIWORKAREAS = 0X00002000, /// /// The list-view control sends an LVN_ITEMACTIVATE notification code to the parent window when the user clicks an item. This /// style also enables hot tracking in the list-view control. Hot tracking means that when the cursor moves over an item, it is /// highlighted but not selected. See the Extended List-View Styles Remarks section for a discussion of item activation. /// LVS_EX_ONECLICKACTIVATE = 0X00000040, /// /// Version 4.71 through Version 5.80 only. Not supported on Windows Vista and later. Sets the list view window region to /// include only the item icons and text using SetWindowRgn. Any area that is not part of an item is excluded from the window /// region. This style is only available to list-view controls that use the LVS_ICON style. /// LVS_EX_REGIONAL = 0X00000200, /// /// Version 6.00 and later. In icon view, moves the state image of the control to the top right of the large icon rendering. In /// views other than icon view there is no change. When the user changes the state by using the space bar, all selected items /// cycle over, not the item with the focus. /// LVS_EX_SIMPLESELECT = 0X00100000, /// Version 6.00 and later. Not used. LVS_EX_SINGLEROW = 0X00040000, /// Version 6.00 and later. In icon view, icons automatically snap into a grid. LVS_EX_SNAPTOGRID = 0X00080000, /// /// Allows images to be displayed for subitems. This style is available only in conjunction with the LVS_REPORT style. /// LVS_EX_SUBITEMIMAGES = 0X00000002, /// /// Enables hot-track selection in a list-view control. Hot track selection means that an item is automatically selected when /// the cursor remains over the item for a certain period of time. The delay can be changed from the default system setting with /// a LVM_SETHOVERTIME message. This style applies to all styles of list-view control. You can check whether hot-track selection /// is enabled by calling SystemParametersInfo. /// LVS_EX_TRACKSELECT = 0X00000008, /// Windows Vista and later. Background is painted by the parent via WM_PRINTCLIENT. LVS_EX_TRANSPARENTBKGND = 0X00400000, /// Windows Vista and later. Enable shadow text on transparent backgrounds only. LVS_EX_TRANSPARENTSHADOWTEXT = 0X00800000, /// /// The list-view control sends an LVN_ITEMACTIVATE notification code to the parent window when the user double-clicks an item. /// This style also enables hot tracking in the list-view control. Hot tracking means that when the cursor moves over an item, /// it is highlighted but not selected. See the Extended List-View Styles Remarks section for a discussion of item activation. /// LVS_EX_TWOCLICKACTIVATE = 0X00000080, /// /// Causes those non-hot items that may be activated to be displayed with underlined text. This style requires that /// LVS_EX_TWOCLICKACTIVATE be set also. See the Extended List-View Styles Remarks section for a discussion of item activation. /// LVS_EX_UNDERLINECOLD = 0X00001000, /// /// Causes those hot items that may be activated to be displayed with underlined text. This style requires that /// LVS_EX_ONECLICKACTIVATE or LVS_EX_TWOCLICKACTIVATE also be set. See the Extended List-View Styles Remarks section for a /// discussion of item activation. /// LVS_EX_UNDERLINEHOT = 0X00000800, } /// Flags that determines how the tiles are sized in tile view. [PInvokeData("Commctrl.h", MSDNShortId = "bb774768")] [Flags] public enum ListViewTileViewFlag : uint { /// Size the tiles automatically. LVTVIF_AUTOSIZE = 0x00000000, /// Apply a fixed width to the tiles. LVTVIF_FIXEDWIDTH = 0x00000001, /// Apply a fixed height to the tiles. LVTVIF_FIXEDHEIGHT = 0x00000002, /// Apply a fixed height and width to the tiles. LVTVIF_FIXEDSIZE = 0x00000003, /// This flag is not supported and should not be used. LVTVIF_EXTENDED = 0x00000004, } /// Mask that determines which members of the LVTILEVIEWINFO structure are valid. [PInvokeData("Commctrl.h", MSDNShortId = "bb774768")] [Flags] public enum ListViewTileViewMask : uint { /// sizeTile is valid. LVTVIM_TILESIZE = 0x00000001, /// cLines is valid. LVTVIM_COLUMNS = 0x00000002, /// rcLabelMargin is valid. LVTVIM_LABELMARGIN = 0x00000004, } /// /// /// Gets the bounding rectangle for all or part of a subitem in the current view of a specified list-view control. Use this macro or /// send the LVM_GETITEMINDEXRECT message explicitly. /// /// /// /// Type: HWND /// A handle to the list-view control. /// /// /// Type: LVITEMINDEX* /// /// A pointer to a LVITEMINDEX structure for the parent item of the subitem. The caller is responsible for allocating this structure /// and setting its members. plvii must not be NULL. /// /// /// /// Type: LONG /// The index of the subitem. /// /// /// Type: LONG /// /// The portion of the list-view subitem for which to retrieve the bounding rectangle. This parameter must be one of the following values. /// /// /// /// Value /// Meaning /// /// /// LVIR_BOUNDS /// Returns the bounding rectangle of the entire subitem, including the icon and label. /// /// /// LVIR_ICON /// Returns the bounding rectangle of the icon or small icon of the subitem. /// /// /// LVIR_LABEL /// Returns the bounding rectangle of the subitem text. /// /// /// /// /// A Rectangle structure to receive the coordinates. /// /// Returns TRUE if successful, or FALSE otherwise. /// /// /// If iSubItem is zero, this macro returns the coordinates of the rectangle to the item pointed to by plvii. The value /// LVIR_SELECTBOUNDS for the parameter code is not supported. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/commctrl/nf-commctrl-listview_getitemindexrect [PInvokeData("commctrl.h", MSDNShortId = "listview_getitemindexrect")] public static bool ListView_GetItemIndexRect(HWND hwnd, in LVITEMINDEX plvii, int iSubItem, ListViewItemRect code, out RECT prc) { var rc = new RECT((int)code, iSubItem, 0, 0); var lr = SendMessage(hwnd, ListViewMessage.LVM_GETITEMINDEXRECT, in plvii, ref rc); prc = lr == IntPtr.Zero ? RECT.Empty : rc; return lr != IntPtr.Zero; } /// /// Gets the index of the item in a particular list-view control that has the specified properties and relationship to another /// specific item. Use this macro or send the LVM_GETNEXTITEMINDEX message explicitly. /// /// /// Type: HWND /// A handle to the list-view control. /// /// /// Type: LVITEMINDEX* /// /// A pointer to the LVITEMINDEX structure with which the item begins the search, or -1 to find the first item that matches /// the specified flags. The calling process is responsible for allocating this structure and setting its members. /// /// /// /// Type: LPARAM /// The relationship to the item specified in parameter plvii. This can be one or a combination of the following values: /// /// /// /// Value /// Meaning /// /// /// Searches by index. /// /// /// /// LVNI_ALL /// Searches for a subsequent item by index, the default value. /// /// /// Searches by physical relationship to the index of the item where the search is to begin. /// /// /// /// LVNI_ABOVE /// Searches for an item that is above the specified item. /// /// /// LVNI_BELOW /// Searches for an item that is below the specified item. /// /// /// LVNI_TOLEFT /// Searches for an item to the left of the specified item. /// /// /// LVNI_PREVIOUS /// /// Windows Vista and later: Searches for the item that is previous to the specified item. The LVNI_PREVIOUS flag is not directional /// (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item ordered before.) The LVNI_PREVIOUS flag /// essentially reverses the logic of the search performed via the LVM_GETNEXTITEM or LVM_GETNEXTITEMINDEX messages. /// /// /// /// LVNI_TORIGHT /// Searches for an item to the right of the specified item. /// /// /// LVNI_DIRECTIONMASK /// Windows Vista and later: A directional flag mask with value as follows: LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT. /// /// /// The state of the item to find can be specified with one or a combination of the following values: /// /// /// /// LVNI_CUT /// The item has the LVIS_CUT state flag set. /// /// /// LVNI_DROPHILITED /// The item has the LVIS_DROPHILITED state flag set /// /// /// LVNI_FOCUSED /// The item has the LVIS_FOCUSED state flag set. /// /// /// LVNI_SELECTED /// The item has the LVIS_SELECTED state flag set. /// /// /// LVNI_STATEMASK /// Windows Vista and later: A state flag mask with value as follows: LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED. /// /// /// Searches by appearance of items or by group. /// /// /// /// LVNI_VISIBLEORDER /// Windows Vista and later: Search the visible order. /// /// /// LVNI_VISIBLEONLY /// Windows Vista and later: Search the visible items. /// /// /// LVNI_SAMEGROUPONLY /// Windows Vista and later: Search the current group. /// /// /// If an item does not have all of the specified state flags set, the search continues with the next item. /// /// /// /// /// /// Returns TRUE if successful, or FALSE otherwise. // BOOL ListView_GetNextItemIndex( [in] HWND hwnd, [in, out] LVITEMINDEX *plvii, LPARAM flags); https://msdn.microsoft.com/en-us/library/windows/desktop/bb774986(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb774986")] public static bool ListView_GetNextItemIndex(HWND hwnd, in LVITEMINDEX plvii, ListViewNextItemFlag flags) => SendMessage(hwnd, (uint)ListViewMessage.LVM_GETNEXTITEMINDEX, (IntPtr)SafeCoTaskMemHandle.CreateFromStructure(plvii), (IntPtr)(int)flags) != IntPtr.Zero; /// /// Sets the state of a specified list-view item. Use this macro or send the LVM_SETITEMINDEXSTATE message explicitly. /// /// /// Type: HWND /// A handle to the list-view control. /// /// /// Type: LVITEMINDEX* /// /// A pointer to an LVITEMINDEX structure for the item. The caller is responsible for allocating this structure and setting the members. /// /// /// /// Type: UINT /// The state to set on the item as one or more (as a bitwise combination) of the List-View Item States flags. /// /// /// Type: UINT /// /// The valid bits of the state specified by parameter data. For more information, see the stateMask member of the LVITEM) structure. /// /// /// /// None /// // https://docs.microsoft.com/en-us/windows/desktop/api/commctrl/nf-commctrl-listview_setitemindexstate void // ListView_SetItemIndexState( hwndLV, plvii, data, mask ); [PInvokeData("commctrl.h", MSDNShortId = "listview_setitemindexstate")] public static HRESULT ListView_SetItemIndexState(HWND hwndLV, in LVITEMINDEX plvii, uint data, ListViewItemState mask) { var lvi = new LVITEM(0) { stateMask = mask, state = data }; using var plvi = new PinnedObject(lvi); return new HRESULT(SendMessage(hwndLV, (uint)ListViewMessage.LVM_SETITEMINDEXSTATE, in plvii, plvi).ToInt32()); } /// /// Contains information used when searching for a list-view item. This structure is identical to LV_FINDINFO but has been renamed /// to fit standard naming conventions. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774745")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct LVFINDINFO { /// Type of search to perform. public ListViewFindInfoFlag flags; /// /// Address of a null-terminated string to compare with the item text. It is valid only if LVFI_STRING or LVFI_PARTIAL is set in /// the flags member. /// public string psz; /// /// Value to compare with the lParam member of a list-view item's LVITEM structure. It is valid only if LVFI_PARAM is set in the /// flags member. /// public IntPtr lParam; /// POINT structure with the initial search position. It is valid only if LVFI_NEARESTXY is set in the flags member. public POINT pt; /// Virtual key code that specifies the direction to search. public ConsoleKey vkDirection; /// Initializes a new instance of the struct. /// The search string. /// if set to true if is the beginning of an item's text. /// if set to true continues the search at the beginning if no match is found. public LVFINDINFO(string searchString, bool allowPartial, bool wrap) : this() { psz = searchString; flags = ListViewFindInfoFlag.LVFI_STRING; if (allowPartial) flags |= ListViewFindInfoFlag.LVFI_PARTIAL; if (wrap) flags |= ListViewFindInfoFlag.LVFI_WRAP; } /// Initializes a new instance of the struct. /// The value to compare to the lParam member of a list-view item. public LVFINDINFO(IntPtr lParam) : this() { flags = ListViewFindInfoFlag.LVFI_PARAM; this.lParam = lParam; } /// Initializes a new instance of the struct. /// The initial search position. /// The search direction. public LVFINDINFO(POINT point, ConsoleKey searchDirection) : this() { flags = ListViewFindInfoFlag.LVFI_NEARESTXY; pt = point; vkDirection = searchDirection; } } /// Contains information about the display of groups in a list-view control. [PInvokeData("Commctrl.h", MSDNShortId = "bb774752")] [StructLayout(LayoutKind.Sequential)] public struct LVGROUPMETRICS { /// Size of the LVGROUPMETRICS structure. public uint cbSize; /// Flags that specify which members contain or are to receive valid data. public ListViewGroupMetricsMask mask; /// Specifies the width of the left border in icon, small icon, or tile view. public int Left; /// Specifies the width of the top border in all group views. public int Top; /// Specifies the width of the right border in icon, small icon, or tile view. public int Right; /// Specifies the width of the bottom border in all group views. public int Bottom; /// Specifies the color of the left border. Not implemented. public uint crLeft; /// Specifies the color of the top border. Not implemented. public uint crTop; /// Specifies the color of the right border. Not implemented. public uint crRight; /// Specifies the color of the bottom border. Not implemented. public uint crBottom; /// Specifies the color of the header text. Not implemented. public uint crHeader; /// Specifies the color of the footer text. Not implemented. public uint crFooter; /// Initializes a new instance of the class. /// The mask. public LVGROUPMETRICS(ListViewGroupMetricsMask mask = ListViewGroupMetricsMask.LVGMF_NONE) : this() { cbSize = (uint)Marshal.SizeOf(typeof(LVGROUPMETRICS)); this.mask = mask; } /// Initializes a new instance of the class. /// The width of the left border. /// The width of the top border. /// The width of the right border. /// The width of the bottom border. public LVGROUPMETRICS(int left, int top, int right, int bottom) : this() { cbSize = (uint)Marshal.SizeOf(typeof(LVGROUPMETRICS)); SetBorderSize(left, top, right, bottom); } /// Sets the size of the border. /// The left. /// The top. /// The right. /// The bottom. public void SetBorderSize(int left, int top, int right, int bottom) { mask = ListViewGroupMetricsMask.LVGMF_BORDERSIZE; Left = left; Top = top; Right = right; Bottom = bottom; } } /// /// Contains information about a hit test. This structure has been extended to accommodate subitem hit-testing. It is used in /// association with the LVM_HITTEST and LVM_SUBITEMHITTEST messages and their related macros. This structure supersedes the /// LVHITTESTINFO structure. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774754")] [StructLayout(LayoutKind.Sequential)] public struct LVHITTESTINFO { /// The position to hit test, in client coordinates. public POINT pt; /// /// The variable that receives information about the results of a hit test. This member can be one or more of the following values: /// /// You can use LVHT_ABOVE, LVHT_BELOW, LVHT_TOLEFT, and LVHT_TORIGHT to determine whether to scroll the contents of a list-view /// control.Two of these values may be combined. For example, if the position is above and to the left of the client area, you /// could use both LVHT_ABOVE and LVHT_TOLEFT. /// /// /// You can test for LVHT_ONITEM to determine whether a specified position is over a list-view item. This value is a bitwise-OR /// operation on LVHT_ONITEMICON, LVHT_ONITEMLABEL, and LVHT_ONITEMSTATEICON. /// /// public ListViewHitTestFlag flags; /// /// Receives the index of the matching item. Or if hit-testing a subitem, this value represents the subitem's parent item. /// public int iItem; /// Version 4.70. Receives the index of the matching subitem. When hit-testing an item, this member will be zero. public int iSubItem; /// /// Windows Vista. Group index of the item hit (read only). Valid only for owner data. If the point is within an item that is /// displayed in multiple groups then iGroup will specify the group index of the item. /// public int iGroup; /// Initializes a new instance of the class. /// The pt. public LVHITTESTINFO(POINT pt) : this() => this.pt = pt; } /// Used to describe insertion points. [PInvokeData("Commctrl.h", MSDNShortId = "bb774758")] [StructLayout(LayoutKind.Sequential)] public struct LVINSERTMARK { /// Size of the LVINSERTMARK structure. public uint cbSize; /// Flag that specifies where the insertion point should appear. public ListViewInsertMarkFlag dwFlags; /// Item next to which the insertion point appears. If this member contains -1, there is no insertion point. public int iItem; /// Reserved. Must be zero. public uint dwReserved; /// Initializes a new instance of the struct. /// Index at which to insert the item. /// if set to true the insertion point appears after the item specified. public LVINSERTMARK(int insertAtItem, bool insertAfter = false) : this() { cbSize = (uint)Marshal.SizeOf(typeof(LVINSERTMARK)); dwFlags = insertAfter ? ListViewInsertMarkFlag.LVIM_AFTER : ListViewInsertMarkFlag.LVIM_BEFORE; iItem = insertAtItem; } } /// Helper structure for to easily capture column order and format information. [PInvokeData("Commctrl.h", MSDNShortId = "bb774760")] [StructLayout(LayoutKind.Sequential)] public struct LVITEMCOLUMNINFO { /// The column index public uint columnIndex; /// /// Windows Vista: Not implemented. Windows 7 and later: A flag specifying the format of this column in extended tile view. /// public ListViewColumnFormat format; /// Initializes a new instance of the struct. /// Index of the column. /// The format of the column. public LVITEMCOLUMNINFO(uint colIdx, ListViewColumnFormat fmt = 0) { columnIndex = colIdx; format = fmt; } } /// Contains index information about a list-view item. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [StructLayout(LayoutKind.Sequential)] public struct LVITEMINDEX { /// The index of the item. public int iItem; /// The index of the group the item belongs to. public int iGroup; } /// Provides information about a list-view control when it is displayed in tile view. [PInvokeData("Commctrl.h", MSDNShortId = "bb774768")] [StructLayout(LayoutKind.Sequential)] public struct LVTILEVIEWINFO { /// Size of the LVTILEVIEWINFO structure. public uint cbSize; /// Mask that determines which members are valid. This member may be one of the following values. public ListViewTileViewMask dwMask; /// Flags that determines how the tiles are sized in tile view. This member may be one of the following values. public ListViewTileViewFlag dwFlags; /// Size of an individual tile. Values for dimensions not specified as fixed in dwFlags are ignored. public SIZE sizeTile; /// Maximum number of text lines in each item label, not counting the title. public int cLines; /// RECT that contains coordinates of the label margin. public RECT rcLabelMargin; /// Initializes a new instance of the struct. /// The mask. public LVTILEVIEWINFO(ListViewTileViewMask mask) : this() { cbSize = (uint)Marshal.SizeOf(typeof(LVTILEVIEWINFO)); dwMask = mask; } /// Gets or sets a value indicating whether to size the tiles automatically. /// true if tiles are automatically sized; otherwise, false. public bool AutoSize { get => dwFlags.IsFlagSet(ListViewTileViewFlag.LVTVIF_AUTOSIZE); set { dwFlags = ListViewTileViewFlag.LVTVIF_AUTOSIZE; dwMask |= ListViewTileViewMask.LVTVIM_TILESIZE; sizeTile.cy = sizeTile.cx = 0; } } /// Gets or sets the size of an individual tile. /// The size of an individual tile. public SIZE TileSize { get => sizeTile; set { sizeTile = value; dwMask |= ListViewTileViewMask.LVTVIM_TILESIZE; dwFlags |= ListViewTileViewFlag.LVTVIF_FIXEDSIZE; } } /// Gets or sets the height of an individual tile. /// The height of an individual tile. public int TileHeight { get => sizeTile.cy; set { sizeTile.cy = value; dwMask |= ListViewTileViewMask.LVTVIM_TILESIZE; dwFlags |= ListViewTileViewFlag.LVTVIF_FIXEDHEIGHT; } } /// Gets or sets the width of an individual tile. /// The width of an individual tile. public int TileWidth { get => sizeTile.cx; set { sizeTile.cx = value; dwMask |= ListViewTileViewMask.LVTVIM_TILESIZE; dwFlags |= ListViewTileViewFlag.LVTVIF_FIXEDWIDTH; } } /// Gets or sets the maximum number of text lines in each item label, not counting the title. /// The maximum number of text lines in each item label, not counting the title. public int MaxTextLines { get => cLines; set { cLines = value; dwMask |= ListViewTileViewMask.LVTVIM_COLUMNS; } } /// Gets or sets the tile padding. /// The tile padding. public RECT TilePadding { get => rcLabelMargin; set { rcLabelMargin = value; dwMask |= ListViewTileViewMask.LVTVIM_LABELMARGIN; } } } /// /// Contains information about a list-view notification message. This structure is the same as the NM_LISTVIEW structure but has /// been renamed to fit standard naming conventions. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774773")] [StructLayout(LayoutKind.Sequential)] public struct NMLISTVIEW { /// NMHDR structure that contains information about this notification message public NMHDR hdr; /// Identifies the list-view item, or -1 if not used. public int iItem; /// Identifies the subitem, or zero if none. public int iSubItem; /// /// New item state. This member is zero for notification messages that do not use it. For a list of possible values, see /// List-View Item States. /// public ListViewItemState uNewState; /// /// Old item state. This member is zero for notification messages that do not use it. For a list of possible values, see /// List-View Item States. /// public ListViewItemState uOldState; /// /// Set of flags that indicate the item attributes that have changed. This member is zero for notifications that do not use it. /// Otherwise, it can have the same values as the mask member of the LVITEM structure. /// public ListViewItemMask uChanged; /// /// POINT structure that indicates the location at which the event occurred. This member is undefined for notification messages /// that do not use it. /// public POINT ptAction; /// Application-defined value of the item. This member is undefined for notification messages that do not use it. public IntPtr lParam; } /// /// Contains information about the background image of a list-view control. This structure is used for both setting and retrieving /// background image information. /// /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774742")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public sealed class LVBKIMAGE : IDisposable { /// /// This member may be one or more of the following flags. You can use the LVBKIF_SOURCE_MASK value to mask off all but the /// source flags. You can use the LVBKIF_STYLE_MASK value to mask off all but the style flags. /// public ListViewBkImageFlag ulFlags; /// The handle of the background bitmap. This member is valid only if the LVBKIF_SOURCE_HBITMAP flag is set in ulFlags. public HBITMAP hBmp = IntPtr.Zero; /// /// Address of a NULL-terminated string that contains the URL of the background image. This member is valid only if the /// LVBKIF_SOURCE_URL flag is set in ulFlags. This member must be initialized to point to the buffer that contains or receives /// the text before sending the message. /// public StrPtrAuto pszImage; /// Size of the buffer at the address in pszImage. If information is being sent to the control, this member is ignored. public uint cchImageMax; /// /// Percentage of the control's client area that the image should be offset horizontally. For example, at 0 percent, the image /// will be displayed against the left edge of the control's client area. At 50 percent, the image will be displayed /// horizontally centered in the control's client area. At 100 percent, the image will be displayed against the right edge of /// the control's client area. This member is valid only when LVBKIF_STYLE_NORMAL is specified in ulFlags. If both /// LVBKIF_FLAG_TILEOFFSET and LVBKIF_STYLE_TILE are specified in ulFlags, then the value specifies the pixel, not percentage /// offset, of the first tile. Otherwise, the value is ignored. /// public int xOffset; /// /// Percentage of the control's client area that the image should be offset vertically. For example, at 0 percent, the image /// will be displayed against the top edge of the control's client area. At 50 percent, the image will be displayed vertically /// centered in the control's client area. At 100 percent, the image will be displayed against the bottom edge of the control's /// client area. This member is valid only when LVBKIF_STYLE_NORMAL is specified in ulFlags. If both LVBKIF_FLAG_TILEOFFSET and /// LVBKIF_STYLE_TILE are specified in ulFlags, then the value specifies the pixel, not percentage offset, of the first tile. /// Otherwise, the value is ignored. /// public int yOffset; /// Initializes a new instance of the class. /// The handle of the background bitmap. /// if set to true a watermark bitmap is applied. /// if set to true the watermark is alpha blended. public LVBKIMAGE(HBITMAP bmp, bool isWatermark, bool isWatermarkAlphaBlended) { hBmp = bmp; ulFlags = isWatermark ? ListViewBkImageFlag.LVBKIF_TYPE_WATERMARK : ListViewBkImageFlag.LVBKIF_SOURCE_HBITMAP; if (isWatermark && isWatermarkAlphaBlended) ulFlags |= ListViewBkImageFlag.LVBKIF_FLAG_ALPHABLEND; } /// Initializes a new instance of the class. /// The handle of the background bitmap. /// if set to true, the bitmap image is tiled. public LVBKIMAGE(HBITMAP bmp, bool isTiled) { hBmp = bmp; ulFlags = ListViewBkImageFlag.LVBKIF_SOURCE_HBITMAP; if (isTiled) ulFlags |= ListViewBkImageFlag.LVBKIF_STYLE_TILE; } /// Initializes a new instance of the class. /// The URL of the background image. /// if set to true, the bitmap image is tiled. public LVBKIMAGE(string url, bool isTiled) { Url = url; ulFlags = ListViewBkImageFlag.LVBKIF_SOURCE_URL; if (isTiled) ulFlags |= ListViewBkImageFlag.LVBKIF_STYLE_TILE; } /// Initializes a new instance of the class. public LVBKIMAGE() : this(ListViewBkImageFlag.LVBKIF_SOURCE_NONE) { } /// Initializes a new instance of the class. /// The flags. public LVBKIMAGE(ListViewBkImageFlag flags) { ulFlags = flags; if (ulFlags.IsFlagSet(ListViewBkImageFlag.LVBKIF_SOURCE_URL)) pszImage = new StrPtrAuto(cchImageMax = 1024); } /// Gets or sets the URL. /// The URL. public string Url { get => pszImage.ToString(); set => EnumExtensions.SetFlags(ref ulFlags, ListViewBkImageFlag.LVBKIF_SOURCE_URL, pszImage.Assign(value, out cchImageMax)); } /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. void IDisposable.Dispose() => pszImage.Free(); } /// /// Contains information about a column in report view. This structure is used both for creating and manipulating columns. This /// structure supersedes the LV_COLUMN structure. /// /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774743")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public sealed class LVCOLUMN : IDisposable { /// /// Variable specifying which members contain valid information. This member can be zero, or one or more of the following values: /// public ListViewColumMask mask; /// /// Alignment of the column header and the subitem text in the column. The alignment of the leftmost column is always /// LVCFMT_LEFT; it cannot be changed. This member can be a combination of the following values. Note that not all combinations /// are valid. /// public ListViewColumnFormat fmt; /// Width of the column, in pixels. public int cx; /// /// If column information is being set, this member is the address of a null-terminated string that contains the column header /// text. If the structure is receiving information about a column, this member specifies the address of the buffer that /// receives the column header text. /// public StrPtrAuto pszText; /// /// Size in TCHARs of the buffer pointed to by the pszText member. If the structure is not receiving information about a column, /// this member is ignored. /// public uint cchTextMax; /// Index of subitem associated with the column. public int iSubItem; /// /// Version 4.70. Zero-based index of an image within the image list. The specified image will appear within the column. /// public int iImage; /// /// Version 4.70. Zero-based column offset. Column offset is in left-to-right order. For example, zero indicates the leftmost column. /// public int iOrder; /// Windows Vista. Minimum width of the column in pixels. public int cxMin; /// /// Windows Vista. Application-defined value typically used to store the default width of the column. This member is ignored by /// the list-view control. /// public int cxDefault; /// /// Windows Vista. Read-only. The ideal width of the column in pixels, as the column may currently be autosized to a lesser width. /// public int cxIdeal; /// Initializes a new instance of the class. /// The mask. public LVCOLUMN(ListViewColumMask mask) { this.mask = mask; if (mask.IsFlagSet(ListViewColumMask.LVCF_TEXT)) pszText = new StrPtrAuto(cchTextMax = 1024); } /// Gets or sets the format. /// The format. public ListViewColumnFormat Format { get => fmt; set { fmt = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_FMT); } } /// Gets or sets the header text. /// /// The header text. Setting this value will free any previous buffer and will allocate a new buffer sufficient to hold the string. /// public string Text { get => pszText.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_TEXT, pszText.Assign(value, out cchTextMax)); } /// Gets or sets the index of subitem associated with the column. /// The index of subitem. public int Subitem { get => iSubItem; set { iSubItem = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_SUBITEM); } } /// Gets or sets the zero-based index of an image within the image list. /// The index of and image in the image list. public int ImageListIndex { get => iImage; set { iImage = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_IMAGE); } } /// Gets or sets the column position. /// The column position. public int ColumnPosition { get => iOrder; set { iOrder = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_ORDER); } } /// Gets or sets the default width. /// The default width. public int DefaultWidth { get => cxDefault; set { cxDefault = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_DEFAULTWIDTH); } } /// Gets or sets the minimum width. /// The minimum width. public int MinWidth { get => cxMin; set { cxMin = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_MINWIDTH); } } /// Gets or sets the ideal width. /// The ideal width. public int IdealWidth { get => cxIdeal; set { cxIdeal = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_IDEALWIDTH); } } /// Gets or sets the width. /// The width. public int Width { get => cx; set { cx = value; EnumExtensions.SetFlags(ref mask, ListViewColumMask.LVCF_WIDTH); } } /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. void IDisposable.Dispose() => pszText.Free(); } /// Used to set and retrieve groups. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774769")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public sealed class LVGROUP : IDisposable { /// Size of this structure, in bytes. public int cbSize = Marshal.SizeOf(typeof(LVGROUP)); /// Mask that specifies which members of the structure are valid input. public ListViewGroupMask mask; /// /// Pointer to a null-terminated string that contains the header text when item information is being set. If group information /// is being retrieved, this member specifies the address of the buffer that receives the header text. /// public StrPtrAuto pszHeader; /// /// Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a /// group, this member is ignored. /// public uint cchHeader; /// /// Pointer to a null-terminated string that contains the footer text when item information is being set. If group information /// is being retrieved, this member specifies the address of the buffer that receives the footer text. /// public StrPtrAuto pszFooter; /// /// Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a /// group, this member is ignored. /// public uint cchFooter; /// ID of the group. public int iGroupId; /// /// Mask used with LVM_GETGROUPINFO and LVM_SETGROUPINFO to specify which flags in the state value are being retrieved or set. /// public ListViewGroupState stateMask; /// Flag that can have one of the following values: public ListViewGroupState state; /// /// Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one /// of the header flags. Footer flags are optional. /// public ListViewGroupAlignment uAlign; /// /// Pointer to a null-terminated string that contains the subtitle text when item information is being set. If group information /// is being retrieved, this member specifies the address of the buffer that receives the subtitle text. This element is drawn /// under the header text. /// public StrPtrAuto pszSubtitle; /// /// Size, in TCHARs, of the buffer pointed to by the pszSubtitle member. If the structure is not receiving information about a /// group, this member is ignored. /// public uint cchSubtitle; /// /// Pointer to a null-terminated string that contains the text for a task link when item information is being set. If group /// information is being retrieved, this member specifies the address of the buffer that receives the task text. This item is /// drawn right-aligned opposite the header text. When clicked by the user, the task link generates an LVN_LINKCLICK notification. /// public StrPtrAuto pszTask; /// /// Size in TCHARs of the buffer pointed to by the pszTask member. If the structure is not receiving information about a group, /// this member is ignored. /// public uint cchTask; /// /// Pointer to a null-terminated string that contains the top description text when item information is being set. If group /// information is being retrieved, this member specifies the address of the buffer that receives the top description text. This /// item is drawn opposite the title image when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER. /// public StrPtrAuto pszDescriptionTop; /// /// Size in TCHARs of the buffer pointed to by the pszDescriptionTop member. If the structure is not receiving information about /// a group, this member is ignored. /// public uint cchDescriptionTop; /// /// Pointer to a null-terminated string that contains the bottom description text when item information is being set. If group /// information is being retrieved, this member specifies the address of the buffer that receives the bottom description text. /// This item is drawn under the top description text when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER. /// public StrPtrAuto pszDescriptionBottom; /// /// Size in TCHARs of the buffer pointed to by the pszDescriptionBottom member. If the structure is not receiving information /// about a group, this member is ignored. /// public uint cchDescriptionBottom; /// Index of the title image in the control imagelist. public int iTitleImage; /// Index of the extended image in the control imagelist. public int iExtendedImage; /// Read-only. public int iFirstItem; /// Read-only in non-owner data mode. public uint cItems; /// /// NULL if group is not a subset. Pointer to a null-terminated string that contains the subset title text when item information /// is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the /// subset title text. /// public StrPtrAuto pszSubsetTitle; /// /// Size in TCHARs of the buffer pointed to by the pszSubsetTitle member. If the structure is not receiving information about a /// group, this member is ignored. /// public uint cchSubsetTitle; /*public LVGROUP(ListViewGroup grp) : this(ListViewGroupMask.LVGF_NONE, grp.Header) { HeaderAlignment = grp.HeaderAlignment; var pi = grp.GetType().GetProperty("ID", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, typeof(int), Type.EmptyTypes, null); if (pi != null) ID = (int)pi.GetValue(grp, null); }*/ /// Initializes a new instance of the class. /// The mask. /// The header text. public LVGROUP(ListViewGroupMask mask = ListViewGroupMask.LVGF_NONE, string header = null) { this.mask = mask; if (header != null) Header = header; else if ((mask & ListViewGroupMask.LVGF_HEADER) != 0) pszHeader = new StrPtrAuto(cchHeader = 1024); if ((mask & ListViewGroupMask.LVGF_FOOTER) != 0) pszFooter = new StrPtrAuto(cchFooter = 1024); if ((mask & ListViewGroupMask.LVGF_SUBTITLE) != 0) pszSubtitle = new StrPtrAuto(cchSubtitle = 1024); if ((mask & ListViewGroupMask.LVGF_TASK) != 0) pszTask = new StrPtrAuto(cchTask = 1024); if ((mask & ListViewGroupMask.LVGF_DESCRIPTIONBOTTOM) != 0) pszDescriptionBottom = new StrPtrAuto(cchDescriptionBottom = 1024); if ((mask & ListViewGroupMask.LVGF_DESCRIPTIONTOP) != 0) pszDescriptionTop = new StrPtrAuto(cchDescriptionTop = 1024); } /// Gets or sets the bottom description text. /// The bottom description text. public string DescriptionBottom { get => pszDescriptionBottom.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewGroupMask.LVGF_DESCRIPTIONBOTTOM, pszDescriptionBottom.Assign(value, out cchDescriptionBottom)); } /// Gets or sets the top description text. /// The top description text. public string DescriptionTop { get => pszDescriptionTop.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewGroupMask.LVGF_DESCRIPTIONTOP, pszDescriptionTop.Assign(value, out cchDescriptionTop)); } /// Gets or sets the footer. /// The footer. public string Footer { get => pszFooter.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewGroupMask.LVGF_FOOTER, pszFooter.Assign(value, out cchFooter)); } /// Gets or sets the identifier. /// The identifier. public int ID { get => iGroupId; set { iGroupId = value; mask |= ListViewGroupMask.LVGF_GROUPID; } } /// Gets or sets the index of the title image. /// The index of the title image. public int TitleImageIndex { get => iTitleImage; set { iTitleImage = value; mask |= ListViewGroupMask.LVGF_TITLEIMAGE; } } /// Gets or sets the index of the extended image. /// The index of the extended image. public int ExtendedImageIndex { get => iExtendedImage; set { iExtendedImage = value; mask |= ListViewGroupMask.LVGF_EXTENDEDIMAGE; } } /// Gets the first item. /// The first item. public int FirstItem => iFirstItem; /// Gets the item count. /// The item count. public uint ItemCount => cItems; /// Gets or sets the alignment. /// The alignment. public ListViewGroupAlignment Alignment { get => uAlign; set { uAlign = value; mask |= ListViewGroupMask.LVGF_ALIGN; } } /// Gets or sets the header text. /// The header text. public string Header { get => pszHeader.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewGroupMask.LVGF_HEADER, pszHeader.Assign(value, out cchHeader)); } /// Gets or sets the subtitle. /// The subtitle. public string Subtitle { get => pszSubtitle.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewGroupMask.LVGF_SUBTITLE, pszSubtitle.Assign(value, out cchSubtitle)); } /// Gets or sets the task link text. /// The task link text. public string TaskLink { get => pszTask.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewGroupMask.LVGF_TASK, pszTask.Assign(value, out cchTask)); } /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { pszHeader.Free(); pszFooter.Free(); pszSubtitle.Free(); pszTask.Free(); pszDescriptionBottom.Free(); pszDescriptionTop.Free(); } /// Sets the state. /// State of the g. /// if set to true [on]. public void SetState(ListViewGroupState gState, bool on = true) { mask |= ListViewGroupMask.LVGF_STATE; stateMask |= gState; EnumExtensions.SetFlags(ref state, gState, on); } } /// /// Specifies or receives the attributes of a list-view item. This structure has been updated to support a new mask value /// (LVIF_INDENT) that enables item indenting. This structure supersedes the LV_ITEM structure. /// /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774760")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public sealed class LVITEM : IDisposable { private const int MAX_COLS = 20; private const int OverlayShift = 8; private const int StateImageShift = 12; /// /// Set of flags that specify which members of this structure contain data to be set or which members are being requested. This /// member can have one or more of the following flags set: /// public ListViewItemMask mask; /// Zero-based index of the item to which this structure refers. public int iItem; /// /// One-based index of the subitem to which this structure refers, or zero if this structure refers to an item rather than a subitem. /// public int iSubItem; /// /// Indicates the item's state, state image, and overlay image. The stateMask member indicates the valid bits of this member. /// Bits 0 through 7 of this member contain the item state flags. This can be one or more of the item state values. /// /// Bits 8 through 11 of this member specify the one-based overlay image index. Both the full-sized icon image list and the /// small icon image list can have overlay images. The overlay image is superimposed over the item's icon image. If these bits /// are zero, the item has no overlay image. To isolate these bits, use the LVIS_OVERLAYMASK mask. To set the overlay image /// index in this member, you should use the INDEXTOOVERLAYMASK macro. The image list's overlay images are set with the /// ImageList_SetOverlayImage function. /// /// /// Bits 12 through 15 of this member specify the state image index. The state image is displayed next to an item's icon to /// indicate an application-defined state. If these bits are zero, the item has no state image. To isolate these bits, use the /// LVIS_STATEIMAGEMASK mask. To set the state image index, use the INDEXTOSTATEIMAGEMASK macro. The state image index specifies /// the index of the image in the state image list that should be drawn. The state image list is specified with the /// LVM_SETIMAGELIST message. /// /// public uint state; /// /// Value specifying which bits of the state member will be retrieved or modified. For example, setting this member to /// LVIS_SELECTED will cause only the item's selection state to be retrieved. /// /// This member allows you to modify one or more item states without having to retrieve all of the item states first.For /// example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but /// none of the other states will be affected. /// /// To retrieve or modify all of the states, set this member to(UINT)-1. /// You can use the macro ListView_SetItemState both to set and to clear bits. /// public ListViewItemState stateMask; /// /// If the structure specifies item attributes, pszText is a pointer to a null-terminated string containing the item text. When /// responding to an LVN_GETDISPINFO notification, be sure that this pointer remains valid until after the next notification has /// been received. /// /// If the structure receives item attributes, pszText is a pointer to a buffer that receives the item text. Note that although /// the list-view control allows any length string to be stored as item text, only the first 260 TCHARs are displayed. /// /// /// If the value of pszText is LPSTR_TEXTCALLBACK, the item is a callback item.If the callback text changes, you must explicitly /// set pszText to LPSTR_TEXTCALLBACK and notify the list-view control of the change by sending an LVM_SETITEM or /// LVM_SETITEMTEXT message. /// /// /// Do not set pszText to LPSTR_TEXTCALLBACK if the list-view control has the LVS_SORTASCENDING or LVS_SORTDESCENDING style. /// /// public StrPtrAuto pszText; /// /// Number of TCHARs in the buffer pointed to by pszText, including the terminating NULL. /// /// This member is only used when the structure receives item attributes.It is ignored when the structure specifies item /// attributes.For example, cchTextMax is ignored during LVM_SETITEM and LVM_INSERTITEM.It is read-only during LVN_GETDISPINFO /// and other LVN_ notifications. /// /// Never copy more than cchTextMax TCHARs—where cchTextMax includes the terminating NULL—into pszText during an LVN_ /// notification, otherwise your program can fail. /// public uint cchTextMax; /// /// Index of the item's icon in the control's image list. This applies to both the large and small image list. If this member is /// the I_IMAGECALLBACK value, the parent window is responsible for storing the index. In this case, the list-view control sends /// the parent an LVN_GETDISPINFO notification code to retrieve the index when it needs to display the image. /// public int iImage; /// /// Value specific to the item. If you use the LVM_SORTITEMS message, the list-view control passes this value to the /// application-defined comparison function. You can also use the LVM_FINDITEM message to search a list-view control for an item /// with a specified lParam value. /// public IntPtr lParam; /// /// Version 4.70. Number of image widths to indent the item. A single indentation equals the width of an item image. Therefore, /// the value 1 indents the item by the width of one image, the value 2 indents by two images, and so on. Note that this field /// is supported only for items. Attempting to set subitem indentation will cause the calling function to fail. /// public int iIndent; /// /// Version 6.0 Identifier of the group that the item belongs to, or one of the following values: I_GROUPIDCALLBACK = The /// listview control sends the parent an LVN_GETDISPINFO notification code to retrieve the index of the group; I_GROUPIDNONE = /// The item does not belong to a group. /// public int iGroupId; /// /// Version 6.0 Number of data columns (subitems) to display for this item in tile view. The maximum value is 20. If this value /// is I_COLUMNSCALLBACK, the size of the column array and the array itself (puColumns) are obtained by sending a /// LVN_GETDISPINFO notification. /// public uint cColumns; /// /// Version 6.0 A pointer to an array of column indices, specifying which columns are displayed for this item, and the order of /// those columns. /// public IntPtr puColumns; /// /// Windows Vista: Not implemented. Windows 7 and later: A pointer to an array of the following flags (alone or in combination), /// specifying the format of each subitem in extended tile view. /// public IntPtr piColFmt; /// Windows Vista: Group index of the item. Valid only for owner data/callback (single item in multiple groups). public int iGroup; /// Initializes a new instance of the class. /// Zero-based index of the item. /// One-based index of the subitem. /// The mask of items to retrieve. /// The state items to retrieve. public LVITEM(int item, int subitem, ListViewItemMask mask = ListViewItemMask.LVIF_ALL, ListViewItemState stateMask = ListViewItemState.LVIS_ALL) { this.mask = mask; if (mask.IsFlagSet(ListViewItemMask.LVIF_TEXT)) pszText = new StrPtrAuto(cchTextMax = 1024); if (mask.IsFlagSet(ListViewItemMask.LVIF_COLUMNS)) puColumns = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * MAX_COLS); if (mask.IsFlagSet(ListViewItemMask.LVIF_COLFMT)) piColFmt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * MAX_COLS); iItem = item; iSubItem = subitem; this.stateMask = stateMask; } /// Initializes a new instance of the class. /// Zero-based index of the item. /// One-based index of the subitem or zero if this structure refers to an item rather than a subitem. /// The item text. public LVITEM(int item, int subitem = 0, string text = null) { iItem = item; iSubItem = subitem; if (text != null) Text = text; } /// Gets or sets the group identifier. /// The group identifier. public int GroupId { get => iGroupId; set { iGroupId = value; EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_GROUPID); } } /// Gets or sets the index of the image. /// The index of the image. public int ImageIndex { get => iImage; set { iImage = value; EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_IMAGE); } } /// Gets or sets the indent. /// The indent. public int Indent { get => iIndent; set { iIndent = value; EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_INDENT); } } /// Gets or sets the l parameter. /// The l parameter. public IntPtr LParam { get => lParam; set { lParam = value; EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_PARAM); } } /// Gets or sets the text. /// The text. public string Text { get => pszText.ToString(); set => EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_TEXT, pszText.Assign(value, out cchTextMax)); } /// Gets or sets the tile columns. /// The tile columns. public LVITEMCOLUMNINFO[] TileColumns { get { var ret = new LVITEMCOLUMNINFO[cColumns]; if (cColumns == 0) return ret; var cols = puColumns.ToArray((int)cColumns); var fmts = piColFmt.ToArray((int)cColumns); for (var i = 0; i < cColumns; i++) ret[i] = new LVITEMCOLUMNINFO((uint)(cols?[i] ?? 0), (ListViewColumnFormat)(fmts?[i] ?? 0)); return ret; } set { Marshal.FreeHGlobal(puColumns); Marshal.FreeHGlobal(piColFmt); cColumns = (uint)(value?.Length ?? 0); puColumns = piColFmt = IntPtr.Zero; if (value == null) { EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_COLFMT | ListViewItemMask.LVIF_COLUMNS, false); return; } var cols = new int[cColumns]; var fmts = new int[cColumns]; var hasFmts = false; for (var i = 0; i < cColumns; i++) { cols[i] = (int)value[i].columnIndex; fmts[i] = (int)value[i].format; if (fmts[i] != 0) hasFmts = true; } if (cColumns > 0) { puColumns = cols.MarshalToPtr(Marshal.AllocHGlobal, out _); } EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_COLUMNS); if (hasFmts) { piColFmt = fmts.MarshalToPtr(Marshal.AllocHGlobal, out _); EnumExtensions.SetFlags(ref mask, ListViewItemMask.LVIF_COLFMT); } } } /// Gets the state. /// The state. /// The value of the specified state. private bool GetState(ListViewItemState state) => StateFlags.IsFlagSet(state); /// Sets the state. /// The state value to set. /// true to set, false to unset. private void SetState(ListViewItemState state, bool value) { mask |= ListViewItemMask.LVIF_STATE; stateMask |= state; this.state = (uint)StateFlags.SetFlags(state, value) | ((uint)state & 0xFFFFFF00); } /// Gets the state flags. /// The state flags. public ListViewItemState StateFlags => (ListViewItemState)(state & 0x000000FF); /// Gets or sets a value indicating whether the item is marked for a cut-and-paste operation. /// true if marked for a cut-and-paste operation; otherwise, false. public bool CutOrPaste { get => GetState(ListViewItemState.LVIS_CUT); set => SetState(ListViewItemState.LVIS_CUT, value); } /// Gets or sets a value indicating whether the item is highlighted as a drag-and-drop target. /// true if highlighted as a drag-and-drop target; otherwise, false. public bool DropHighlighted { get => GetState(ListViewItemState.LVIS_DROPHILITED); set => SetState(ListViewItemState.LVIS_DROPHILITED, value); } /// Gets or sets a value indicating whether this item has the focus. /// true if focused; otherwise, false. public bool Focused { get => GetState(ListViewItemState.LVIS_FOCUSED); set => SetState(ListViewItemState.LVIS_FOCUSED, value); } /// Gets or sets a value indicating whether this item is selected. /// true if selected; otherwise, false. public bool Selected { get => GetState(ListViewItemState.LVIS_SELECTED); set => SetState(ListViewItemState.LVIS_SELECTED, value); } /// Gets or sets the index of the overlay image. /// The index of the overlay image. /// OverlayImageIndex - Overlay image index must be between 0 and 15 public uint OverlayImageIndex { get => (state & (uint)ListViewItemState.LVIS_OVERLAYMASK) >> OverlayShift; set { if (value > 0xF) throw new ArgumentOutOfRangeException(nameof(OverlayImageIndex), "Overlay image index must be between 0 and 15"); mask |= ListViewItemMask.LVIF_STATE; stateMask |= ListViewItemState.LVIS_OVERLAYMASK; state = (value << OverlayShift) | (state & ~(uint)ListViewItemState.LVIS_OVERLAYMASK); } } /// Gets or sets the index of the state image. /// The index of the state image. /// StateImageIndex - State image index must be between 0 and 15 public uint StateImageIndex { get => (state & (uint)ListViewItemState.LVIS_STATEIMAGEMASK) >> StateImageShift; set { if (value > 0xF) throw new ArgumentOutOfRangeException(nameof(StateImageIndex), "State image index must be between 0 and 15"); mask |= ListViewItemMask.LVIF_STATE; stateMask |= ListViewItemState.LVIS_STATEIMAGEMASK; state = (value << StateImageShift) | (state & ~(uint)ListViewItemState.LVIS_STATEIMAGEMASK); } } /// Returns a that represents this instance. /// A that represents this instance. public override string ToString() => $"LVITEM: pszText={Text}; iItem={iItem}; iSubItem={iSubItem}; state={state}; iGroupId={iGroupId}; cColumns={cColumns}"; /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. void IDisposable.Dispose() { Marshal.FreeHGlobal(puColumns); Marshal.FreeHGlobal(piColFmt); pszText.Free(); } } } }