INFO: HDN_TRACK Notifications and Full Window Drag Style

ID: Q183258

The information in this article applies to:

SUMMARY

Starting with version 4.70 of ComCtl32.dll, the header control of a list view control in report view (LVS_REPORT) automatically receives the HDS_FULLDRAG style. When this style is set, the parent of a list view control receives HDN_ITEMCHANGING notifications, rather than HDN_TRACK notifications, when the column divider of the header control is dragged. To receive HDN_TRACK notifications, the header control of the list view control must not have the HDS_FULLDRAG style set. Note that the HDS_FULLDRAG style is ignored in versions of ComCtl32.dll prior to 4.70.

MORE INFORMATION

If you are using Windows 95 with Microsoft Plus! or Windows NT 4.0, the user can enable full dragging of windows. You can do this in the Microsoft Plus! Property page in the "Display" control panel property sheet. If the "Show window contents while dragging" check box is selected, multiple HDN_ITEMCHANGING notifications will be sent and the HDN_TRACK notification message will not be sent. If the check box is not selected, the opposite will happen--multiple HDN_ITEMCHANGING notifications will not be sent and the HDN_TRACK notification message will be sent.

You can set and retrieve the full window drag feature programmatically by using the SystemParametersInfo function with the SPI_SETFULLDRAGWINDOW to set it and the SPI_GETDRAGFULLWINDOWS options to retrieve it.

The following code shows how to check to see if full window dragging is enabled and, if so, remove the HDS_FULLDRAG style from the list view control's header control.

Sample Code

   BOOL CMyCListCtrl::RemoveFullDrag( HWND hWndListCtrl )
   {
      BOOL bIsSet;
      if( SystemParametersInfo( SPI_GETDRAGFULLWINDOWS, 0, &bIsSet, 0 ) )
      {
         if( bIsSet )
         {
            HWND hWndHeaderCtrl = ::GetWindow( hWndListCtrl, GW_CHILD );
            if( hWndHeaderCtrl != NULL )
            {
               DWORD dwStyle = :GetWindowLong( hWndHeaderCtrl ,GWL_STYLE );
               dwStyle &= ~HDS_FULLDRAG;
               ::SetWindowLong( hWndHeaderCtrl , GWL_STYLE, dwStyle );

               return TRUE;
            }
         }
      }
      return FALSE;
   }

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Isaac L. Varon, Microsoft Corporation

Additional query words: CListCtrl CHeaderCtrl

Keywords          : kbCtrl kbHeaderCtrl kbListView kbNTOS kbGrpUser kbWinOS 
Issue type        : kbinfo

Last Reviewed: December 26, 1998