Home All Groups Group Topic Archive Search About

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

Author
25 Nov 2004 1:35 PM
amit bharadwaj
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
--
amit bharadwaj

Author
25 Nov 2004 2:11 PM
Nigel Armstrong
Hi amit

The best thing to do is to use the pinvoke website to find this sort of
information:

Try this URL for GetScrollInfo:

HTH

Nigel Armstrong

http://www.pinvoke.net/default.aspx/user32.GetScrollInfo
Show quote
"amit bharadwaj" wrote:

> 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
> --
> amit bharadwaj
>
Author
25 Nov 2004 3:48 PM
Jeff Gaines
On 25/11/2004 amit bharadwaj wrote:

> 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.

--
Jeff Gaines Damerham Hampshire UK

AddThis Social Bookmark Button