void Nish(char* szBlog);

Nish’s thoughts on MFC, C++/CLI and .NET

void Nish(char* szBlog); header image 4

Entries Tagged as 'VC++ 2005'

Dynamically load a Xaml file from a C++ app

March 25th, 2006 · 6 Comments

While it’s an absolute tragedy that C++ does not directly support compiled Xaml, you can use Xaml dynamically from a C++ Avalon app using XamlReader::Load. Let me show you how to do that, using a simple example. You can create your Xaml file, either using a text editor or using a temporary dummy C# or [...]

[Read more →]

Tags: VC++ 2005 · WPF (Avalon)

Get the Office 2003 style menus/toolbars in your MFC apps using Windows Forms

February 15th, 2006 · 4 Comments

This is my latest Code Project article, and it shows you how to use the Windows Forms 2.0 MenuStrip and ToolStrip controls in your MFC applications to give them an Office 2003 look and feel. These Forms controls are pretty well written, and if you change the XP theme/style, they change accordingly, just like Word [...]

[Read more →]

Tags: C++/CLI · VC++ 2005 · Win32/MFC

VS 2005 Document Explorer never finds anything

February 4th, 2006 · 9 Comments

9 times out of 10, when I select a class name or a keyword and hit F1, the Document Explorer shows me an “Information Not Found” page. But at the same time, the index on the left has selected the topic I am looking for, which means all I need to do is to double [...]

[Read more →]

Tags: VC++ 2005

CCW and returning an array of String^

January 22nd, 2006 · 3 Comments

I was working on an app that uses CCW to access a managed library. One of the methods in the library returns an array<String^>^. The COM version of this method will have a SAFEARRAY** as the [out,retval] parameter. Not having a lot of COM experience, I was pretty surprised to find how little documentation there [...]

[Read more →]

Tags: VC++ 2005

You cannot #include wabdefs.h with VC++ 2005

January 4th, 2006 · 3 Comments

The following code will not compile :- #include <windows.h> #include <wabdefs.h> int main() { return 0; } You’ll get a compiler error (C2371) saying that you are redefining WCHAR. The problem is that wabdefs.h defines WCHAR as a typedef for WORD, while winnt.h defines WCHAR as a typedef for wchar_t. In VC++ 2005, /Zc:wchar_t is [...]

[Read more →]

Tags: VC++ 2005

Article : Using WinForms controls in an MFC dialog

December 20th, 2005 · 2 Comments

After a long gap, I’ve written another article for The Code Project. Using WinForms controls in an MFC dialog The article is a simple introduction to using the CWinFormsControl MFC class to put a Windows Forms control on an MFC dialog.

[Read more →]

Tags: C++/CLI · VC++ 2005

VC++ 2005 and the confusion over its .NET nature

December 7th, 2005 · 4 Comments

Every day, every single day, somebody asks on the Microsoft NGs and the Code Project forums whether she can use VC++ 2005 to write native applications that do not use the .NET Framework. It’s amazing how the confusing naming used by the previous versions, where VC++ 2002 was called VC++.NET 7 and VC++ 2003 was [...]

[Read more →]

Tags: General · VC++ 2005

Speed up mixed mode apps with __clrcall

November 12th, 2005 · 3 Comments

When you compile with /clr and you have a native class in your code (one that’s neither a ref class nor a value class), there are two entry points generated for its methods – a managed entry point and a native entry point. This allows both managed and native callers to call these methods, and [...]

[Read more →]

Tags: C++/CLI · VC++ 2005

Breaking change – OnNcHitTest

September 16th, 2005 · 14 Comments

Alright, this is a really bad one. This line of code :- ON_WM_NCHITTEST() – which was compiling quite okay in VC++ 6 (and VC++ 7.1) suddenly throws this strange error message. error C2440: ‘static_cast’ : cannot convert from ‘UINT (__thiscall CPocket::* )(CPoint)’ to ‘LRESULT (__thiscall CWnd::* )(CPoint)’ And it also has a suggestion to fix [...]

[Read more →]

Tags: C++ · VC++ 2005

Issue with member function pointers and a feature wish

September 16th, 2005 · 1 Comment

I’ve run into more issues than I had expected – here’s another one. Pointers to member functions now require a fully qualified name and you also need to use the & operator. It’s not a big deal really, but if your code uses pointers to members in several places, it’s a bit of a task [...]

[Read more →]

Tags: C++ · VC++ 2005

No more defaulting to int

September 15th, 2005 · 4 Comments

Holy cow! Another one that’s probably going to be a pain in the neck (I am insistent on keeping this blog child-safe which is why I keep using names of the wrong parts of the body as you may have observed). static bBusy = 0; //error C4430: missing type specifier – int assumed. That won’t [...]

[Read more →]

Tags: C++ · VC++ 2005

Scope of for-loop variables

September 15th, 2005 · 6 Comments

I am porting some VC++ 6 code to VC++ 2005 and one major pain in the neck is the for-loop variable scope. The /Zc:forScope compiler option is on by default in VC++ 2005 and I believe it was off by default in VC++ 2003 (though people were advised to turn it on). So, code such [...]

[Read more →]

Tags: C++ · VC++ 2005