title: VB.net get window information
body: <p>Can someone post the code that would allow me to read the postion and resolution of a specific window by its name, eg</p>
  
  <pre><code>private function findposition(byval windowtitle as string)
  </code></pre>
  
  <p>cheers
  Martin</p>
  
  <p>I am using </p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Please assist in solving this since I get the error </p>
  
  <p>A call to PInvoke function 'App!App.Form1::GetWindowRect' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.</p>