怎么发送消息选择TreeCtrl的某个节点,并触发TVN_SELCHANGED事件

如何发送消息选择TreeCtrl的某个节点,并触发TVN_SELCHANGED事件
如何发送消息选择TreeCtrl的某个节点,并触发TVN_SELCHANGED事件

使用Select(hItem)不能触发TVN_SELCHANGED事件

------解决方案--------------------
用 TVM_SELECTITEM

lResult = SendMessage(// returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) TVM_SELECTITEM,// message ID
(WPARAM) wParam, // = (WPARAM) (DWORD) flag;
(LPARAM) lParam // = (LPARAM) (HTREEITEM) hitem; );

flag参数的说明 
  Action flag. This parameter can be one of the following values:
TVGN_CARET //要填这个标志
  Sets the selection to the specified item. The tree-view control 's parent window receives the TVN_SELCHANGING and TVN_SELCHANGED notification messages.
TVGN_DROPHILITE
  Redraws the specified item in the style used to indicate the target of a drag-and-drop operation.
TVGN_FIRSTVISIBLE
  Ensures that the specified item is visible, and, if possible, displays it at the top of the control 's window. Tree-view controls display as many items as will fit in the window. If the specified item is near the bottom of the control 's hierarchy of items, it might not become the first visible item, depending on how many items fit in the window.
TVSI_NOSINGLEEXPAND
  Windows XP and later: When a single item is selected, ensures that the treeview does not expand the children of that item. This is valid only if used with the TVGN_CARET flag. Note To use this flag, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Using Windows XP Visual Styles.
------解决方案--------------------
用SendMessage ,发送WM_NOTIFY消息,lParam 为TVN_SELCHANGED 看看