Using the Windows Template Library articles by R. Mack
After a promising start which builds from an empty WinMain(), it peters out after a couple of examples. Still, it's worth reading to see how simple it is to start pulling in WTL bits.
WTL Makes UI Programming a Joy articles (Zip files with a Word doc and zipped source) by Chris Sells, Dharma Shukla, and Nenad Stefanovic
Stefanovic is the creator of WTL, and while dated, these articles are worth reading to get a little deeper into WTL.
A page of WTL links in the Philippines which includes Eamon Tuathail's humbling WTL Developer's Guide in PDF: highly recommended.
Finally, a WTL tip: if you're like me, you build with Warning Level set to Level 4 (/W4) and with Treat Warnings As Errors set to Yes (/WX). To get rid of those C4996 warnings, define _SECURE_ATL.
Showing posts with label WTL. Show all posts
Showing posts with label WTL. Show all posts
05 January 2009
04 January 2009
Getting started with WTL
I've spent the holidays (re)learning about WTL, so I thought I'd make a few notes as I went.
I'm using Visual Studio 2008 Professional on Vista SP1, so if you're using something else, the details may be slightly different. The essentials will be the same, though.
The first step is to make sure you have WTL on your machine with the App Wizard registered.
The current version of WTL is 8.0, and it can be found on SourceForge, oddly enough. Just download the Zip version and extract the contents into a folder on your system (I used C:\WTL80).
WTL comes with a number of scripts to add WTL support to the App Wizard in Visual Studio, but 8.0 was released before Visual Studio 2008 came out, so you'll have to add the WTL support yourself. Fortunately, it's incredibly simple:
Anyway, shut down Visual Studio 2008 if you have it running, run setup90.js, start Visual Studio 2008, and create a new project.
You will now see a WTL node under Other Languages\Visual C++, right below Win32:

Go ahead and create a scratch project using the wizard and take a look at the code. WTL comes with a dozen samples, including some for Vista, so be sure to take a look at them as well.
When you're ready to continue, head over to the excellent series of WTL articles on CodeProject, starting with Michael Dunn's WTL for MFC Programmers series.
I'm using Visual Studio 2008 Professional on Vista SP1, so if you're using something else, the details may be slightly different. The essentials will be the same, though.
The first step is to make sure you have WTL on your machine with the App Wizard registered.
The current version of WTL is 8.0, and it can be found on SourceForge, oddly enough. Just download the Zip version and extract the contents into a folder on your system (I used C:\WTL80).
WTL comes with a number of scripts to add WTL support to the App Wizard in Visual Studio, but 8.0 was released before Visual Studio 2008 came out, so you'll have to add the WTL support yourself. Fortunately, it's incredibly simple:
- copy AppWiz\setup80.js to AppWiz\setup90.js
- open setup90.js in a text editor and make the following changes:
Compare: (<)C:\WTL80\AppWiz\setup90.js (6399 bytes) with: (>)C:\WTL80\AppWiz\setup80.js (6401 bytes)You only need to change all 8.0 instances to 9.0; all the other changes are ones I made to productize the script, because that's how I roll.
12c12
< // Setup program for the WTL App Wizard for VC++ 9.0 (Orcas) --- > // Setup program for the WTL App Wizard for VC++ 8.0 (Whidbey)
72,73c72,73
< strvc9key = "HKLM\\Software\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir" strvalue =" WSShell.RegRead(strVC9Key);"> var strVC8Key = "HKLM\\Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir";
> strValue = WSShell.RegRead(strVC8Key);
79,80c79,80
< strvc9key_x64 = "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir" strvalue =" WSShell.RegRead(strVC9Key_x64);"> var strVC8Key_x64 = "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir";
> strValue = WSShell.RegRead(strVC8Key_x64);
84c84
<> WScript.Echo("ERROR: Cannot find where Visual Studio 8.0 is installed.");
144,146c144,146
< strline = "Param=\" wizard_version =" 9.0\"> strLine += ".8.0";
> else if(strLine.indexOf("WIZARD_VERSION") != -1)
> strLine = "Param=\"WIZARD_VERSION = 8.0\"";
Anyway, shut down Visual Studio 2008 if you have it running, run setup90.js, start Visual Studio 2008, and create a new project.
You will now see a WTL node under Other Languages\Visual C++, right below Win32:

Go ahead and create a scratch project using the wizard and take a look at the code. WTL comes with a dozen samples, including some for Vista, so be sure to take a look at them as well.
When you're ready to continue, head over to the excellent series of WTL articles on CodeProject, starting with Michael Dunn's WTL for MFC Programmers series.
Subscribe to:
Posts (Atom)