| Acknowledgments | xiii |
| Introduction | xv |
| 1 Managed Types | 1 |
| New Keywords in Visual C++ .NET | 1 |
| MSIL and Native Code | 4 |
| C++ Primitive Types | 7 |
| Managed Types and Value Types | 9 |
| Managed Objects | 10 |
| Value Types | 18 |
| Managed Pointers | 24 |
| Passing by Reference and by Value | 28 |
| Properties | 29 |
| Delegates and Events | 33 |
| Attributes | 38 |
| Managed Interfaces | 45 |
| Managed Strings | 52 |
| Managed Arrays | 56 |
| Exceptions and Managed Code | 65 |
| Implementing .NET Types | 72 |
| Namespaces | 72 |
| Inheritance | 74 |
| Exporting and Importing Types | 76 |
| Casts and Conversions | 82 |
| Managed Operators | 84 |
| Creating and Destroying Objects | 86 |
| Entry Points | 89 |
| 2 Interop | 91 |
| It Just Works! | 93 |
| Native C++ Classes | 93 |
| CRT and Static-Link Libraries | 103 |
| C++ Standard Library | 104 |
| Managed Pointers in Unmanaged Types | 104 |
| Global Methods | 107 |
| Platform Invoke | 109 |
| DllImport | 110 |
| Platform Invoke Under the Covers | 115 |
| Platform Invoke and Parameters | 116 |
| Calling Win32 APIs Using IJW | 124 |
| Marshaling | 129 |
| Exceptions | 133 |
| COM Interop | 135 |
| .NET and COM Objects | 136 |
| Tools | 141 |
| .NET COM Attributes | 144 |
| Interfaces Defined by the .NET Framework | 147 |
| Using COM Types in .NET | 148 |
| Using .NET Types from COM | 150 |
| Exceptions | 151 |
| Marshaling .NET Objects | 152 |
| Threading | 153 |
| COM+ Interop | 154 |
| 3 Delegates and Events | 157 |
| Delegates as Type-Safe Function Pointers | 157 |
| Function Pointers with Unmanaged Code | 158 |
| Function Pointers and Global Functions | 161 |
| Delegates | 162 |
| Dynamic Creation of Delegates | 166 |
| Delegate Parameters | 167 |
| Multicast Delegates | 169 |
| Delegates as Smart Function Pointers | 172 |
| Exceptions and Delegates | 173 |
| Delegates and Interop | 174 |
| Marshaling Delegates | 178 |
| Asynchronous Programming | 179 |
| Parameters and Asynchronous Delegates | 180 |
| Calling Delegates Asynchronously | 181 |
| Asynchronous Calls and Exceptions | 189 |
| Asynchronous Calls and the .NET Framework Class Library | 190 |
| Managed Events | 192 |
| The .NET Framework and Events | 195 |
| Unified Event Model | 196 |
| COM Events | 201 |
| Writing Multithreaded Code | 207 |
| Managed Threads | 207 |
| Thread States | 214 |
| Foreground and Background Threads | 215 |
| Thread Local Data | 216 |
| Threads and Exceptions | 220 |
| Synchronization Objects | 222 |
| Thread Pool | 226 |
| Synchronized Contexts | 228 |
| 4 User Interface Development | 231 |
| Developing Windows Forms with C++ | 231 |
| Components and Containers | 233 |
| Building GUI Applications | 250 |
| Using GDI+ | 253 |
| Graphics Class | 255 |
| Coordinate Structures | 257 |
| Coordinate Transforms | 259 |
| Clipping Regions | 263 |
| Colors | 264 |
| Pens | 265 |
| Brushes | 267 |
| Bitmaps | 268 |
| Cursors | 270 |
| Icons | 271 |
| Text and Fonts | 272 |
| Graphics Paths | 273 |
| Regions | 274 |
| Controls and Forms | 275 |
| Where's the WndProc? | 276 |
| Standard Windows Controls | 281 |
| Exceptions | 282 |
| Events, Properties, and Status | 283 |
| Controls and ActiveX Interfaces | 285 |
| Control Handles | 288 |
| Drag and Drop | 290 |
| Superclassing | 293 |
| Standard Forms | 294 |
| Event Handling Strategies | 295 |
| Using Windows Header Files | 297 |
| Using Managed Resources | 298 |
| Assemblies and Win32 Resources | 299 |
| Managed Resources | 301 |
| Compiled Managed Resources | 302 |
| Localization | 305 |
| 5 Systems Programming | 309 |
| Assemblies | 309 |
| Portable Executable Files | 310 |
| Metadata Directory | 312 |
| Reading Metadata | 314 |
| Assembly Format | 319 |
| Assembly Configuration | 324 |
| Versioning and Fusion | 341 |
| Security | 348 |
| Code Access Security | 349 |
| Role-Based Security | 353 |
| Verifiable Code | 354 |
| Unmanaged .NET Services API | 355 |
| Enumerating Managed Processes | 356 |
| Getting Information About the Garbage Collector | 358 |
| Hosting the .NET Runtime | 359 |
| 6 Building Code with Visual C++ .NET | 363 |
| Visual Studio .NET IDE | 363 |
| Commands | 364 |
| Projects, Solutions, and Configurations | 368 |
| Visual Studio .NET Options | 382 |
| Editing Code | 383 |
| Visual Studio .NET Command Line | 391 |
| The DTE Object | 393 |
| The Visual C++ 7 Libraries | 395 |
| Project Types | 396 |
| Managed Applications | 398 |
| Managed Class Libraries | 401 |
| Managed Object Files and Modules | 402 |
| Makefile Projects | 403 |
| Managed Web Services | 404 |
| Web Service Clients | 408 |
| Comment Web Pages | 409 |
| Compiling Code | 411 |
| Compiler Switches | 411 |
| Linker Switches | 414 |
| Optimization | 415 |
| Build Steps | 415 |
| Examples of Common Solutions | 416 |
| Multiassembly Solutions | 416 |
| Multimodule Solutions | 420 |
| Projects That Use Resources | 420 |
| Solutions That Have Satellite Assemblies | 421 |
| 7 Debugging | 423 |
| Writing Code for Debugging | 424 |
| Debuggable Code | 424 |
| .NET Conditional Code | 427 |
| Tracing Code | 429 |
| Assertions | 444 |
| Symbol Files and Managed Code | 454 |
| Making Code Easier to Debug | 459 |
| Using the Visual Studio .NET Debugger | 460 |
| Locating Assemblies | 460 |
| Starting the Debugger | 462 |
| Debugging Processes | 470 |
| Debugging Mixed Code | 483 |
| Debugging Multithreaded Code | 483 |
| Debugging Across Application Domains | 486 |
| Remote Debugging | 487 |
| Profiling | 491 |
| A .NET Framework Libraries | 501 |
| Strings | 501 |
| Character Characterization | 501 |
| String Routines | 502 |
| Data Conversion | 502 |
| Files and I/O | 503 |
| Stream I/O | 503 |
| Console I/O | 503 |
| Formatted Output | 504 |
| File Handling | 505 |
| Directory Routines | 505 |
| Process and Environment Control | 506 |
| Time | 506 |
| Containers | 507 |
| B Further Resources | 509 |
| Tools | 509 |
| ILDASM | 509 |
| Anakrino | 510 |
| MetaInfo | 510 |
| Rotor | 510 |
| DUMPBIN | 511 |
| PEDump | 511 |
| DbgView | 511 |
| RegMon | 511 |
| Tools Supplied with This Book | 511 |
| Profiler | 511 |
| HexDump | 512 |
| DumpInterfaces | 512 |
| Books | 512 |
| INDEX | 515 |