DLL imports, implict convert of params?

Started by
-1 comments, last by chbfiv 16 years, 8 months ago
I'm just wondering if its ok to have a DLL import in C# convert a param from one type to another. Here is my example, GetScrollInfo a user32.dll function. http://msdn2.microsoft.com/en-us/library/ms651287.aspx

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

Here is the c# import, I'm converting the return value, the hwnd and the fnBar params here.

[DllImport("user32.dll", SetLastError = true)]
public static extern int GetScrollInfo(
     IntPtr hWnd,
     System.Windows.Forms.ScrollOrientation n,
     ref SCROLLINFO lpScrollInfo
);
[StructLayout(LayoutKind.Sequential)]
public struct SCROLLINFO
{
    public UInt32 cbSize;
    public UInt32 fMask;
    public Int32  nMin;
    public Int32  nMax;
    public UInt32 nPage;
    public Int32  nPos;
    public Int32  nTrackPos;
}

-BourkeIV

This topic is closed to new replies.

Advertisement