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

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
 
J

Jeff Gaines

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top