I've got an API declared in VB6:

VB Code:
  1. Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long

Its passed a RECT structure, that is declared like this:

VB Code:
  1. Private Type RECT
  2.     Left As Long
  3.     Top As Long
  4.     Right As Long
  5.     Bottom As Long
  6. End Type

Am I right thinking that this would be the proper translation?

C# Code:
  1. public struct RECT
  2.         {
  3.             public int left;
  4.             public int top;
  5.             public int right;
  6.             public int bottom;
  7.         }
  8.  
  9.         [System.Runtime.InteropServices.DllImport("user32.dll")]
  10.         public static extern int GetWindowRect(IntPtr hwnd, RECT lpRect);

I dont see what I mightve done wrong, because everytime I try to call the function I get this error message:

A call to PInvoke function 'WindowHandles!WindowHandles.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.