Hola a como no declares las varibles mucho no va a funcionar
y bueno si es que la declaraste el problema es como declaraste SendMessage
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_GETITEMRECT As Long = (LVM_FIRST + 14)
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal Hwnd As Long) As Long
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
Public Function tapRectItem(ByVal lnghWnd As Long, ByVal Index As Integer)
Dim lRet As Long
Dim tRec As RECT
lRet = SendMessage(lnghWnd, LVM_GETITEMRECT, Index, tRec)
Debug.Print tRec.Right, tRec.Bottom
With Form1.Picture1
.Top = tRec.Top
.Left = tRec.Left
.Height = tRec.Bottom - tRec.Top
.Width = tRec.Right - tRec.Left
.Visible = True
lRet = SetParent(.Hwnd, lnghWnd)
End With
End Function
bueno a como veo esto te digo, el formulario tiene que estar Me.ScaleMode = vbPixels o bien llevar las cordenadas a escala.
igual hacer esto es una chanchada porque en cuanto agas un scroll sobre el listview el picture va a pasar por devajo de este.
y si pensas hacer esto para un listview externo a tu aplicacion no te va a funcionar.
Saludos