9781932394818

C++/ CLI in Action

by
  • ISBN13:

    9781932394818

  • ISBN10:

    1932394818

  • Format: Paperback
  • Copyright: 2007-04-01
  • Publisher: Oreilly & Associates Inc
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $7.50
  • Buy New
    $42.49
    Add to Cart Free Shipping

    IN STOCK USUALLY SHIPS IN 24-48 HOURS

Supplemental Materials

What is included with this book?

  • 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.

Summary

C++/CLI connects standard C++ applications to the world of .NET. With C++/CLI, a developer can take a C++ program he's been using for years and give it a snazzy new interface using Windows Presentation Foundation. He can make old business applications talk to new ones using Windows Communication Foundation. C++/CLI in Action shows readers how to bridge the gap between their existing C++ code and the .NET platform. Designed for the huge numbers of developers who already know C++, this book starts by teaching the unique aspects of the C++/CLI language. After a quick tour through the basics, readers work through examples integrating standard C++ into .NET-based applications and learn to build programs that mix C++ and .NET code for maximum performance and efficiency.

Author Biography

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.

Table of Contents

Prefacep. xv
Ac1nowledgmentsp. xvii
About this bookp. xix
The C++/CLI Languagep. 1
Introduction to C++/CLIp. 3
The role of C++/CLIp. 4
What C++/CLI can do for youp. 6
The rationale behind the new syntaxp. 8
Hello World in C++/CLIp. 13
The /clr compiler optionp. 15
Using VC++ 2005 to create a /clr applicationp. 16
Declaring CLR typesp. 18
Class modifiersp. 20
CLI types and inheritancep. 22
Handles: the CLI equivalent to pointersp. 24
Syntax for using handlesp. 24
Tracking referencesp. 26
Instantiating CLI classesp. 28
The gcnew operatorp. 28
Constructorsp. 31
Copy constructorsp. 33
Assignment operatorsp. 36
Boxing and unboxingp. 38
Implicit boxing in the new syntaxp. 38
Boxing and type-safetyp. 40
Implementation at the MSIL levelp. 41
Assigning null to a boxed value typep. 43
Summaryp. 45
Getting into the CLI: properties, delegates and arraysp. 46
Propertiesp. 47
Scalar Propertiesp. 48
Indexed propertiesp. 55
Delegates and eventsp. 58
Delegatesp. 59
Eventsp. 64
CLI Arraysp. 68
Basic CLI array conceptsp. 69
Single-dimensional arraysp. 70
Multidimensional arraysp. 71
Jagged arraysp. 72
Arrays as function argumentsp. 74
Returning arrays from functionsp. 75
Parameter arraysp. 76
Using System::Array methodsp. 77
Array covariancep. 80
Arrays of non-CLI objectsp. 81
Directly accessing CLI arrays using native pointersp. 83
Summaryp. 84
More C++/CLI: stack semantics, function overriding, and generic programmingp. 86
Stack semantics and deterministic destructionp. 87
The new destructor and finalizer syntaxesp. 88
Stack semanticsp. 96
Guidelines for using destructors and stack semanticsp. 101
Function overridingp. 102
Explicit overridingp. 103
Renamed overridingp. 104
Multiple overridingp. 105
Sealed and abstract functionsp. 106
Generics and managed templatesp. 108
Why have parameterized types?p. 108
Generics syntax for classes and functionsp. 110
Constraint mechanismp. 113
Issues with the constraint mechanism and simple typesp. 116
Comparison with templatesp. 120
Managed templatesp. 124
Summaryp. 129
Mixing Managed and Native Codep. 131
Introduction to mixed-mode programmingp. 133
Using interior and pinning pointersp. 135
Interior pointersp. 136
Pinning pointersp. 141
Working with interop mechanismsp. 147
Accessing a managed library from native codep. 148
Accessing a native library from managed codep. 156
Using mixed typesp. 162
Native types with managed membersp. 162
Managed types with native membersp. 166
Function pointers and delegates: bridging the gapp. 173
Using GetFuctionPointerForDelegatep. 173
Using GetDelegateForFunctionPointerp. 175
Summaryp. 177
Interoping with native libraries from managed applicationsp. 179
Converting between managed and native typesp. 181
Marshalling native stringsp. 181
Marshalling arraysp. 184
Simulating a native static array with managed codep. 185
Double thunking in mixed-mode function callsp. 186
Wrapping a native API and exposing a CLI interfacep. 190
Overview of the native APIp. 191
Writing the CLI wrapperp. 193
Exposing an MFC extension DLL to .NETp. 206
Overview of the MFC extension DLLp. 207
Writing the managed regular MFC DLL wrapperp. 208
Accessing a COM object via a custom RCWp. 212
The COM object to interop withp. 212
Writing the custom RCWp. 215
Using the custom RCWp. 218
Writing a single mixed-mode DLL for both managed and native clientsp. 218
Wrapping the System::Object classp. 220
Writing derived class wrappersp. 223
Summaryp. 227
Using Managed Frameworks from Native Applicationsp. 229
Interoping Windows Forms with MFCp. 231
A simple Windows Forms applicationp. 233
Hosting a Windows Forms control in an MFC dialogp. 235
Hosting a Windows Forms control as an MFC viewp. 239
Giving your MFC apps an Office 2003 style UIp. 249
Using a Windows Forms control as an MFC dialogp. 261
Using an MFC control in a Windows Forms formp. 267
The custom MFC controlp. 268
Hosting the MFC control from WinFormsp. 271
Using the wrapped control from a WinForms appp. 273
Summaryp. 274
Using C++/CLI to target Windows Presentation Foundation applicationsp. 276
What is WPF?p. 278
Overview of XAMLp. 280
Anatomy of a simple WPF applicationp. 283
Using C ++/CLI to write a WPF applicationp. 288
Creating a new C++/CLI Avalon projectp. 289
Using procedural codep. 289
Dynamically loading XAMLp. 294
Deriving from a class in a C# DLLp. 297
A brief look at some WPF Graphics featuresp. 300
Using brushes and shapesp. 300
Transformationsp. 304
Hosting a WPF control in a native C++ applicationp. 310
Using a mixed-mode extension DLLp. 310
Using a mixed-mode applicationp. 319
Hosting a native control in a WPF applicationp. 326
Summaryp. 331
Accessing the Windows Communication Foundation with C++/CLIp. 332
Hello World with the Windows Communication Foundationp. 334
Duplex communication in WCFp. 338
Creating the servicep. 340
Creating the clientp. 342
Migrating a native DCOM application to WCFp. 344
The example DCOM serverp. 346
The native MFC clientp. 348
Writing a WCF proxy servicep. 351
Modifying the MFC client to use WCFp. 356
Writing a pure WCF servicep. 359
Comparison of the two migration methodsp. 362
Hosting a WCF service in an IIS serverp. 362
Summaryp. 366
A concise introduction to the .NET Frameworkp. 368
Indexp. 385
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Write a Review