You can adjust the scroll position inside your callback function:
case BFFM_SELCHANGED:
if(This->_do_center_selection)
{
enum{ IDC_TREE = 0x3741, };
This->_do_center_selection = This->_keep_center_selection;
SCROLLINFO si = {sizeof(SCROLLINFO),SIF_POS|SIF_RANGE|SIF_PAGE, };
HWND htree = GetDlgItem(hDlg,IDC_TREE);
HTREEITEM htir,htic,htis;
int count,pos;
if(IsWindow(htree))
{
htir = TreeView_GetRoot(htree);
htis = TreeView_GetSelection(htree);
htic = TreeView_GetChild(htree,htir);
for(count=pos=0;htic;htic=TreeView_GetNextVisible(htree,htic),count++){ if(htis==htic) pos=count; }
GetScrollInfo(htree,SB_VERT,&si);
si.nPage /= 2;
if((pos>(int)(si.nMin+si.nPage)) && (pos<=(int)(si.nMax-si.nMin-si.nPage)))
{
si.nMax = si.nPos - si.nMin + si.nPage;
for(;pos<si.nMax;pos++) PostMessage(htree,WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0);
for(;pos>si.nMax;pos--) PostMessage(htree,WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),0);
}
}
}
break;
Good luck.