Platform Invoke (P/Invoke)

So far, this chapter has covered how to communicate between COM DLLs and managed DLLs in both directions. This next section will discuss how to use managed code to invoke code that exists in unmanaged DLLs that are not registered with COM. Sometimes I feel like an old man describing 8-track tapes to teenagers when I explain to programmers that there are DLLs that have exposed functions but that don't have a visible object hierarchy, nor are they registered with COM or managed by the .NET Framework. I have actually heard people say, “You can actually do that?” Yes. You can indeed do that. In fact, the entire low-level Win32 API does that. The next section of this chapter is all about platform invoke: what it is, how ...

Get Microsoft® Visual C#® .NET 2003 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.