title: vb.net getting listview items from sendmessagestring
body: <p>I am using the following code to <em>try</em> to grad whats in the listview on another window:</p>
  
  <pre><code>Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
  Private Function SendMessageString(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, ByRef lParam As String) As IntPtr
  End Function
  Public Const LB_GETCOUNT = &amp;H18B
  Public Const LB_GETTEXT = &amp;H189
  Public Const LB_GETTEXTLEN = &amp;H18A
  
  hwnd = FindWindow(vbNullString, "Virtual CDRom Control Panel")
  x = FindWindowEx(hwnd, 0, vbNullString, "List1")
  
  Dim listCount As String = SendMessage(x, LB_GETCOUNT, CLng(0), CLng(0))
  Dim textLen As String = SendMessage(x, LB_GETTEXTLEN, 30, CLng(0))
  Dim itemText As String = New String(" ", textLen)
  Dim theText As String = SendMessageString(x, LB_GETTEXT, 30, itemText)
  
  MessageBox.Show(theText)
  </code></pre>
  
  <p>But the value i always get is <strong>0</strong>.</p>
  
  <p><a href="http://img153.imageshack.us/img153/8892/vcdprog.jpg" rel="nofollow noreferrer">http://img153.imageshack.us/img153/8892/vcdprog.jpg</a></p>
  
  <p>Any help would be great! :o)</p>
  
  <p>David</p>