Microsoft Visual C++/CLI Step by Step

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Provides instruction for beginning through advanced users explaining how to use the programming language to build database applications, create a simple Windows store app, and use the Microsoft .NET Framework Class Library.

Author(s): Julian Templeman
Year: 2013

Language: English
Pages: 509

Introduction
Part I: Getting started with C++ .NET
Chapter 1: Hello C++!
What is C++/CLI?
Your first C++/CLI application
The main function
C++ keywords and identifiers
Creating an executable application—theory
Editing the application source files
Compiling the source files
Running and testing the application
Creating an executable application—practice
Creating a project
Editing the C++ source code
Building the executable
Executing the application
Conclusion
Quick reference
Chapter 2: Introducing object-oriented programming
What is object-oriented programming?
Features of object-oriented programming languages
Encapsulation
Inheritance
Polymorphism
Classes and objects
Benefits to the development life cycle
A simple example
Quick reference
Chapter 3: Variables and operators
What is a variable?
The fundamental data types
Declaring a variable
Variable naming
Declaring multiple variables
Assigning values to variables
Handles and pointers
Arrays
Constants
Typedefs
The .NET Framework String class
Operators and expressions
Assignment operators
Arithmetic operators
Relational and logical operators
Bitwise operators
The ternary operator
Type casting
Operator precedence and associativity
Quick reference
Chapter 4: Using functions
Declaring function prototypes
Declaring a simple function prototype
Declaring parameters in a function prototype
Declaring the return type in a function prototype
Declaring default values for function parameters
Defining function bodies
Calling functions
Stepping through the application by using debugger
Understanding local and global scope
Quick reference
Chapter 5: Decision and loop statements
Making decisions by using the if statement
Performing one-way tests
Performing two-way tests
Performing multiway tests
Performing nested tests
Making decisions by using the switch Statement
Defining simple switch statements
Using fall-through in a switch statement
Performing loops
Using while loops
Using for loops
Using do-while loops
Performing unconditional jumps
Quick reference
Chapter 6: More about classes and objects
Organizing classes into header files and source files
Declaring a class in a header file
Implementing a class in a source file
Creating objects
Initializing objects by using constructors
Defining constructors
Member initialization lists
Defining class-wide members
Defining class-wide data members
Defining class-wide member functions
Class constructors
Using constants in classes
Using class-wide constants
Using instance constants
Defining object relationships
Defining the LoyaltyScheme Class
Implementing the LoyaltyScheme class
Creating and using LoyaltyScheme objects
Testing the application
Quick reference
Chapter 7: Controlling object lifetimes
The .NET approach to object lifetimes
Destruction and finalization
Destructors
Finalizers
Implementing the destructor and finalizer for a class
Objects and stack semantics
Copy constructors
Relating objects with stack semantics
Quick reference
Chapter 8: Inheritance
What is inheritance?
Inheritance terminology
Inheritance and code reuse
Designing an inheritance hierarchy
A word on substitutability
Defining a base class
Defining a derived class
Creating derived class objects
Concrete and abstract classes
Overriding member functions
Protected access
Defining sealed classes
Abstract and sealed
Defining and using interfaces
Quick reference
Part II: Microsoft .NET programming basics
Chapter 9: Value types
Reference types and value types
The need for value types
Properties of value types
Structures
Creating and using a simple struct
Investigating the structure
The differences between structures and classes
Implementing constructors for a structure
Using one structure within another
Copying structures
Enumerations
Creating and using an enumeration
Using enumerations in applications
Using memory efficiently
Quick reference
Chapter 10: Operator overloading
What is operator overloading?
What types need overloaded operators?
What can you overload?
Rules of overloading
Overloading operators in managed types
Overloading arithmetic operators
Using static operator overloads
What functions can you overload?
Implementing logical operators
Implementing increment and decrement
Operators and reference types
Guidelines for providing overloaded operators
Quick reference
Chapter 11: Exception handling
What are exceptions?
How do exceptions work?
Exception types
Throwing exceptions
Handling exceptions
Using the try and catch construct
Customizing exception handling
Using the exception hierarchy
Using exceptions with constructors
Nesting and rethrowing exceptions
The finally block
The catch(…) block
Creating your own exception types
Using safe_cast for dynamic casting
Using exceptions across languages
Quick reference
Chapter 12: Arrays and collections
Native C++ arrays
Passing arrays to functions
Initializing arrays
Multidimensional arrays
Dynamic allocation and arrays
Generic types
Managed arrays
The .NET array class
Basic operations on arrays
More advanced array operations
Using enumerators
Other .NET collection classes
The List class
The SortedList class
Generics and templates
The STL/CLR library
Quick reference
Chapter 13: Properties
What are properties?
The two kinds of properties
Implementing scalar properties
Errors in properties
Auto-implemented properties
Read-only and write-only properties
Properties, inheritance, and interfaces
Implementing indexed properties
The Bank example
Creating Account class properties
Adding accounts to the Bank class
Implementing the Add and Remove methods
Implementing an indexed property to retrieve accounts
Quick reference
Chapter 14: Delegates and events
What are delegates?
What is the purpose of delegates?
Defining delegates
Implementing delegates
What are events?
Implementing an event source class
Implementing an event receiver
Hooking it all together
Quick reference
Chapter 15: The .NET Framework class library
What is the .NET Framework?
The Common Language Runtime
The Microsoft Intermediate Language
The Common Type System
The Common Language Specification
The .NET Framework class library
Assemblies
Metadata
The .NET Framework namespaces
Using namespaces in C++ applications
The System namespace
The Collections namespaces
The Collections interfaces
The Diagnostics namespace
The IO namespace
The Windows namespaces
The Net namespaces
The ServiceModel namespaces
The Xml namespaces
The Data namespaces
The Web namespaces
Quick reference
Part III: Using the .NET framework
Chapter 16: Working with files
The System::IO namespace
Implementing text I/O by using readers and writers
Using TextWriter
The FileStream class
Using TextReader
Working with files and directories
Getting information about files and directories
Binary I/O
The BinaryWriter class
The BinaryReader class
Quick reference
Chapter 17: Reading and writing XML
XML and .NET
The .NET XML namespaces
The XML processing classes
Parsing XML by using XmlReader
Parsing XML with validation
Writing XML by using XmlTextWriter
Using XmlDocument
What is the W3C DOM?
The XmlDocument class
The XmlNode class
Quick reference
Chapter 18: Using ADO.NET
What is ADO.NET?
ADO.NET data providers
ADO.NET namespaces
ADO.NET assemblies
Creating a connected application
Connecting to a database
Creating and executing a command
Executing a command that modifies data
Executing queries and processing the results
Creating a disconnected application
Disconnected operation using a DataSet
Quick reference
Chapter 19: Writing a service by using Windows Communication Foundation
What is Windows Communication Foundation?
Distributed systems
Services
Connectivity
The ABCs of WCF
Endpoints
Address
Binding
Contract
Message exchange patterns
Behaviors
Creating a service
Writing a service client
Adding metadata to the service
Accessing a service by using a proxy
Quick reference
Chapter 20: Introducing Windows Store apps
A (brief) history of writing Windows user interface applications
The Win32 API
Microsoft Foundation Classes
Windows Forms
Windows Presentation Foundation
Windows 8 and Windows Store
Which UI library to choose?
Introducing Windows Store apps
Main features of Windows Store apps
Writing a Windows Store app
Creating your first Windows Store app
Examining the project
Introducing XAML
What is XAML?
XAML syntax
XAML controls
Layout controls
Event handling
C++/CX and Windows RT
Windows RT
Metadata
C++/CX syntax
Common namespaces
Quick reference
Chapter 21: More about Windows Store apps
Building the basic calculator
Laying out the number buttons
Handling number input
Adding arithmetic operations
Performing calculations
Testing the calculator
Improving the graphics
Handling different number bases
Using app bars
Adding sharing
Where next?
Quick reference
Part IV: Advanced topics
Chapter 22: Working with unmanaged code
Managed vs. unmanaged code
Mixed classes
The GCHandle type
Pinning and boxing
Interior pointers
Pinning pointers
Boxing and unboxing
Boxing
Unboxing
Using P/Invoke to call functions in the Win32 API
The DllImportAttribute class
Passing structures
Quick reference
Chapter 23: Attributes and reflection
Metadata and attributes
Using ILDASM
Using predefined attributes
The AssemblyInfo.cpp file
Using the predefined attribute classes
Defining your own attributes
Attribute class properties
Design criteria for attribute classes
Writing a custom attribute
Using reflection to obtain attribute data
The Type class
Accessing standard attributes
Accessing custom attribute data
Quick reference
Chapter 24: Living with Component Object Model
COM components and the COM Interop
Using COM components from .NET code
How do RCWs work?
Creating and using RCWs
Handling COM errors
Late binding to COM objects
Using .NET components as COM components
What must .NET types implement to be used as COM objects?
Quick reference
Index