Dealing with DllImport
In the Dealing with DllImport article, Martin Heller mentions "we specified
the ANSI form of the API function, so that it would work both on the Windows
9x and NT families." without pointing out the power of the Auto option (Not
sure of the C# specifics).
Declare Auto Function GetPrivateProfileSectionNames ...
will mean the runtime will check for the best available API when it is first
used. (If you watch an API profiler as is part of the more recent versions of
the "View Dependencies" tool, you see it checks for
GetPrivateProfileSectionNames, GetPrivateProfileSectionNamesW and
In the context of the article, there may be a need for an ANSI output, but
that would have been better specified using a MarshalAs attribute.
I'm quoting from
Mark Hurd, B.Sc.(Ma.) (Hons.)\
Re: Dealing with DllImport
>I'm quoting from
Terrible article. There were a number of other errors you could have
mentioned in addition to this one.
The author probably got some of his poor practices from Russel Jones'
article, where many of the same mistakes are made (they didn't even
get the title right).
Mattias Sjögren (VB MVP)
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center