0

I'm trying to call GetScrollInfo using PInvoke:

BOOL GetScrollInfo(
  _In_    HWND         hwnd,
  _In_    int          fnBar,
  _Inout_ LPSCROLLINFO lpsi
);

I'm looking for some confirmation that int is the correct managed type for this as specified on pinvoke.net:

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);

What's the correct integer size for an int? Is int = int?

boot4life
  • 4,966
  • 7
  • 25
  • 47
  • Does https://stackoverflow.com/questions/29767161/get-the-value-of-a-scrollbars-scroll-for-a-winforms-text-box-c help? – mjwills Oct 12 '17 at 12:28
  • It is a keyword in the C# language, currently and surely for a while to come it is aliased to Int32. And yes, int to a 32-bit or 64-bit C compiler is also a 32-bit value. Surely for a while to come. There is no problem. – Hans Passant Oct 12 '17 at 12:29
  • That answers the question. I guess I'll have to look elsewhere for the source of random ExecutionEngineExceptions in my application :( – boot4life Oct 12 '17 at 12:37

0 Answers0