How to install WTL for Visual Studio 2008

 

There seems to be a lot of motivation to use WTL for native Windows and Windows Mobile development. First, managed code is not for everyone, and second MFC projects for Windows Mobile seem to be write-only (if you do not believe me, try reading the generated code).

However WTL 8.0 does not work out of the box with Visual Studio 2008. There are posts about that across various message boards, but I haven’t found a comprehensive solution yet. So I rolled up the sleeves and got to debugging the setup scripts for WTL 8.0. Below are my findings and, I hope, fairly easy to follow instructions.

I strongly suggest you create a copy of your WTL directory before you start doing the tweaks outlined here. Also, I only done cursory checks of my tweaks with Visual Studio 2008 and I suspect that those tweaks would make Visual Studio 2005 very unhappy. Use at your own risk.

1. Get WTL setup for Windows development

This is an easy step and there are bunch of posts across internet about this. Do a web search for WTL 8.0 setup for Visual Studio 2008 and they come close to the top. The essence of this is to go into WTL folder and do string replacement of “8.0” to “9.0” in setup.js files in three directories:

WTL80AppWizsetup80.js
WTL80AppWizCesetup80.js
WTL80AppWizMobilesetup80.js

I suggest copying each setup80.js into corresponding setup90.js and then performing the changes. This way you have an original that will work with VS 2005.

After you are done renaming the strings you can run AppWizsetup90.js (it requires elevated privileges to run) and you are done for Windows development.

Windows CE and Windows Mobile is a little bit more involved.

2. Get WTL setup for Windows CE and Windows Mobile development

First you need to find all instances of string “CLSID:D245F352-3F45-4516-B1E6-04608DA126CC” in AppWizCEFilesHTML1033*.htm and replace it with “CLSID:5AFCAD52-F3CC-43BB-A605-6602EE5BD94A”. Do the same for AppWizMobileFilesHTML1033*.htm.

Then replace all strings “ProjWiz.SDProjWiz2.2” to “ProjWiz.SDProjWiz2.3” in AppWizCEFilesScripts1033default.js. Do the same to AppWizMobileFilesScripts1033default.js.

At this point you should be able to see two new project types appear under WTL node in the new project wizard and be able to create new projects of those two types.

But don’t rush there just yet. We need to fix one more thing, otherwise you will get compile errors. Open AppWizCEFilesTemplates1033stdafx.h in your favorite editor and go to line 26, it should say

#include <atlapp.h>

Just before this line insert

#define _SECURE_ATL 1

Do the same to AppWizMobileFilesTemplates1033stdafx..h (it is on line 27 there).

Now you should be all set.

WTL 8.0 links

Articles describing the use of WTL on Windows Mobile 6 SDK:
 
General overview of WTL for WinMo development – http://www.developer.com/ws/pc/print.php/3669201
Marketing blurb on WTL for WinMo – http://www.fannsoftware.com/Dev/Wtl1.html