Vb.net 为什么windows win32函数在windows 7上引发AccessViolationException
电话:Vb.net 为什么windows win32函数在windows 7上引发AccessViolationException,vb.net,winapi,Vb.net,Winapi,电话: Private Declare Function CascadeWindowsNative Lib "user32" Alias "CascadeWindows" ( _ ByVal hwndParent As Long, _ ByVal wHow As Long, _ ByVal lpRect As Long, _ ByVal cKids As Long, _ ByVal lpkids As Long) As Integer 这里的主要问题是使用Lon
Private Declare Function CascadeWindowsNative Lib "user32" Alias "CascadeWindows" ( _
ByVal hwndParent As Long, _
ByVal wHow As Long, _
ByVal lpRect As Long, _
ByVal cKids As Long, _
ByVal lpkids As Long) As Integer
这里的主要问题是使用
Long
类型传递句柄值。这是不正确的,它们需要通过IntPtr
类型传递。钩子下的句柄本质上是指针,大小根据进程是32位还是64位而变化
我不熟悉那个API,所以我不知道其余的参数是否正确。PInvoke.Net上的示例代码表明,其中一些应该输入到Long
CascadeWindowsNative(Nothing, &H4, 0, 0, 0)
Private Declare Function CascadeWindowsNative Lib "user32" Alias "CascadeWindows" (ByVal hwndParent As IntPtr,
ByVal wHow As UInt32,
ByVal lpRect As IntPtr,
ByVal cKids As UInt32,
ByVal lpkids() As IntPtr) As Integer