[Mono-dev] Question on the C->C# translation of WinApi MSG struct.

StApostol stapostol at gmail.com
Mon Sep 24 02:59:40 EDT 2007


Thanks, this makes perfect sense!

On 9/22/07, Mike Edenfield <kutulu at kutulu.org> wrote:
>
>
> The Windows API almost always passes structures like this as
> pointers.  PeekMessage() and all of the GetMessage() calls
> pass an LPMSG parameter, for example.  The only thing the
> unmanaged code inside Windows knows about are the field
> defined in the header, which are accessed as "x number of
> bytes past the pointer value".  As long as any additional
> information is at the end of the structure, Windows will
> ignore it.
>
> In fact, Windows uses this fact itself when new features
> come out, by adding fields to the end of key structures and
> internally using sizeof(blah) to figure out what fields are
> available.
>
> The only thing you would need to watch out for is anything
> that tries to take the size of a struct MSG, but I don't
> know of any Windows API call that does so.
>
> -- Mike
>
> Still using IE? Get Firefox!
> http://www.spreadfirefox.com/?q=affiliates&id=6492&t=1
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070924/4b00b11c/attachment-0001.html 


More information about the Mono-devel-list mailing list