Click here to Skip to main content
13,902,007 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 19 Jul 2012
Licenced CPOL

WTL Setup Gotchas

, 7 May 2013
Rate this:
Please Sign up or sign in to vote.
Tips for VC++ 2010 Express users on 64bit Windows.


As there is little information (or many obsolete/misleading articles), this is to make life easier for those who want to setup WTL on 64bit Windows and VC++ Express Edition.


(In the brackets, there is the author's configuration.)

  • VC++ Express Edition (VC++ 2010 Express)
  • 64 bit Windows (Windows 7 Home Premium)
  • WTL (WTL 8.1)

ATL Headers

If you have only the free edition of Visual Studio (Express), it comes without ATL headers. After some Googling, you will probably find that you should install "Microsoft ® Windows Server® 2003 R2 Platform SDK" which contains them and fix two header files:

and others. After setting up additional include and linker directories, you will be able to successfully compile your application. But... when you try to start/debug it -oops! Everything crashes on WindowCreateEx(), etc. Why? The problem lies in the fix below, mentioned in the examples:

/* Comment it
PVOID __stdcall __AllocStdCallThunk(VOID);
VOID __stdcall __FreeStdCallThunk(PVOID);

#define AllocStdCallThunk() __AllocStdCallThunk()
#define FreeStdCallThunk(p) __FreeStdCallThunk(p)

#pragma comment(lib, "atlthunk.lib")
#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk))
#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p) 

which somehow doesn't work in 64bit OS.


The correct way is to install Windows Driver Kit Version 7.1.0, which contains newer version of ATL and file atlthunk.lib, so you don't need the incompatible trick above. You can get it here.

It is not a web installer. You have to download 619 MB CD .iso image. Be careful to download it complete. My first download (done via Google Chrome) somehow truncated the file and KitSetup.exe ended with misleading digital signature verification errors. Not only for me.
You don't need to install Microsoft File Transfer Manager. I was able to download ISO with Internet Explorer 9 correctly.

App Wizard

The next thing you will probably encounter on Vistas and above is that the wizard for creating new project does not work. It says something about errors in a script. This can be easily fixed by unblocking the shipped WTL AppWizard .js files using Windows Explorer: properties - unblock. See the following post 3.

If you install the wizard marked with "x" at the end of its name, which is for Express Editions, there is included the patch above by default. You need to comment the following line in stdafx.h:

// This project was generated for VC++ 2005 Express and ATL 3.0 from Platform SDK.
// Comment out this line to build the project with different versions of VC++ and ATL.
//#define _WTL_SUPPORT_SDK_ATL3 

If you don't do that, you won't be able to start the application on 64bit system.

Final Tips

To globally setup include and linker additional paths in VS 2010, you use the Property Manager. See the MSDN or simply View->Property manager, select Microsoft.Cpp.Win32.user for all configurations (using ctrl-click) and set up everything you need.

Hope it helps.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Adam Wojnar
Software Developer (Senior)
Czech Republic Czech Republic
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionInstaller included in wtl 8.1 Pin
Jose Del Castillo1-Jun-13 18:36
memberJose Del Castillo1-Jun-13 18:36 
AnswerRe: Installer included in wtl 8.1 Pin
Adam Wojnar1-Jun-13 23:38
memberAdam Wojnar1-Jun-13 23:38 
GeneralRe: Installer included in wtl 8.1 Pin
Jose Del Castillo2-Jun-13 6:20
memberJose Del Castillo2-Jun-13 6:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.190306.1 | Last Updated 7 May 2013
Article Copyright 2012 by Adam Wojnar
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid