Home All Groups Group Topic Archive Search About

Good tutorial on Windows API

Author
27 Jan 2006 10:15 AM
Jarod_24
I've been using a lot of <DllImports> as of late and i was wondering if
anyone could tell me a good tutorial/website/articles/books
that explains what System.Marshal** actually does and how to make those
structures that some windows api methods need passed in/out.

So far i've used mostly methods that send in/out strings, bool, integer and
so on, easy to convert into CLR types, but some methods need structures and
some of these have quite some exotic <parameters> set. How do people know
when that is needed to be set is a mystery to me (i would like to learn it).

Example:

<StructLayout(LayoutKind.Sequential)> _
Public Structure StartUpInfo
    Public cb As Integer
    <MarshalAs(UnmanagedType.LPTStr)> Public lpReserved As String
    <MarshalAs(UnmanagedType.LPTStr)> Public lpDesktop As String
....



this article was great:
http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/03/07/NET/toc.asp

Author
28 Jan 2006 4:26 PM
Brooke
Good website for both C# and VB

http://www.pinvoke.net/


Show quoteHide quote
"Jarod_24" <jarod***@hotmail.com> wrote in message
news:43db3a4e$0$3737$6d36acad@titian.nntpserver.com...
> I've been using a lot of <DllImports> as of late and i was wondering if
> anyone could tell me a good tutorial/website/articles/books
> that explains what System.Marshal** actually does and how to make those
> structures that some windows api methods need passed in/out.
>
> So far i've used mostly methods that send in/out strings, bool, integer
> and so on, easy to convert into CLR types, but some methods need
> structures and some of these have quite some exotic <parameters> set. How
> do people know when that is needed to be set is a mystery to me (i would
> like to learn it).
>
> Example:
>
> <StructLayout(LayoutKind.Sequential)> _
> Public Structure StartUpInfo
>    Public cb As Integer
>    <MarshalAs(UnmanagedType.LPTStr)> Public lpReserved As String
>    <MarshalAs(UnmanagedType.LPTStr)> Public lpDesktop As String
> ...
>
>
>
> this article was great:
> http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/03/07/NET/toc.asp
>
>