Focus problem on MFC (win32)

drjackool 956 Reputation points
2021-10-18T05:58:53.4+00:00

hi
I have a dialog and on it I have a ctreectrl and other controls. my problem is on selchanging event of tree view in some states (for example data validation) I need prevent changing the tree view selection but when I preventing the change the focus stays on tree view, I need focus returned to previous control before changing the selection. how do it?
I use SetFocus to set focus on other control on selchanging notification of treeview but not work and focus still stay on tree view.
Thanks

Windows development | Windows API - Win32
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.