Chapter 19. Deeper Into PInvoke and Useful Examples

In This Chapter

Callbacks

Passing Structures

Handling Variable-Length Structures and Signatures

Using C# Unsafe Code

Guarding Against Premature Garbage Collection

Choosing the DLL Location or Name Dynamically

Example: Responding Immediately to Console Input

Example: Clearing the Console Screen

Example: Using CoCreateInstanceEx to Activate Remote COM Objects

In this chapter, we cover a variety of advanced topics, but focus mainly on two essential topics that weren’t covered in the previous chapter: callbacks and structure marshaling. In examining these topics, we cover useful examples that you might want to copy and paste into your own applications. You can never have too ...

Get .NET and COM: The Complete Interoperability Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.