pitaridis
Well-known member
- Joined
- Nov 18, 2005
- Messages
- 63
- Programming Experience
- 10+
I would like to have some help because I have been trying to convert the following code from VB6 to VB.NET but I have not achieved it yet.
My problem is the lParam param which is type of Any and I can not find a way to set a VB.NET equivalent data type in order to make this work. I have done it 2 years ago because I wanted to make exactly the same thing but I have not this project to see how I did it.
The above example uses the windows api to get the selected items of a listbox. I need to make it like this because I have the window handle and I have to use this information to get the selected items.
Thanks
VB.NET:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_GETSELITEMS = &H191
Dim ItemIndexes() As Long, x As Integer, iNumItems As Integer
Private Sub Command1_Click()
iNumItems = List1.SelCount
If iNumItems Then
ReDim ItemIndexes(iNumItems - 1)
SendMessage List1.hwnd, LB_GETSELITEMS, iNumItems, ItemIndexes(0)
End If
For x = 0 To iNumItems - 1
List2.AddItem List1.List(ItemIndexes(x))
Next x
End Sub
My problem is the lParam param which is type of Any and I can not find a way to set a VB.NET equivalent data type in order to make this work. I have done it 2 years ago because I wanted to make exactly the same thing but I have not this project to see how I did it.
The above example uses the windows api to get the selected items of a listbox. I need to make it like this because I have the window handle and I have to use this information to get the selected items.
Thanks