如何在VB.NET 2005中獲取ListBox控件的句柄?如何在vb.net 2005中獲取列表框的句柄
我使用
Dim i_Handle As ListBox
i_Handle = ListBox1.Handle
但是,這是行不通的
如何在VB.NET 2005中獲取ListBox控件的句柄?如何在vb.net 2005中獲取列表框的句柄
我使用
Dim i_Handle As ListBox
i_Handle = ListBox1.Handle
但是,這是行不通的
您正在創建新的ListBox
並將其設置爲值ListBox1.Handle
- 但ListBox1.Handle
返回IntPrt
類型 - 整數。
Dim listBoxHandle As IntPtr
listBoxHandle = ListBox1.Handle
MessageBox.Show(listBoxHandle) // You'll see numbers.
手柄是IntPrt(A手柄只是一個32位整數)。
相反的ListBox的,你必須使用的IntPtr:
Dim i_Handle As IntPtr
i_Handle = ListBox1.Handle
謝謝。但爲什麼你的第一篇文章是-1? – JPro 2009-12-23 14:35:40
我不知道,首先發貼或許:) – 2009-12-23 15:04:09
對不起,你可以請清楚了嗎?在這種情況下,我應該如何得到hanlde? – JPro 2009-12-23 14:08:54