Nishant Sivakumar has been programming since 19909, and has extensive experience with Visual C++, MFC, C#, and the .NET Framework. Nish has been a Microsoft Visual C++ MVP since 2002, and maintains an MVP tips and tricks website (www.voidnish.com) along with a Microsoft Technology blog (blog.voidnish.com). He works for The Code Project and is in charge of the MFC libraries Ultimate Toolbox, Ultimate Grid and Ultimate TCP/IP products sold through The Code Project Storefront. Nish has been working with Microsoft Technologies since the DOS days and is currently exploring .NET 3.0 technologies such as WPF and WCF. Nish loves reading Science Fiction, P G Wodehouse and Agatha Christie. In addition to C++/CLI in Action, Nish has authored Extending MFC applications with the .NET Framework as well as Summer Love and Some More Cricket, a romantic comedy. Presently, he lives in Toronto with his loving wife Smitha.
Preface | p. xv |
Ac1nowledgments | p. xvii |
About this book | p. xix |
The C++/CLI Language | p. 1 |
Introduction to C++/CLI | p. 3 |
The role of C++/CLI | p. 4 |
What C++/CLI can do for you | p. 6 |
The rationale behind the new syntax | p. 8 |
Hello World in C++/CLI | p. 13 |
The /clr compiler option | p. 15 |
Using VC++ 2005 to create a /clr application | p. 16 |
Declaring CLR types | p. 18 |
Class modifiers | p. 20 |
CLI types and inheritance | p. 22 |
Handles: the CLI equivalent to pointers | p. 24 |
Syntax for using handles | p. 24 |
Tracking references | p. 26 |
Instantiating CLI classes | p. 28 |
The gcnew operator | p. 28 |
Constructors | p. 31 |
Copy constructors | p. 33 |
Assignment operators | p. 36 |
Boxing and unboxing | p. 38 |
Implicit boxing in the new syntax | p. 38 |
Boxing and type-safety | p. 40 |
Implementation at the MSIL level | p. 41 |
Assigning null to a boxed value type | p. 43 |
Summary | p. 45 |
Getting into the CLI: properties, delegates and arrays | p. 46 |
Properties | p. 47 |
Scalar Properties | p. 48 |
Indexed properties | p. 55 |
Delegates and events | p. 58 |
Delegates | p. 59 |
Events | p. 64 |
CLI Arrays | p. 68 |
Basic CLI array concepts | p. 69 |
Single-dimensional arrays | p. 70 |
Multidimensional arrays | p. 71 |
Jagged arrays | p. 72 |
Arrays as function arguments | p. 74 |
Returning arrays from functions | p. 75 |
Parameter arrays | p. 76 |
Using System::Array methods | p. 77 |
Array covariance | p. 80 |
Arrays of non-CLI objects | p. 81 |
Directly accessing CLI arrays using native pointers | p. 83 |
Summary | p. 84 |
More C++/CLI: stack semantics, function overriding, and generic programming | p. 86 |
Stack semantics and deterministic destruction | p. 87 |
The new destructor and finalizer syntaxes | p. 88 |
Stack semantics | p. 96 |
Guidelines for using destructors and stack semantics | p. 101 |
Function overriding | p. 102 |
Explicit overriding | p. 103 |
Renamed overriding | p. 104 |
Multiple overriding | p. 105 |
Sealed and abstract functions | p. 106 |
Generics and managed templates | p. 108 |
Why have parameterized types? | p. 108 |
Generics syntax for classes and functions | p. 110 |
Constraint mechanism | p. 113 |
Issues with the constraint mechanism and simple types | p. 116 |
Comparison with templates | p. 120 |
Managed templates | p. 124 |
Summary | p. 129 |
Mixing Managed and Native Code | p. 131 |
Introduction to mixed-mode programming | p. 133 |
Using interior and pinning pointers | p. 135 |
Interior pointers | p. 136 |
Pinning pointers | p. 141 |
Working with interop mechanisms | p. 147 |
Accessing a managed library from native code | p. 148 |
Accessing a native library from managed code | p. 156 |
Using mixed types | p. 162 |
Native types with managed members | p. 162 |
Managed types with native members | p. 166 |
Function pointers and delegates: bridging the gap | p. 173 |
Using GetFuctionPointerForDelegate | p. 173 |
Using GetDelegateForFunctionPointer | p. 175 |
Summary | p. 177 |
Interoping with native libraries from managed applications | p. 179 |
Converting between managed and native types | p. 181 |
Marshalling native strings | p. 181 |
Marshalling arrays | p. 184 |
Simulating a native static array with managed code | p. 185 |
Double thunking in mixed-mode function calls | p. 186 |
Wrapping a native API and exposing a CLI interface | p. 190 |
Overview of the native API | p. 191 |
Writing the CLI wrapper | p. 193 |
Exposing an MFC extension DLL to .NET | p. 206 |
Overview of the MFC extension DLL | p. 207 |
Writing the managed regular MFC DLL wrapper | p. 208 |
Accessing a COM object via a custom RCW | p. 212 |
The COM object to interop with | p. 212 |
Writing the custom RCW | p. 215 |
Using the custom RCW | p. 218 |
Writing a single mixed-mode DLL for both managed and native clients | p. 218 |
Wrapping the System::Object class | p. 220 |
Writing derived class wrappers | p. 223 |
Summary | p. 227 |
Using Managed Frameworks from Native Applications | p. 229 |
Interoping Windows Forms with MFC | p. 231 |
A simple Windows Forms application | p. 233 |
Hosting a Windows Forms control in an MFC dialog | p. 235 |
Hosting a Windows Forms control as an MFC view | p. 239 |
Giving your MFC apps an Office 2003 style UI | p. 249 |
Using a Windows Forms control as an MFC dialog | p. 261 |
Using an MFC control in a Windows Forms form | p. 267 |
The custom MFC control | p. 268 |
Hosting the MFC control from WinForms | p. 271 |
Using the wrapped control from a WinForms app | p. 273 |
Summary | p. 274 |
Using C++/CLI to target Windows Presentation Foundation applications | p. 276 |
What is WPF? | p. 278 |
Overview of XAML | p. 280 |
Anatomy of a simple WPF application | p. 283 |
Using C ++/CLI to write a WPF application | p. 288 |
Creating a new C++/CLI Avalon project | p. 289 |
Using procedural code | p. 289 |
Dynamically loading XAML | p. 294 |
Deriving from a class in a C# DLL | p. 297 |
A brief look at some WPF Graphics features | p. 300 |
Using brushes and shapes | p. 300 |
Transformations | p. 304 |
Hosting a WPF control in a native C++ application | p. 310 |
Using a mixed-mode extension DLL | p. 310 |
Using a mixed-mode application | p. 319 |
Hosting a native control in a WPF application | p. 326 |
Summary | p. 331 |
Accessing the Windows Communication Foundation with C++/CLI | p. 332 |
Hello World with the Windows Communication Foundation | p. 334 |
Duplex communication in WCF | p. 338 |
Creating the service | p. 340 |
Creating the client | p. 342 |
Migrating a native DCOM application to WCF | p. 344 |
The example DCOM server | p. 346 |
The native MFC client | p. 348 |
Writing a WCF proxy service | p. 351 |
Modifying the MFC client to use WCF | p. 356 |
Writing a pure WCF service | p. 359 |
Comparison of the two migration methods | p. 362 |
Hosting a WCF service in an IIS server | p. 362 |
Summary | p. 366 |
A concise introduction to the .NET Framework | p. 368 |
Index | p. 385 |
Table of Contents provided by Ingram. All Rights Reserved. |
The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.