By Radu Braniste Go to page: 1 2 Next The following is a non-exhaustive list of recurring idioms in BREW, considered mainly from a C++ perspective. This is by no means a new enterprise, but the existing information is mostly scattered in articles, the BREW Forum[1], or knowledge bases[2][3]. The initial title was "Design Patterns in BREW," but the term "idiom" was finally preferred, largely because idioms are defined as low-level patterns specific to one language and this is exactly...
Static Constructors in Managed C++
August 21st, 2008
By Kate Gregory I have a pet peeve. I hate to read "C++ doesn't have but C# does." Or sometimes it's worded ", which was always missing from C++, is now in C#." These annoy me because, while they are technically true, they are not usefully true. The feature under discussion may not be part of Standard C++, but if it's part of Managed C++, why go to C# to have it? If you're willing to target the .NET Framework and write a managed application, why not write in...
Managed C++: Read and Write Registry Keys and Values
August 21st, 2008
By Tom Archer 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. This article illustrates the following common registry tasks ( Figure 1 shows the mixed-mode MFC/.NET demo...
Generate Custom Managed C++ Wrappers for Easier COM Interoperation Using DCOMSuds
August 20th, 2008
Vishwas Lele This article assumes you're familiar with .NET, C++, and COM Level of Difficulty 1 2 3 Download the code for this article: DCOMSuds.exe (296KB) SUMMARY Now that you're writing managed code, you'll certainly want to use your existing COM components, but you can't simply call them directly. Instead, you have to wrap the COM component in a runtime-callable wrapper that acts as a proxy between the component and your managed code. While the CLR provides wrapper classes for this...
Visual C++ and CodeDom
August 20th, 2008
By Nick Wienholt Go to page: 1 2 Next 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. CodeDom is the technology that...
Microsoft Extensions to C and C++
August 20th, 2008
The following are Visual C++ extensions to the ANSI C and ANSI C++ standards: Keywords Microsoft extends the C++ language with several additional keywords. For a complete list, see C++ Keywords in the C++ Language Reference. Keywords with two leading underscores are Microsoft extensions. Out of Class Definition of static const Integral (or enum) Members Under the standard (/Za), you need to make an out-of-class definition for data members. For example, class CMyClass { static const int...
Managed C++: Read Image Data Using the ADO.NET DataReader
August 20th, 2008
By Tom Archer Go to page: 1 2 Next One of the first tasks I encountered when I started working with Managed C++ and ADO.NET was that of reading image data from a SQL Server database and then either saving or displaying the images. As an example, the standard SQL Server Northwind database has a table ( Employees ) that includes a Binary Large Object ( BLOB ) column that contains the image data for each employee. This article first lists the steps for reading this data using the .NET...
Function Pointers, part 2
August 20th, 2008
( Page 1 of 4 ) In the previous article, Jun Nakamura introduced you to the use of regular function pointers, but when you write C++ code, you will be interested in C++ class member function pointers too. It is time to look at how to declare pointers to the members of classes you write for your applications. Class Member Function Pointer Syntax The declaration of a C++ member function pointer is a bit trickier than the regular ones we have seen so far and I have to say they look pretty...
A comparison of C/C++ and C#
August 20th, 2008
Author John Godel Introduction You should know that many C/C++ developers have been asking this question: Is C# a new programming language or a new version of C/C++. My answer to both questions is that none of these definitions is true. Well, in this article I'm going to go under the hood and show you that C# is a cocktail of Java, C, C++ and Delphi/C++ Builder from Borland. Let's first take a look what C# programming language really is. What really is C#? " John H. GODEL has an...
Temporary Variables: Temporaries Are Not Necessarily Evil
August 20th, 2008
( Page 1 of 4 ) In earlier articles, we learned about the problems the passing of objects by value can cause in C++. Returning objects by value, on the other hand, is not necessarily evil. Jun Nakamura explains the finer points. A thing may look specious in theory and yet be ruinous in practice; A thing may look evil in theory, and yet be in practice excellent. [Edmund Burke 1729-1797] Finding the Closest Enemy In the first article I made my first attempt to write a function that could...