Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Easy installation of WTL

0.00/5 (No votes)
4 Apr 2003 1  
This article shows an alternative, and simpler way of downloading and installing WTL.

Latest news!

Have a look at Michael Dunn's WTL for MFC Programmers, Part I - ATL GUI Classes in the Beginners section (and also at the Part II). It contains the reference to the newer WTL70.exe, which can be easily downloaded and self-extracted (WinZip). The article and also shows the first steps with ATL and WTL. The article is said to be targeted to MFC programmers, but it is perfect also for those with ATL experience only or for the "hard-core Petzold followers". The articles are simply excellent. I wish I could read something like that some years ago, when I started with ATL and WTL.

Please, do not focus on the text below. It is already very obsolete and should be ignored these days. It was last updated almost exactly two years ago (3rd April 2001). I did left the content below untouched only because some other articles refer to this one (and to record the history ;-).

The article below is clearly obsolete due to the availability of a downloadable self extracting archive file wtl31.exe available from the MSDN Online Downloads page. My thanks go to Gavin Jerman who posted the notice here, and to Nenad Stefanovic who made the wtl31.exe available:

  Hi everybody,

  In addition to the Platform SDK, WTL 3.1 is now also available on the
  MSDN Downloads. Just go to http://msdn.microsoft.com/downloads,
  and find WTL under the "Visual Studio, Tools and Languages" \ "Visual C++"
  category.

  Enjoy,
  Nenad

As far as I know, the self extracting archive file was made available at 3/23/2001. The size is 317,880 bytes. While the following approach still works, this article is only a part of history from now on, and it is going to die silently. I will recommend to Ben Burnett to merge this article into his Introduction to WTL – Part 1 where it fits better.  The original article follows.

Introduction

Ben Burnett's article Introduction to WTL – Part 1 contains basic information on WTL. The section Where do you get it? shows the standard way to download the latest version of WTL from Platform SDK web site.

This article shows the alternative way of downloading and installing WTL which is less painful for those with low speed Internet connection. The result of few steps is the WTL subdirectory in your working directory. Then you can copy its content into the usual subdirectory for WTL files like C:\Program Files\Microsoft Visual Studio\VC98\WTL.

Motivation

The WTL (Windows Template Library) contains about 900 kB of header files. Getting them is necessary and sufficient condition to start working with WTL. In addition, you may want to use ATL/WTL wizard — the size of the binary form is about 250 kB. What can help you at the beginning are the examples. The October 2000 Platform SDK contains four examples in subdirectories BmpView, GuidGen, MdiDocVw, and MTPad. Size of sources is about 180 KB.

To summarize, all the needed files have about 1.3 Mb (to have a full installation of WTL). The cabinet files that must be downloaded have together less than 1 MB. This is quite acceptable even when having very slow Internet connection. The problem is that the standard Platform SDK installation procedure requires to download much more data. Being connected via 56k or less modem, it is very painful and time consuming. It could be almost impossible if the connection line is not reliable.

So, what is the alternative way?

The idea is based on manual downloading of one or two cabinet files using ftp protocol. This can be done also using a web browser (like Microsoft Internet Explorer) by just clicking on links below. You also download one small zip file linked at the top of this article. It contains single batch file. Then you run the batch file and you get the WTL subdirectory with all necessary files. You need to download only 900 KB of data or so.

The steps

Place all downloaded files into one working directory. Nothing special is going to happen there. Files will only be extracted into subdirectories of the working directory. Other directories will not be affected. The steps were tested on October 2000 Platform SDK release (WTL Version 3.1).

  1. Download the ftp://ftp.microsoft.com/developr/PlatformSDK/Oct2000/psdk-common.48.cab file. It contains the WTL header files and examples. The size of the cabinet file is about 890 KB. For Windows 9x, see also text just behind the numbered steps.
  2. Download the ftp://ftp.microsoft.com/developr/PlatformSDK/Oct2000/psdk-x86.48.cab file. It contains the ATL/WTL wizard. It is not necessary, but the size of the cabinet file is only about 40 KB. So why not. For Windows 9x, see also text just behind the numbered steps.
  3. Download the WTLinst.zip or WTLinst9x.zip archive file linked at the beginning of the article. (Extremely small, only 2 kB.)
  4. Unzip the downloaded archive file WTLinst.zip or WTLinst9x.zip using for example free unzip utility by Info-ZIP. The downloaded archive contains single batch file.
  5. Having the extracted batch file and one or two cabinet files in the same working directory, run the WTLextract.bat or WTLextr9x.bat respectively.
    • Warning! The WTLextract.bat will not work on Windows 9x and the WTLextr9x.bat will not work on Windows NT.
  6. Copy the content of the created WTL subdirectory to the desired place and ensure that the Include subdirectory with header files is searched by VC++ compiler.

Isn't it easy?

Notice for Windows 9x: If you have problems with storing the cabinet files on your disk because of their names (two dots in the name), store them as wtl1.cab and wtl2.cab. If you store them using the original names, the WTLinst9x.bat batch will rename them anyway to avoid problems with the extract utility on Windows 9x. The new names are treated as synonyms for the original cabinet files.

And how does it work inside?

Well, you can look inside the batch file ;-). O.K., here is a snippet of the internal magic. In fact, it shows all important actions to extract all the WTL header files from the psdk-common.48.cab cabinet file:

extract /L WTL/Include psdk-common.48.cab *.A1000D79*

cd WTL\Include

rename AtlApp_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C    AtlApp.h
rename AtlCrack_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlCrack.h 
rename AtlCtrls_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlCtrls.h 
rename AtlCtrlw_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlCtrlw.h 
rename AtlCtrlx_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlCtrlx.h
rename AtlDdx_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C    AtlDdx.h
rename AtlDlgs_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C   AtlDlgs.h
rename AtlFrame_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlFrame.h
rename AtlGdi_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C    AtlGdi.h
rename AtlMisc_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C   AtlMisc.h
rename AtlPrint_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlPrint.h
rename AtlRes_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C    AtlRes.h
rename AtlScrl_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C   AtlScrl.h
rename AtlSplit_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C  AtlSplit.h
rename AtlUser_h.A1000D79_C485_4CB3_8AB0_B6D38ED2B38C   AtlUser.h

The extract utility is a part of Windows. The options ensure that the WTL/Include is the directory for extracted files. If the subdirectories do not exist they will be created. The file mask *.A1000D79* is related to the WTL header files. The full names of extracted files are visible in the rename commands part. They are renamed to the original WTL names.

The installation batch for Windows 9x is more obscure because the extract utility cannot find the cabinet files with two dots in the name, and also it cuts the extracted file names to the 8.3 form. The cabinet files must be renamed first and the extraction process must be split to more parts because some of the file names do overlap when shortened to 8.3 form. I tried hard to use the extrac32 utility instead of extract, but I was not successful here. It is probably because the extrac32 is treated as a Windows program and it is executed asynchronously. If you know how to solve the problem using extrac32, I'll be glad to accept and embed the solution here (there still is some place in the following acknowledgements ;-).

Acknowledgements

I'd like to thank firstly to authors of WTL. My thanks goes also to Ben Burnett for showing total WTL beginners Where do you get it?, to Michael Fink who posted where the ATL/WTL wizard sleeps, to Mehmet Ozgul who posted the problems related to the Windows 9x, to John Noland who suggested the 8.3 problem solution on Windows 9x plus added the commands to extract another example (BmpView), and to many others who prove all the time that the lack of official WTL support does not mean that WTL is bad. Finally, I'd like to thank the one at CodeProject who corrected my English spelling errors, and spent the time with the updates.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here