Click here to Skip to main content
15,886,919 members
Articles / Desktop Programming / WTL
Article

Using WTL with Visual C++ 2005 Express Edition

Rate me:
Please Sign up or sign in to vote.
4.87/5 (33 votes)
13 Jan 2006CPOL2 min read 519.1K   1.9K   69   77
This article explains the procedure for using WTL with Visual Studio 2005 Express edition.

Introduction

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.

History

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

License

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


Written By
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.

Comments and Discussions

 
GeneralRe: Can not insert ATL Simple Object in WTL7.5 with visual studio 2005 Pin
JohnnyMalaria25-Oct-06 8:17
JohnnyMalaria25-Oct-06 8:17 
GeneralThank you Pin
mehrcpp28-May-06 11:36
mehrcpp28-May-06 11:36 
GeneralWTL Dialog application Pin
[Matrix]7-May-06 5:00
[Matrix]7-May-06 5:00 
GeneralRe: WTL Dialog application Pin
Baryon Lee8-May-06 5:15
Baryon Lee8-May-06 5:15 
Generallinking error Pin
basil300019-Feb-06 10:17
basil300019-Feb-06 10:17 
GeneralRe: linking error Pin
basil300019-Feb-06 11:25
basil300019-Feb-06 11:25 
GeneralRe: linking error Pin
jas603310-Dec-06 23:49
jas603310-Dec-06 23:49 
GeneralRadasm resource editor problems Pin
a1233454518-Feb-06 16:49
a1233454518-Feb-06 16:49 
I got everything working, and can compile the WTL sample programs. I tried out the radasm resource editor suggested on this web page, but am having problems. This resource editor is the same one that is packaged in the C++-IDE MingGW Studio at http://www.parinyasoft.com.

It edits the rc files OK, but after saving the rc file, it is completly changed. After the change the Visual C++ 2005 express edition resource compiler won't compile the resource.

I used the radasm resource editor ResEd.exe to edit the MDI.rc file in the MDIDocVw sample. This is the error I get when I try to compile with the new rc file.

".\MDI.rc(17) : error RC2104 : undefined keyword or key name: IDOK"

OK this is a pretty simple error, so I added definitions for IDOK and all other missing key names to the resource.h file, now I get this error.

"rc.exe has generated errors and will be closed by Windows."

Has anyone modified a resource file with ResEd.exe and gotten it to succesfully compile with WTL and Visual C++ 2005 Express edition?

GeneralRe: Radasm resource editor problems Pin
[Matrix]7-May-06 5:05
[Matrix]7-May-06 5:05 
QuestionRe: Radasm resource editor problems Pin
const31418-Jul-06 2:11
const31418-Jul-06 2:11 
Generalworks man ! Pin
Emil NEAGU9-Feb-06 1:25
Emil NEAGU9-Feb-06 1:25 
Generalerror C2065: '_Module' : undeclared identifier Pin
john bond3-Feb-06 7:10
john bond3-Feb-06 7:10 
GeneralRe: error C2065: '_Module' : undeclared identifier Pin
lanepaul16-Aug-06 23:00
lanepaul16-Aug-06 23:00 
Generalneed atl.lib Pin
Navi30-Jan-06 10:19
Navi30-Jan-06 10:19 
GeneralRe: need atl.lib Pin
mb2sync6-Feb-06 20:49
mb2sync6-Feb-06 20:49 
GeneralNot working :( Pin
Guybrush25-Jan-06 3:30
Guybrush25-Jan-06 3:30 
GeneralRe: Not working :( Pin
Florin Tanasa26-Jan-06 7:46
Florin Tanasa26-Jan-06 7:46 
GeneralRe: Not working :( Pin
Baryon Lee26-Jan-06 17:06
Baryon Lee26-Jan-06 17:06 
GeneralRe: Not working :( Pin
Baryon Lee26-Jan-06 22:14
Baryon Lee26-Jan-06 22:14 
GeneralRe: Not working :( Pin
Florin Tanasa26-Jan-06 23:15
Florin Tanasa26-Jan-06 23:15 
GeneralRe: Not working :( Pin
Guybrush28-Jan-06 2:39
Guybrush28-Jan-06 2:39 
GeneralRe: Not working :( Pin
Guybrush14-Feb-06 6:36
Guybrush14-Feb-06 6:36 
Generalwtl with gcc Pin
Gulli19-Jan-06 4:39
Gulli19-Jan-06 4:39 
GeneralRe: wtl with gcc Pin
Cristian Adam23-Jan-06 0:32
Cristian Adam23-Jan-06 0:32 
GeneralRe: wtl with gcc Pin
Sebastian Pipping4-Feb-06 16:20
Sebastian Pipping4-Feb-06 16: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.