problem in calling winapi that use pointer to struct from c#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi am using panel with autoscroll , now i want to call window api
BOOL GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi));

now am doing like tht
unsafe public static extern bool GetScrollInfo(uint hwnd,uint SB_HORZ,
SCROLLINFO* si );

but it causes a problem in lasst parameter , pls help
 
hi am using panel with autoscroll , now i want to call window api
BOOL GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi));

now am doing like tht
unsafe public static extern bool GetScrollInfo(uint hwnd,uint
SB_HORZ, SCROLLINFO* si );

but it causes a problem in lasst parameter , pls help


Try:

public static extern bool GetScrollInfo(uint hwnd, uint SB_HORZ, ref
SCROLLINFO si);

You don't need 'unsafe' then. You can also declare the hwnd as an
IntPtr which is often easier.

As somebody else pointed out pinvoke.net can be helpful or
microsoft.public.dotnet.framework.interop.
 
Back
Top