Forward Declaration for a Class from a Namespace

Suppose you have a class declare in a namespace, like this: #pragma once namespace Test { class foo { public: foo(void); ~foo(void); }; }; #include “foo.h” namespace Test { foo::foo(void) { } foo::~foo(void) { } }; And you want to use that foo class in a another class, with a forward declaration: #pragma once class … Read more

C# ListBox with Variable Height Items

Suppose you need a ListBox that has to display items with the text spread across multiple lines. With the default implementation that would look like this: The CR LF characters are displayed as squares and the item has only one line of text. To make the list box items have variable height depending on the … Read more

STL string utils

STL’s std::string doesn’t have methods for transforming the string to upper or lower case or for trimming (as other string implementations, such as CString, have). I’ve noticed that many people don’t know how to implement such functions, so I’ll show you here how to do that. class stringutils { public: static void make_upper(std::string& text) { … Read more

Release of Visual Studio 2008

Microsoft announced yesterday that it released VS 2008 to manufacturing. For now, it is only available for MSDN subscribers. The official public release will happen on February 27, 2008 at Los Angeles. You can have an overview of the product here. You can read more about the product on the home page.

Create a font with the desired size

Let’s asume you want to change the font of a window\control and for the sake of simplicity let’s consider an MFC dialog application. In that case, there are several steps you should follow: declare a CFont variable in the dialog class create the font in OnInitDialog (using CreateFont) set the font to the control (using … Read more

Launch of Visual Studio 2008

A couple of days ago, Somasegar has announced that Microsoft is on track to release Visual Studio 2008 before the end of November 2007. On the other hand, the marketing release will take place on Februarie 27, 2008 in Los Angeles, along with Windows Server 2008 and SQL Server 2008. You can read the announcement on … Read more

F# integrated in Visual Studio

One week ago, Somasegar (Corporate VP for the Microsoft Developer Division) wrote on his blog that Microsoft will integrate F# (a functional language) in Visual Studio. We will be partnering with Don Syme and others in Microsoft Research to fully integrate the F# language into Visual Studio and continue innovating and evolving F#. In my … Read more

Source Code for the .NET Framework Libraries

Scott Guthrie announced today that Microsoft will release (under the Microsoft Reference License) the source code for the .NET Framework libraries, including: .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc) ASP.NET (System.Web) Windows Forms (System.Windows.Forms) ADO.NET (System.Data) XML (System.Xml) WPF (System.Windows) More than that, Visual Studio 2008 will provide … Read more

RO: Bunatatile din arca Microsoft

In toamna aceasta Microsoft va distribui 100.000 de exemplare din Academic Resource Kit (sau simplu ARK), un DVD continand o colectie de instrumente educationale gratis. Aceste instrumente sunt disponibile pentru descarcare gratis si pe site-ul Microsoft, dar astfel sunt disponibile si celor carora le este mai greu sa le obtina online. DVD-ul contine urmatoarele instrumente: … Read more

Beware of Sequence Points

Consider the following C++ code: void foo(int a, int b, int c) { std::cout << a << ‘ ‘ << b << ‘ ‘ << c << std::endl; } int main(int argc, char* argv[]) { int value = 1; foo(value++, value++, value++); return 0; } That looks pretty straight-forward: there is a function that takes … Read more