Introduction to C++/CLI 3. What C++/CLI can do for you 6 The rationale behind the new syntax Hello World in C++/CLI 13

Similar documents
C++/CLI in Action NISHANT SIVAKUMAR MANNING. Greenwich (74 w. long.)

Expert C++/CLI:.NET for Visual C++ Programmers

Microsoft Visual C# Step by Step. John Sharp

C# Programming: From Problem Analysis to Program Design. Fourth Edition

CHAPTER 1: INTRODUCING C# 3

Microsoft. Microsoft Visual C# Step by Step. John Sharp

C# Programming in the.net Framework

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

C++\CLI. Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017

Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#)

Programming C# 5.0. Ian Griffiths O'REILLY' Beijing Cambridge * Farnham Kbln Sebastopol Tokyo

Table of Contents Preface Bare Necessities... 17

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

C++/CLI in Action NISHANT SIVAKUMAR MANNING. Greenwich (74 w. long.)

ALPHAPRIMETECH 112 New South Road, Hicksville, NY 11801

Jim Jackson II Ian Gilman

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

.Net. Course Content ASP.NET

Whom Is This Book For?... xxiv How Is This Book Organized?... xxiv Additional Resources... xxvi

C++ (Non for C Programmer) (BT307) 40 Hours

Variable Scope The Main() Function Struct Functions Overloading Functions Using Delegates Chapter 7: Debugging and Error Handling Debugging in Visual

Microsoft Visual Studio 2010

Microsoft.NET Programming (C#, ASP.NET,ADO.NET, VB.NET, Crystal Report, Sql Server) Goal: Make the learner proficient in the usage of MS Technologies

C# in Depth THIRD EDITION

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Object-Oriented Programming in C# (VS 2015)

Apex TG India Pvt. Ltd.

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Dot Net Online Training

"Charting the Course... MOC A Developing Data Access Solutions with Microsoft Visual Studio Course Summary

02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211

CLI and CLR. Antonio Cisternino Giuseppe Attardi

Programming Kotlin. Familiarize yourself with all of Kotlin s features with this in-depth guide. Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI

DOT NET Syllabus (6 Months)

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

CHAPTER 1: INTRODUCTION TO THE IDE 3

Windows Presentation Foundation Programming Using C#

Department of Computer Applications

Top 40.NET Interview Questions & Answers

DOT NET SYLLABUS FOR 6 MONTHS

Effective Unit Testing

Object-Oriented Programming in C# (VS 2012)

The C# Programming Language. Overview

INTRODUCTION TO.NET. Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.)

Visual C# 2008 How to Program, 3/E Outline

Course Hours

C# Syllabus. MS.NET Framework Introduction

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

Programming. Principles and Practice Using C++ Bjarne Stroustrup. / Addison-Wesley. Second Edition

Chapter 1 Getting Started with Windows Presentation Foundation

Team Developer and.net

brief contents PART 1 INTRODUCING WINDOWS PHONE... 1 PART 2 CORE WINDOWS PHONE... 57

JAVA CONCEPTS Early Objects

J, K. Hello World HelloCpp.cpp, 4 retrieve source files, 4 Visual C++ IDE (see Visual C++ IDE) Visual Studio Tools folder, 4

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

Pro XAML with C# From Design to Deployment on WPF, Windows Store, and Windows Phone. Buddy James. Lori Lalonde

Windows 8. Rainer Stropek. System Architecture. System Architecture re of Windows Store Apps. Saves the day. software architects gmbh

TABLE OF CONTENTS PREFACE CHAPTER1 INTRODUCING WINDOWS++ 1

S.Sakthi Vinayagam Sr. AP/CSE, C.Arun AP/IT

Mastering BorlandC++ 4.5

Diploma in Microsoft.NET

Practical C++ Programming

C# in Depth SECOND EDITION JON SKEET. MANNING Greenwich (74 w. long.)

C# 6.0 in a nutshell / Joseph Albahari & Ben Albahari. 6th ed. Beijin [etc.], cop Spis treści

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

UNIT 1 PART A PART B

C # Language Specification

S A M P L E C H A P T E R

Developing Windows Applications with Microsoft Visual Studio 2010

Introduce C# as Object Oriented programming language. Explain, tokens,


Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Level: M.Ed. Credit Hour: 3 (2+1) Semester: Third Teaching Hour: 80(32+48)

Override Control Using Contextual Keywords

Acknowledgments Introduction. Chapter 1: Introduction to Access 2007 VBA 1. The Visual Basic Editor 18. Testing Phase 24

University of West Bohemia in Pilsen. Faculty of Applied Sciences. Department of Computer Science and Engineering DIPLOMA THESIS

HCIM SUMMER WORKSHOP Introduction to C#

DE Developing Windows Applications with Microsoft Visual Studio 2010

John Hunt and Alex McManus. Key Java. Advanced Tips and Techniques


3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

Introduction... xxi. Chapter 1: Introducing Visual Basic In Depth... 2

C++ Coding Standards. 101 Rules, Guidelines, and Best Practices. Herb Sutter Andrei Alexandrescu. Boston. 'Y.'YAddison-Wesley

DEVELOPING WINDOWS APPLICATIONS WITH MICROSOFT VISUAL STUDIO 2010

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 (C#)

.NET FRAMEWORK. Visual C#.Net

The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured

Introduction to Programming Using Java (98-388)

Object-Oriented Programming

Introduction to Microsoft.NET Programming Using Microsoft Visual Studio 2008 (C#) Course Overview. Prerequisites. Audience.

S A M P L E C H A P T E R

SECURED PROGRAMMING IN.NET DETAILED TRAINING CONTENT INDUSTRIAL TRAINING PROGRAM ( )

Visual Basic 2008 How to Program, 4/E Outline

object/relational persistence What is persistence? 5

Module 1. An Introduction to C# Module 2. Classes and Objects. Vasundhara Sector 14-A, Plot No , Near Vaishali Metro Station,Ghaziabad

B.E /B.TECH DEGREE EXAMINATIONS,

C#.NET TRAINING / /

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Absolute C++ Walter Savitch

Developing Windows Applications with Microsoft Visual Studio 2010

Transcription:

contents preface xv acknowledgments xvii about this book xix PART 1 THE C++/CLI LANGUAGE... 1 1 Introduction to C++/CLI 3 1.1 The role of C++/CLI 4 What C++/CLI can do for you 6 The rationale behind the new syntax 8 1.2 Hello World in C++/CLI 13 The /clr compiler option 15 Using VC++ 2005 to create a /clr application 16 1.3 Declaring CLR types 18 Class modifiers 20 CLI types and inheritance 22 1.4 Handles: the CLI equivalent to pointers 24 Syntax for using handles 24 Tracking references 26 1.5 Instantiating CLI classes 28 The gcnew operator 28 Constructors 31 Copy constructors 33 Assignment operators 36 ix

x CONTENTS 2 3 1.6 Boxing and unboxing 38 Implicit boxing in the new syntax 38 Boxing and type-safety 40 Implementation at the MSIL level 41 Assigning null to a boxed value type 43 1.7 Summary 45 Getting into the CLI: properties, delegates and arrays 46 2.1 Properties 47 Scalar Properties 48 Indexed properties 55 2.2 Delegates and events 58 Delegates 59 Events 64 2.3 CLI Arrays 68 Basic CLI array concepts 69 Single-dimensional arrays 70 Multidimensional arrays 71 Jagged arrays 72 Arrays as function arguments 74 Returning arrays from functions 75 Parameter arrays 76 Using System::Array methods 77 Array covariance 80 Arrays of non-cli objects 81 Directly accessing CLI arrays using native pointers 83 2.4 Summary 84 More C++/CLI: stack semantics, function overriding, and generic programming 86 3.1 Stack semantics and deterministic destruction 87 The new destructor and finalizer syntaxes 88 Stack semantics 96 Guidelines for using destructors and stack semantics 101 3.2 Function overriding 102 Explicit overriding 103 Renamed overriding 104 Multiple overriding 105 Sealed and abstract functions 106 3.3 Generics and managed templates 108 Why have parameterized types? 108 Generics syntax for classes and functions 110 Constraint mechanism 113 Issues with the constraint mechanism and simple types 116 Comparison with templates 120 Managed templates 124 3.4 Summary 129

CONTENTS xi PART 2 MIXING MANAGED AND NATIVE CODE... 131 4 5 Introduction to mixed-mode programming 133 4.1 Using interior and pinning pointers 135 Interior pointers 136 Pinning pointers 141 4.2 Working with interop mechanisms 147 Accessing a managed library from native code 148 Accessing a native library from managed code 156 4.3 Using mixed types 162 Native types with managed members 162 Managed types with native members 166 4.4 Function pointers and delegates: bridging the gap 173 Using GetFunctionPointerForDelegate 173 Using GetDelegateForFunctionPointer 175 4.5 Summary 177 Interoping with native libraries from managed applications 179 5.1 Converting between managed and native types 181 Marshalling native strings 181 Marshalling arrays 184 Simulating a native static array with managed code 185 5.2 Double thunking in mixed-mode function calls 186 5.3 Wrapping a native API and exposing a CLI interface 190 Overview of the native API 191 Writing the CLI wrapper 193 5.4 Exposing an MFC extension DLL to.net 206 Overview of the MFC extension DLL 207 Writing the managed regular MFC DLL wrapper 208 5.5 Accessing a COM object via a custom RCW 212 The COM object to interop with 212 Writing the custom RCW 215 Using the custom RCW 218

xii CONTENTS 5.6 Writing a single mixed-mode DLL for both managed and native clients 218 Wrapping the System::Object class 220 Writing derived class wrappers 223 5.7 Summary 227 PART 3 6 7 USING MANAGED FRAMEWORKS FROM NATIVE APPLICATIONS... 229 Interoping Windows Forms with MFC 231 6.1 A simple Windows Forms application 233 6.2 Hosting a Windows Forms control in an MFC dialog 235 6.3 Hosting a Windows Forms control as an MFC view 239 6.4 Giving your MFC apps an Office 2003 style UI 249 6.5 Using a Windows Forms control as an MFC dialog 261 6.6 Using an MFC control in a Windows Forms form 267 The custom MFC control 268 Hosting the MFC control from WinForms 271 Using the wrapped control from a WinForms app 273 6.7 Summary 274 Using C++/CLI to target Windows Presentation Foundation applications 276 7.1 What is WPF? 278 Overview of XAML 280 Anatomy of a simple WPF application 283 7.2 Using C++/CLI to write a WPF application 288 Creating a new C++/CLI Avalon project 289 Using procedural code 289 Dynamically loading XAML 294 Deriving from a class in a C# DLL 297 7.3 A brief look at some WPF Graphics features 300 Using brushes and shapes 300 Transformations 304

CONTENTS xiii 8 7.4 Hosting a WPF control in a native C++ application 310 Using a mixed-mode extension DLL 310 Using a mixed-mode application 319 7.5 Hosting a native control in a WPF application 326 7.6 Summary 331 Accessing the Windows Communication Foundation with C++/CLI 332 8.1 Hello World with the Windows Communication Foundation 334 8.2 Duplex communication in WCF 338 Creating the service 340 Creating the client 342 8.3 Migrating a native DCOM application to WCF 344 The example DCOM server 346 The native MFC client 348 Writing a WCF proxy service 351 Modifying the MFC client to use WCF 356 Writing a pure WCF service 359 Comparison of the two migration methods 362 8.4 Hosting a WCF service in an IIS server 362 8.5 Summary 366 Appendix A concise introduction to the.net Framework 368 index 385