Get previous item in outline

In the previous section, we defined an overloaded version of GetNextItem() which returns the next item in the outline as if the outline were completely expanded. We now define its counterpart: GetPrevItem(). This function uses the GetLastItem() defined in an earlier section.
// GetNextItem  - Get previous item as if outline was completely expanded
// Returns              - The item immediately above the reference item
// hItem                - The reference item
HTREEITEM CTreeCtrlX::GetPrevItem( HTREEITEM hItem )
        HTREEITEM       hti;

        hti = GetPrevSiblingItem(hItem);
        if( hti == NULL )
                hti = GetParentItem(hItem);
                hti = GetLastItem(hti);
        return hti;