Current area: HOME -> .NET -> Visual C++.NET Articles
Visual C++.NET
A rational attempt to substantiate C++/CLI as a first class CLI language
This article is not an attempted glamorization of the C++/CLI language semantics and there will be no stabs at other languages like C# or VB.NET, rather, this is just an unofficial endeavor, by a non-Microsoft-employee who loves the language, to substantiate the fact that C++/CLI has its own unique role to play as a first-class .NET programming language.
Accessing legacy data in a .NET environment
An article on how to access data from fixed size record data from the .NET environment. Access to legacy data is very often required. Unless developing a new system from zero or using a data abstraction layer (a database system for example), you cant avoid the need to import and possibly export legacy data.
Automate Resource Management with shared_ptr
Your days of being frustrated by std::auto_ptr's limitations are over. The Library Extensions Technical Report 1 has added a new smart pointer class to the standard <memory> header. Find out how you can use shared_ptr to automate resource management and simplify common programming tasks.
Breaking Changes in Visual C++ 2005
There are a number of changes that you can expect to see in Microsoft Visual C++ 2005. In this article, I present a number of changes that can already be found in Visual C++ 2005 that you may encounter when upgrading your own programs.
C++/CLI Properties - Syntactic sugar for accessor methods
Properties are entities that behave like fields but are internally handled by getter and setter accessor functions. They can be scalar properties (where they behave like a field) or indexed properties (where they behave like an array). Looks at the syntax for the declaration and use of properties in C++/CLI.
Call a Parameterized Stored Procedure by Using ADO .NET
This article demonstrates the last three methods and uses both the SqlCommand and the OleDbCommand objects. Make sure that you copy only the code for the managed provider that you are using.
Calling Managed Code from Unmanaged Code and vice-versa
Microsoft lets you call COM code from .NET code using RCW (Runtime Callable Wrappers). The RCW, a managed wrapper code, wraps the COM component. The .NET code then interacts with the RCW which in turn interacts with the COM component inside it. The reverse communication can be done using CCW (COM callable wrapper). This article shows a way of manually creating a wrapper. It was fairly easy to call the unmanaged code from the managed code but not the other way around.
Composite Custom Web Controls in Managed C++
The first two installments of this series got your feet wet in custom Web control development. The first covered some of the prep work required for setting up a Managed C++ custom Web control development environment. The second showed how to create a superclassed custom Web control, the simplest of the three types of custom Web controls.
Create a Serviced .NET Component in Visual C++ .NET
This step-by-step article demonstrates how to create a serviced .NET component that uses transactions. This article also demonstrates how to create a client that tests your serviced component. Microsoft Enterprise Services provides Microsoft COM+ services to .NET components.
DeviceIoControl & USB using Managed C++ & C#
Low level I/O is not part of the .NET framework, so information on how its done is difficult to find. Since I am using some specialized hardware, which won't be available to most C# developers, my comments will focus on interoperability with unmanaged code.
Empower Your Printing with Custom Print Processors
Using Custom Print Processors is one of the many ways to take control of the printing process. Find out how to use this user-mode DLL and C/C++ to enforce security policies, add missing printing functionality, or alter print jobs.
Execute SQL Parameterized Stored Procedures
This step-by-step article describes how to call a parameterized Microsoft SQL Server stored procedure using the Open Database Connectivity (ODBC) .NET managed provider and Microsoft Visual C++ .NET.
Function pointers and Delegates
Explains the usage of the Marshal class methods GetFunctionPointerForDelegate and GetDelegateForFunctionPointer, and compares their performance with the P/Invoke mechanism.
How to use Managed C++ to Automate Excel
The purpose of this article is to show you how I got Excel to work using MC++ in a Windows Forms application, so Im not going to try and make this example very elaborate. Ill be using made-up data in an imaginary circumstance. We will create a .NET Windows Forms application and put a button on the form that will cause Excel to run and display a Workbook with three Worksheets. Ill show you a way to delete and add Worksheets to the Workbook and a way to create bar charts and line charts and place them and their supporting data onto a Worksheet.
HOW TO: Use a DataReader Against an Oracle Stored Procedure
This step-by-step article uses the DataReader object to retrieve data from an Oracle stored procedure. You can use the DataReader to retrieve a read-only, forward-only stream of data from a database. Using the DataReader can increase application performance and reduce system overhead because only one row is ever in memory.
Introduction to C++/CLI Generics
Before version 2.0, the .NET framework supported the Universal Type Container Model, in which objects are stored in a uniform manner. The universal type container in the Common Type System is Object and all types are derived either directly or indirectly from it. Version 2.0 of the framework supports a second model.
Managed C++ - Learn by Example
This article will teach you MC++ in a direct and experiential manner. I don't claim you will learn everything, but you will get to know the essentials and then you can continue on your own. This article can be considered as a quick reference for a lot of things you're going to need through your work.
Managed C++ wrapper for ZLib
This article presents a namespace of managed types that provide a wrapper to some of the standard functionalities exported by ZLib. ZLib is a well known free, general-purpose lossless data-compression library for use on any operating system.
Managed C++: Debugging with the StackTrace Class
By Tom Archer As a C++ developer, you're more accustomed than most to looking at the call stack during your debugging sessions. As an extension of that, many times you need a way to programmatically retrieve stack information during the execution of your application. Unfortunately, for a long time the best you had for this task was the standard __FILE__ and __LINE__ directives.
Managed C++: Loading and Displaying Images
One of the biggest drawbacks of programming in Visual C++/MFC was its lack of support for even the most basic of imaging functions such as loading and displaying an image. Therefore, this article illustrates how incredibly easy .NET makes displaying a user-selected image and allowing the user to dynamically resize that image.
Managed C++: Loading and Displaying Images
One of the biggest drawbacks of programming in Visual C++/MFC was its lack of support for even the most basic of imaging functions such as loading and displaying an image. Therefore, this article illustrates how incredibly easy .NET makes displaying a user-selected image and allowing the user to dynamically resize that image.
Managed C++: Read and Write Registry Keys and Values
Programmatically accessing the Windows registry has always been a bit of a convoluted task. For this reason, a myriad C++ classes have been created over the years to enable easier and more intuitive access to the registry from Windows applications. Thankfully, the task of reading and writing registry keys and values is monumentally easier with the .NET framework.
Manipulate XML Documents in C++ with xmlbeansxx
Using XML processing typically simplifies a developer's job--but not when you're programming in c++. Ever wish someone would create the create the C++ equivalent of XMLBeans? Someone has. Find out how this new open source tool fills a serious gap in the C++ software environment.
Member Function Pointers and the Fastest Possible C++ Delegates
In this article, I'll "lift the lid" on member function pointers. After a recap of the syntax and idiosyncrasies of member function pointers, I'll explain how member function pointers are implemented by commonly-used compilers. I'll show how compilers could implement delegates efficiently. Finally, I will show how I used this clandestine knowledge of member function pointers to make an implementation of delegates that is optimally efficient on most C++ compilers.
MFC 8.0 and Windows Forms Integration, Part I
Windows Forms lacks many of the advanced features of MFC, such as an in-built Document/View Framework and Windows shell integration, which prevents full migration for applications that rely on these features. Even if full framework feature parity existed, porting and testing an application from one framework to another is a massive job. For these reasons, having bridging technologies between the past (MFC) and the future (Windows Forms and Avalon) is very important.
MFC 8.0 and Windows Forms Integration, Part II
Drill down deeper into MFC 8.0 with a look at control placement and event handling, the MFC classes used for the Windows Forms integration, and the Windows Presentation Foundation (formerly known as Avalon).
MFC 8.0 and Windows Forms Integration, Part II
This article builds on the integration story with a look at control placement and event handling, the MFC classes used for the Windows Forms integration, and the Windows Presentation Foundation, the new Windows UI framework formerly known as Avalon.
Mixing Managed and Unmanaged code
C++ managed code introduced us a new string type, namely System.String. You can imagine though, that some conversion functions are needed to work with this new string type when mixing managed and unmanaged code in your project.
Porting Visual C++ Code to Visual Studio 2005
Though the changes in Visual Studio 2005 represent a major improvement over non-compliant hacks that have been in use since the mid-1990s, fear of breaking existing C++ apps has led many project managers to avoid upgrading. This checklist helps you to locate and repair incompliant code so you can upgrade your apps--without breaking them.
Rationale Behind Whidbey C++ Breaking Changes
The explanations, workarounds, scenarios and the rationale behind the decisions to change the Whidbey C++ compiler. Microsoft have made over 20 breaking changes to the C++ compiler for Whidbey. The Microsoft development team would love to get feedback on these changes and so have provided the following explanations, workarounds, scenarios and rationales behind their decision to change the compiler.
STL.NET: Combining Generics and Templates
It has been jokingly suggested that when a C++ programmer is asked how to accomplish a given task, he or she will provide a list of a dozen or more potential solutions, and then proceed to outline the problem with each in excruciating detail. Visual C++ 2005, through the C++/CLI language bindings, introduces the concept of generics, allowing C++ programmers to further enhance their reputation as the programmers with the largest arsenal of language constructs.
STL.NET: Combining Generics and Templates
STL.NET provides a bridge between the worlds of traditional C++ templates and .NET generics. By allowing C++ developers to leverage their STL skills without precluding interaction with developers using other .NET languages, STL.NET promises the best of both worlds.
Superclassed Web Controls in Managed C++
Now, it's time to have fun with Managed C++ and all that prep work from the previous article by actually building some custom Web controls. This article examines the first of the three types of custom Web controls: superclassed.
The MFC CDHtmlDialog class
This sample demonstrates using the new MFC7 CDHtmlDialog class.
A dialog with a simple HTML page is created and displayed, and
events from objects within that page are handled, and the HTML
within the page modified dynamically to respond to these
events.
Using ADO.NET in a managed C++ application
This article demonstrates the basics of accessing a database and retrieving data from that database usingthe ADO.NET data classes.
Using Delegates with Native Function Callbacks in Managed C++
Creating an event-driven architecture is a popular and effective use of delegates. However, another important use for delegates is in the area of callbacks, which this article discusses.
VC++ Cures for .NET Configuration Change Headaches
The inability of the .NET configuration file to reload itself is a major headache in scenarios like this. The only time that the .NET Framework will reload configuration settings is when a new application domain is created.
Visual C++ 2005 IDE Enhancements
Improvements to the IDE are one of the givens in any new release of Visual C++; hence, they are often overlooked. Take a closer look at some of the new features that the Visual C++ 2005 IDE delivers.
Visual C++ 2005 IDE Enhancements
With all the changes to the C++ language, improvements in the IDE have not been given a great deal of attention. Despite the lack of publicity, the IDE improvements are quite significant. They will drastically improve the developer experience on a day-to-day basis. The number of improvements is large and broad everything from enhancements to the Server Explorer through to IntelliSense support for macros, and UML-like Class Diagrams through to support for the new MSBuild build system. This article and future installments will cover all of these exciting new features.
Visual C++ 2005 IDE Enhancements, Part 2
In a continued examination of the new Visual C++ 2005 IDE enhancements, Nick Wienholt looks at the code definition window, changes to class view, and finally one of the big new additions to Visual C++: the class diagram.
Visual C++ 2005 IDE Enhancements, Part 3: MSBuild
MSBuild is one of the major new features in Visual Studio .NET 2005. Discover the motivation for MSBuild, how it works, and how Visual C++ developers can get their hands on it.
Visual C++ 2005 IDE Enhancements, Part 4: Beta 2 Changes
The Visual C++ 2005 IDE team made two painful cuts in Beta 2 related to the Class Designer and IDE Click Once support. Read up on these significant changes and find out how C++/CLI programmers can still take advantage of ClickOnce to deploy their applications.
Visual C++ 2005 IDE Enhancements, Part 5: Variable Display
For complex data types, the traditional display offered by debug windows is inadequate. Visual C++ 2005 makes a dramatic upgrade to the variable display, offering a number of improvements in the way you can examine data during a debug session.
Visual C++ and CodeDom
The types within the System.CodeDom namespace are extremely important to most Managed C++ applications, regardless of whether the code actually uses these types directly. Wizard-generated code has always formed a large part of Visual C++ applications and, by virtue of its multi-language support, .NET needed a technology that separated the definition of logical code graphs from the actual production of source code.
Visual C++: Protecting Against Buffer Overruns With the /GS Switch
This final installment wraps up the coverage of what's new in the IDE with a look at Tracepoints, new project types, enhancements to the Server Explorer, and new functionality for creating C++ projects.
Visual Studio .NET: Managed Extensions Bring .NET CLR Support to C++
If you're a longtime C++ programmer, the thought of migrating to Visual Studio .NET might make you wary at first. However, a new feature of Visual C++, the managed extensions for C++, allows you to build apps with the .NET Framework. When you use managed C++, your code is handled by the common language runtime (CLR). This provides advanced features like garbage collection, interoperability, and more. This article explains why you'd want to use the managed extensions, how to use them, how to mix managed and unmanaged code, and how your managed code can interoperate with programs written in other languages.
Write Image Data Using the ADO.NET Command and Parameter Objects
This article shows the reverse scenario of reading an image file from disk and saving it to a database column by utilizing the SqlCommand and SqlParameter classes. With the various command classes (for example, SqlCommand, OracleCommand, OdbcCommand, and so forth) you easily can insert or modify database records by passing a SQL statement to the command class's constructor (or setting a command object's CommandText property) and then calling one of the command object's "execute" methods, such as ExecuteReader.
Writing Verifiably Type-Safe Code in Visual C++
In the first two releases of Visual Studio.NET, writing verifiably type-safe code with C++ went from impossible to extremely difficult. Thankfully, Visual C++.NET 2005 offers a much better story on verification than the current compiler.
Yet Another C#-style Delegate Class in Standard C++
Delegates and events are definitely cool features of .NET/C# and there are already many attempts to simulate them in standard C++. The Delegate class described in this article tries to provide a complete and easy to use solution for using delegates in standard C++.
Yet Another Generalized Functors Implementation in C++
Generalized functors are important and powerful design artifacts. An excellent introduction in generalized functors idiom, its application and one of the best implementations can be found in [1]. I'll try to retell the primary ideas, concepts and implementation details below with a strong emphasis on the latter as it could be expected from the article title.
Network Magazine Provides information Technology (IT) and network managers with strategic analysis, views of emerging technologies and product reports....
subscribe now