声明的时候声明成ref参数
BOOL GetWindowRect(
HWND hWnd, // handle of window
LPRECT lpRect // address of structure for window coordinates
);
-->>
[DllImport("user32.dll")]
public static extern bool GetWindowRect(IntPtr hWnd, ref Rectangle lpRect);
BOOL GetWindowRect(
HWND hWnd, // handle of window
LPRECT lpRect // address of structure for window coordinates
);
-->>
[DllImport("user32.dll")]
public static extern bool GetWindowRect(IntPtr hWnd, ref Rectangle lpRect);
Marshal.PtrToStructure();
Marshal.StructureToPtr();