次の方法で共有


Header_GetOrderArray (Compact 2013)

3/28/2014

This macro retrieves the current left-to-right order of items in a header control.

Syntax

#define Header_GetOrderArray(hwnd, iCount, lpi) \
     (BOOL)SNDMSG((hwnd), HDM_GETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)

Parameters

  • hwnd
    Handle to a header control.
  • iCount
    Size of the buffer at lpi, in elements. This value must equal the value returned by HDM_GETITEMCOUNT.
  • lpi
    Long pointer to a buffer that receives the index values of the items in the header. The buffer should be big enough to hold the total number of items * sizeof(int). For example, the following code fragment will reserve enough memory to hold the index values.

Return Value

Returns nonzero if successful, and the buffer at lpi receives the item number of each item in the header control, in the order in which they appear from left to right. The macro returns zero otherwise.

Remarks

Related message example.

int iItems;
int *lpiArray = NULL;
// Get the number of header items
iItems = Header_GetItemCount (hwndHD);
if (iItems > 0)
{
  // Get memory for buffer
  lpiArray = LocalAlloc(LMEM_FIXED, iItems*sizeof(int));
  if (lpiArray)
  {
    Header_GetOrderArray (hwndHD, iItems, lpiArray);
    // If succesful use the index values retrieved here
  }
  else
  {
    MessageBox(hwnd, L"Out of memory.","Error", MB_OK);
  }
}
if (lpiArray)
{
  LocalFree(lpiArray);
}

Requirements

Header

commctrl.h

See Also

Reference

Header Controls Macros
HDM_GETITEMCOUNT
HDM_GETORDERARRAY