I'm trying to get the WNDPROC from a open Windows Explorer window. I can successfully get the handle of the window, but "GetWindowLongPtr" returns always "0".
I'm declaring the entry:
<DllImport("user32.dll", EntryPoint:="GetWindowLongPtrW")> _
Public Shared Function GetWindowLongPtrW(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I8)> ByVal nIndex As Long) As IntPtr
End Function
And I'm trying to get WNDPROC:
Dim ist As IntPtr
Dim mtm As IntPtr
Try
ist = FindWindow("CabinetWClass", vbNullString)
Dim ist2 As New HandleRef(0, ist)
MsgBox(ist)
mtm = GetWindowLongPtrW(ist2, 1)
MsgBox(mtm)
Catch ex As Exception
MsgBox("Erro :(" & vbCrLf & vbCrLf & ex.ToString)
End Try
But, the WNDPROC MSGBOX always returns 0... What I'm doing wrong?