December 5, 2006

How to use a new (Vista) PSDK with ATL/MFC applications

After installing the new PSDK for Vista I encountered a problem: I was not able to use the new “NTDDI_VERSION” macro to set my supported OS environment / functions.
The problem is that the stdafx.h defines the WINVER, _WIN32_WINNT and _WIN32_IE. It does not know about the new “NTDDI_VERSION” macro. You also can not include “windows.h” before you have included afx.h (if you do so, this will generate an error in afxv_w32.h:16).
So how to use the new “NTDDI_VERSION” macro?

The answer is simply: You just need to include “sdkddkver.h” after defining the approriate value for “NTDDI_VERSION” in your stdafx.h.
For example you should do the following at the top of stdafx.h right after ”#pragma once” if you want develop for Vista:

 #define NTDDI_VERSION NTDDI_LONGHORN

#include <sdkddkver.h>

Of course: I assume that you have successfully integrated the new PSDK with VS2005! For this you need to execute ”\Program Files\Microsoft SDKs\Windows\v6.0\Setup\VCIntegrate.exe” with admin privileges after you have successfully installed VS2005 (and at least executed it once).


Posted 1 year ago on December 5, 2006
The trackback url for this post is http://blog.kalmbachnet.de/bblog/trackback.php/94/

Comments have now been turned off for this post