vb.net从sendmessagestring获取listview项目

我正在使用以下代码尝试在另一个窗口的listview中进行渐变:
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 = &H18B
Public Const LB_GETTEXT = &H189
Public Const LB_GETTEXTLEN = &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)
但我总是得到的价值是0。 http://img153.imageshack.us/img153/8892/vcdprog.jpg 任何帮助都会很棒! :O) 大卫     
已邀请:
我的建议是逐步完成代码,找到你没有得到价值的地方。 IE - hwnd设置正确吗?如果没有,请使用Spy ++验证窗口Classname和Windowname。 我知道FindWindow的文档: http://msdn.microsoft.com/en-us/library/ms633499(v=vs.85).aspx 如果将classname null保留为将返回所有匹配的相应windowname,但我很难看到这种行为(我必须明确地给它类名,然后它工作得很好)。     

要回复问题请先登录注册