0

我正在尝试从打开的 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 ......我做错了什么?

4

0 回答 0