CHeaderCtrl::GetOrderArray

Retrieves the left-to-right order of items in a header control.

BOOL GetOrderArray( 
   LPINT piArray, 
   int iCount 
);

Parameters

  • piArray
    A pointer to the address of a buffer that receives the index values of the items in the header control, in the order in which they appear from left to right.

  • iCount
    The number of header control items. Must be non-negative.

Return Value

Nonzero if successful; otherwise 0.

Remarks

This member function implements the behavior of the Win32 message HDM_GETORDERARRAY, as described in the Windows SDK. It is provided to support header item ordering.

Example

// Reverse the order of the items in the header control. 
      // (i.e. make the first item the last one, the last item 
      // the first one, and so on ...). 
      int   nCount = m_myHeaderCtrl.GetItemCount();
      LPINT pnOrder = (LPINT) malloc(nCount*sizeof(int));
      ASSERT(pnOrder != NULL);
      if (NULL != pnOrder)
      {
         m_myHeaderCtrl.GetOrderArray(pnOrder, nCount);

         int i, j, nTemp;
         for (i=0, j=nCount-1; i < j; i++, j--)
         {
            nTemp = pnOrder[i];
            pnOrder[i] = pnOrder[j];
            pnOrder[j] = nTemp;
         }

         m_myHeaderCtrl.SetOrderArray(nCount, pnOrder);
         free(pnOrder);
      }

Requirements

Header: afxcmn.h

See Also

Reference

CHeaderCtrl Class

Hierarchy Chart

CHeaderCtrl::SetOrderArray

CHeaderCtrl::OrderToIndex