MFC Feature Pack

At the beginning of January, Microsoft released a beta version of MFC Feature Pack, an exstension to the MFC shipped with Visual Studio 2008. This feature pack allows developers to create applications with the look and feel of Office, Visual Studio and Internet Explorer. MFC application can now support: Office Ribbon Office 2003, XP and…

Convert.ToInt32 versus TryParse

There are two way of converting strings to numerical values in .NET. The first one, supported since the first version of the platform, is the use of System.Convert class. It has methods like ToInt32, ToChar, ToDouble, ToDataTime, ToDecimal, etc. Here is an example of converting string “123” to numerical value 123.

The catch with…

CategoriesC#

Visual Studio Gallery

Microsoft launched yesterday Visual Studio Gallery, a site hosting Visual Studio extensions. Currently, there are over 350 such extension, free or per charge. The extension include macros, add-ins, packages, project templates. A good thing is that anybody can contribute with content to this gallery. There are some very good extensions available in the gallery. You…

Microsoft DreamSpark

Recently Microsoft launched a program called DreamSpark addressed to students from all over the world (though currently the program is available only in 10 countries) that allows them to used for free software created by Microsoft. This includes: development tools: Visual Studio 2005 Professional Edition Visual Studio 2008 Professional Edition XNA Game Studio 2.0, 12-month…

Microsoft Office Binary File Formats

Last week Microsoft published the 97- 2007 binary file formats for Word, Excel, PowerPoint and Drawing. They can be downloaded from here. Joel Spolsky has a very good article on the subject. A normal programmer would conclude that Office’s binary file formats: are deliberately obfuscated are the product of a demented Borg mind were created…

Forward Declaration for a Class from a Namespace

Suppose you have a class declare in a namespace, like this:

And you want to use that foo class in a another class, with a forward declaration:

Most likely you’ll get some errors, like this (issues by VS2008 compiler) error C2872: ‘foo’ : ambiguous symbol error C2512: ‘foo’ : no appropriate…

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…

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.

You can use it like this: