title: How to select an element in SysTreeView using WinAPI
body: <p>I am trying to select an element in a SysTreeView, right click it and select an element in the list which pops up. </p>
  
  <p>To select an element I wrote:</p>
  
  <pre><code>Window = waitWindowEx(Window, NULL, "SysTreeView32", NULL); 
  
  const int TV_FIRST = 0x1100; 
  const int TVGN_ROOT = 0x0; 
  const int TVGN_NEXT = 0x1; 
  const int TVGN_CHILD = 0x4; 
  const int TVGN_FIRSTVISIBLE = 0x5; 
  const int TVGN_NEXTVISIBLE = 0x6; 
  const int TVGN_CARET = 0x9; 
  const int TVM_SELECTITEM = (TV_FIRST + 11); 
  const int TVM_GETNEXTITEM = (TV_FIRST + 10); 
  const int TVM_GETITEM = (TV_FIRST + 12); 
  
  int treeItem = 0; 
  treeItem = SendMessage(Window, TVM_GETNEXTITEM, TVGN_ROOT, NULL);
  SendMessage(Window, TVM_SELECTITEM, TVGN_CARET, (LPARAM)(treeItem));
  </code></pre>
  
  <p>Window is the handle after traversing to reach the tree (used Spy++)
  but nothing happens on the screen. 
  The tree is </p>
  
  <pre><code>-A
  --A1
  --A2
  --A3
  </code></pre>
  
  <p>I am trying to select and right click A2.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Thnx</p>