有人可以发布允许我通过名称读取特定窗口的位置和分辨率的代码,例如
private function findposition(byval windowtitle as string)
欢呼马丁
我在用
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As IntPtr
Private Declare Function GetWindowRect Lib "user32" (ByVal _
hwnd As IntPtr, ByVal lpRect As Rectangle) As Integer
Dim lobbywindow As IntPtr = FindWindow("Appclass", "Appname")
Dim lobbyrectangle As New Rectangle
GetWindowRect(lobbywindow, lobbyrectangle)
请协助解决这个问题,因为我收到错误
调用 PInvoke 函数 'App!App.Form1::GetWindowRect' 使堆栈失衡。这可能是因为托管 PInvoke 签名与非托管目标签名不匹配。检查 PInvoke 签名的调用约定和参数是否与目标非托管签名匹配。