我正在尝试从打开的Windows资源管理器窗口获取WNDPROC。我可以成功获取窗口的句柄,但“GetWindowLongPtr”总是返回“0”。
我正在宣布这个条目:
<DllImport("user32.dll", EntryPoint:="GetWindowLongPtrW")> _
Public Shared Function GetWindowLongPtrW(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I8)> ByVal nIndex As Long) As IntPtr
End Function
我正试图获得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
但是,WNDPROC MSGBOX总是返回0 ......我做错了什么?