You can change the window style of a list view control after it is created. First, use the GetWindowLong function to get the current style. Then use the SetWindowLong function to specify the new style. For a complete list of the list view window styles, see List View Window Styles.
The following example changes the style bits that govern the view mode.
// SetView - sets a list view's window style to change the view.
// hwndLV - handle of the list view control
// dwView - value specifying a view style
VOID WINAPI SetView(HWND hwndLV, DWORD dwView)
{
// Get the current window style.
DWORD dwStyle = GetWindowLong(hwndLV, GWL_STYLE);
// Only set the window style if the view bits have changed.
if ((dwStyle & LVS_TYPEMASK) != dwView)
SetWindowLong(hwndLV, GWL_STYLE,
(dwStyle & ~LVS_TYPEMASK) | dwView);
}