Click here to Skip to main content
11,921,316 members (62,097 online)
Click here to Skip to main content
Add your own
alternative version


69 bookmarked

Using WTL with Visual C++ 2005 Express Edition

, 13 Jan 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
This article explains the procedure for using WTL with Visual Studio 2005 Express edition.


Visual C++ 2005 Express Edition was released on 11/7/2005. It has a great native C++ compiler and a smart editor. The best thing is that it is free. We can use it for our WTL programming for free. I posted the procedure for the same here on 11/9/2005. Now, I am submitting it to CodeProject.

Step by step

  1. Download and install Visual C++ 2005 Express Edition from MSDN.
  2. Download and install the Platform SDK, and update the Visual C++ setting as detailed here.
  3. Update the Visual C++ directories in the Projects section of the Options dialog box. Add the ATL path to the Include files (the path shown is the default, use the path to your actual location):
    C:\Program Files\Microsoft Platform SDK\include\atl
  4. Change atlwin.h and atlbase.h in the ATL folder of the Platform SDK install as follows:
    • Change SetChainEntry function at line 1725 of atlwin.h - define "int i" at the first line of the function body.
      BOOL SetChainEntry(DWORD dwChainID, CMessageMap* pObject, DWORD
      dwMsgMapID = 0)
          int i;
          // first search for an existing entry
          for(i = 0; i < m_aChainEntry.GetSize(); i++)
    • Change AllocStdCallThunk and FreeStdCallThunk at line 287 of atlbase.h to the new macros:
      /* 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)
  5. Download and install WTL from SourceForge:
  6. Download the AppWizard for Visual Studio 2005 Express from the link above this page, unzip and copy the JS file into the WTL\AppWiz folder, double click it to install the WTL Wizard into VC Express.

Enjoy WTL and VC Express free!

Some Problems

Because VC++ Express doesn't include a "Resource Editor", you will get an error when creating a Dialog or FormView. But, once the project and source files are created, you can open the project directly. If you can find a free resource editor, please tell me.

Comments: rvRoman told us of a free resource editor, and tsehonkit gave us a right link.


  • 1/12/2006 - first submit, for WTL7.5.
  • 1/27/2006 - fixed an editing error.


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


About the Author

Baryon Lee
Web Developer
Japan Japan
I write software and share it to make our life more easy and interesting.
Welcome to my site:Share our software. Love Programming, Love Life.

You may also be interested in...

Comments and Discussions

NewsFree Resource Editor Pin
Giermann29-Jun-10 22:17
memberGiermann29-Jun-10 22:17 
GeneralUsing Windows SDK instead of Platform SDK on VISTA Pin
franzzoa21-Jun-10 5:28
memberfranzzoa21-Jun-10 5:28 
GeneralBuilding x64 with VC Express Pin
T800G5-Apr-10 7:39
memberT800G5-Apr-10 7:39 
NewsATL 7.1 available! Pin
T800G27-Aug-09 12:24
memberT800G27-Aug-09 12:24 
GeneralRe: ATL 7.1 available! Pin
tlj499929-Jan-11 15:28
membertlj499929-Jan-11 15:28 
AnswerDo it like this Pin
T800G7-Jun-11 9:21
memberT800G7-Jun-11 9:21 
NewsWTL 8.1 Pin
T800G12-May-09 11:41
memberT800G12-May-09 11:41 
Generalx64 warning! Pin
dataman64bit24-Aug-08 6:43
memberdataman64bit24-Aug-08 6:43 
When you're using windows x64 and compiling for windows x64, don't replace __AllocStdCallThunk and __FreeStdCallThunk with HeapAlloc/HeapFree. By default, windows x64 has memory execution protection and will NOT run thunk code ATL is using and your application process will lock with no error message. Use this code instead:

void* __stdcall __AllocStdCallThunk()
LPVOID mem = VirtualAlloc(0, sizeof(_stdcallthunk), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (!mem) return 0;
return mem;

void __stdcall __FreeStdCallThunk(void* ptr)
if (!ptr) return;
VirtualFree(ptr, 0, MEM_RELEASE);

This code marks allocated memory as executable and application will work again. Thanks for your thanks Smile | :)
Generalvideo streaming Pin
agachouch15-Jul-08 11:47
memberagachouch15-Jul-08 11:47 
Generalwindows vista + Windows (aka Platform) SDK + atlthunk.lib + winnt.h errors -- what worked for me Pin
Member 274734928-Apr-08 5:22
memberMember 274734928-Apr-08 5:22 
QuestionVc 2008 express and WTL ? Pin
Ivan Mladenovic19-Feb-08 2:39
memberIvan Mladenovic19-Feb-08 2:39 
QuestionRe: Vc 2008 express and WTL ? Pin
Kin Hoon4-Mar-08 3:38
memberKin Hoon4-Mar-08 3:38 
GeneralRe: Vc 2008 express and WTL ? Pin
Ivan Mladenovic5-Mar-08 1:27
memberIvan Mladenovic5-Mar-08 1:27 
GeneralRe: Vc 2008 express and WTL ? Pin
9844062216-Mar-08 3:44
member9844062216-Mar-08 3:44 
AnswerRe: Vc 2008 express and WTL ? Pin
tsehonkit23-Aug-08 7:53
membertsehonkit23-Aug-08 7:53 
QuestionWTL wizzard doesn't work Pin
Member 165025331-Jan-08 23:34
memberMember 165025331-Jan-08 23:34 
AnswerRe: WTL wizzard doesn't work Pin
oromero8-Jul-08 6:17
memberoromero8-Jul-08 6:17 
QuestionError while creating a plugin for windows media player. Pin
amiya das4-Jan-08 3:08
memberamiya das4-Jan-08 3:08 
QuestionPlatform SDK = Windows SDK? Pin
reinux8-Sep-07 0:47
memberreinux8-Sep-07 0:47 
NewsA Guide to WTL8.0 with VC++2005 express Pin
wbkang23-Jun-07 8:42
memberwbkang23-Jun-07 8:42 
QuestionOK, but where are atlcoll.h etc? Pin
CCanadaK3-Apr-07 19:21
memberCCanadaK3-Apr-07 19:21 
AnswerRe: OK, but where are atlcoll.h etc? Pin
Ed Gadziemski22-Jan-09 11:30
memberEd Gadziemski22-Jan-09 11:30 
Questionmissing the atlthunk.lib ? Pin
Firkraag11-Nov-06 22:02
memberFirkraag11-Nov-06 22:02 
AnswerRe: missing the atlthunk.lib ? Pin
Nuno Esculcas9-Feb-07 9:20
memberNuno Esculcas9-Feb-07 9:20 
GeneralRe: missing the atlthunk.lib ? Pin
ppaijwar28-Nov-07 9:41
memberppaijwar28-Nov-07 9:41 
GeneralFree resource editor. Excellent. Pin
bigshlacker24-Oct-06 21:31
memberbigshlacker24-Oct-06 21:31 
GeneralRe: Free resource editor. Excellent. Pin
Vladimir Svrkota7-Nov-06 9:00
memberVladimir Svrkota7-Nov-06 9:00 
GeneralRe: Free resource editor. Excellent. Pin
Batmanstolemydog31-May-07 10:54
memberBatmanstolemydog31-May-07 10:54 
GeneralRe: Free resource editor. Excellent. Pin
greegree2-Sep-07 22:15
membergreegree2-Sep-07 22:15 
QuestionI followed all the instructions but ... [modified: English error was corrected] Pin
piaoyh30-Sep-06 7:07
memberpiaoyh30-Sep-06 7:07 
AnswerI found the solution ! Pin
piaoyh6-Oct-06 13:52
memberpiaoyh6-Oct-06 13:52 
GeneralNot a complete solution. Pin
Eoinoc28-Sep-06 12:20
memberEoinoc28-Sep-06 12:20 
GeneralRe: Not a complete solution. Pin
Baryon Lee28-Sep-06 19:14
memberBaryon Lee28-Sep-06 19:14 
GeneralRe: Not a complete solution. Pin
Eoinoc29-Sep-06 1:37
memberEoinoc29-Sep-06 1:37 
GeneralBest Free Resource Editor Pin
algr200014-Jul-06 21:27
memberalgr200014-Jul-06 21:27 
GeneralWTL8.0 support VC2005Express Pin
Baryon Lee19-Jun-06 14:05
memberBaryon Lee19-Jun-06 14:05 
GeneralRe: WTL8.0 support VC2005Express Pin
log1117-May-07 6:03
memberlog1117-May-07 6:03 
Generalerrors with Vstudio8 express version Pin
wolky11-Jun-06 9:12
memberwolky11-Jun-06 9:12 
GeneralRe: errors with Vstudio8 express version Pin
Baryon Lee19-Jun-06 13:58
memberBaryon Lee19-Jun-06 13:58 
QuestionCan not insert ATL Simple Object in WTL7.5 with visual studio 2005 Pin
jikanyanwin3228-May-06 17:30
memberjikanyanwin3228-May-06 17:30 
AnswerRe: Can not insert ATL Simple Object in WTL7.5 with visual studio 2005 Pin
Tony Ioanides22-Aug-06 21:44
memberTony Ioanides22-Aug-06 21:44 
GeneralRe: Can not insert ATL Simple Object in WTL7.5 with visual studio 2005 Pin
JohnnyMalaria25-Oct-06 9:17
memberJohnnyMalaria25-Oct-06 9:17 
GeneralThank you Pin
mehrcpp28-May-06 12:36
membermehrcpp28-May-06 12:36 
GeneralWTL Dialog application Pin
amervelic7-May-06 6:00
memberamervelic7-May-06 6:00 
GeneralRe: WTL Dialog application Pin
Baryon Lee8-May-06 6:15
memberBaryon Lee8-May-06 6:15 
Generallinking error Pin
basil300019-Feb-06 11:17
memberbasil300019-Feb-06 11:17 
GeneralRe: linking error Pin
basil300019-Feb-06 12:25
memberbasil300019-Feb-06 12:25 
GeneralRe: linking error Pin
jas603311-Dec-06 0:49
memberjas603311-Dec-06 0:49 
GeneralRadasm resource editor problems Pin
a1233454518-Feb-06 17:49
membera1233454518-Feb-06 17:49 
GeneralRe: Radasm resource editor problems Pin
amervelic7-May-06 6:05
memberamervelic7-May-06 6:05 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151120.1 | Last Updated 13 Jan 2006
Article Copyright 2006 by Baryon Lee
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid