Feedback Search Top Backward Forward

The Codesmith's Library

Written by Carsten Whimster



The Codesmith's Library

In The Codesmith's Library, I focus on development books and materials. I have written this column from the point of view of an intermediate PM C programmer and intermediate REXX programmer. Pick up whichever book strikes your fancy, and join the growing group of people following our PM programming columns. I have already reviewed a number of beginner's books, and will try to concentrate a bit more on intermediate techniques and special topics from now on.

Please send me your comments and thoughts so that I can make this column what you want it to be. I read and respond to all mail.

OS/2 Warp Presentation Manager API is a new reference book from Wiley which covers the Presentation Manager API (surprise), both documented and undocumented.


My Web page now has a new section on publishers, including a list of currently available books from each publisher. If you have any comment, mail me. If you have any additions or corrections, mail me. Note the change of URL too. Check it out at .

I have been using my new copy of VAC++ and the WorkFrame is slow, even with C programs. I also don't seem to be able to turn off all the informational messages that a compile brings up. I have them turned off for the compiler itself, but the rest of them are as healthy as ever, completely cluttering up even a routine compile. Oh well, it works well enough I guess. I did run into some problems when I wanted a stand-alone program. I was using the math library, but in spite of an include, the linker could not find the library, and the compile would not consistently finish. Sometimes it would, but mostly it wouldn't. Eventually I just created a table of cos and sin values in my header file, but what a hazzle. Other than the speed, the message overdose, and the math compilation problems, it is a great environment, and I am taking to LPEX quicker than I thought I would. The speed, though, the speed. On a DX4-100 with 20Mb it really ought to fly, but no such luck. I hope they rewrite it in VAC++ rather than Smalltalk next time. I should be releasing a small utility soon, and perhaps write an article for EDM/2 on the problems I had to solve while coding.

OS/2 Warp Presentation Manager API

This month's book is second in a new series of three API references from John Wiley and Sons, covering the Control Program, Presentation Manager, and Workplace Shell APIs. This particular book also promises to cover more than just what the Warp Toolkit online references cover, while presenting the material in a well-structured, easy-to-use manner. Here are the chapters:

1.   PM Application Setup and Cleanup
2.   Registering and Creating Windows
3.   Messaging
4.   Keystrokes and Focus
5.   Presentation Spaces and Device Contexts
6.   Window Drawing Functions
7.   Clipping and Invalid Regions
8.   Menus
9.   Dialogs
10.  Standard Dialogs
11.  Resources
12.  Help
13.  Window Information
14.  System Information
15.  Atoms
16.  The Clipboard and Dynamic Data Exchange
17.  Rectangles
18.  Task List Functions
19.  Workplace Shell Functions
20.  National Language Support
Appendix A.  WinLockVisRegions
Similar to last month's book, publishing deadlines did not allow the development of a full complement of examples for each API, but there are a few this time. The major difference between this book and last month's book is that I find the chapter introductions a little more sketchy. Perhaps that was necessary to keep the book a similar size, but I prefer slightly more detailed descriptions, and the PM Win functions really require this unless you have already used them.

Like the previous book, the organization of the book is as follows:

  • each major topic is given its own chapter (see above)
  • each chapter has a few introductory paragraphs, tutorial in nature
  • each function which comes under this chapter's heading is then given, as follows:
    • name and type of API (ie. chapter heading repeated)
    • brief description
    • syntax
    • parameters, each with a brief explanation, and tables of possible values, if appropriate
    • returns, with value and description of error codes
    • other info, including include file, define, ordinal, and DLL API resides in
    • see also, with related APIs, each with a page number
    • notes, including warnings, restrictions and so on
This very simple layout makes it very simple to navigate, and powerful, although having used this book for the better part of a month, I find that this layout does compromise the quick-lookup ability for a single function, which most other reference books have. I am undecided as to whether this layout is better in the end, or whether a more traditional pure-alphabetical layout is preferable. In writing my current program I think the alphabetical approach has won so far, but perhaps in the long run, the new layout works best? In any case, both work, and both have their strengths and weaknesses. One thing is for sure, I like the OTHER INFO section, with its INCLUDE information. Now my utility has only the necessary includes, and whether that makes a difference or not to the size of the compiled program or the compilation speed, I feel better about it. I have never liked the fact that all functions in a library get brought in by C, whether you need them or not.

That is it, for the second time! I have been much busier this month, so I didn't get all the way through this book like last month. With this type of reference that really isn't necessary though. The functions are all there, and the first appendix even has a late-breaking addition of the WinLockVisRegions function. I am not sure why it is here, and not in the main part, since it is documented in the pmwin.h file, but perhaps it wasn't in previous versions and only just made it in time for publicat ion.

This review is a little short again, but this month I won't include a sample function since it is so similar in layout to the original book in the series. I will instead just add a example of the sample code that is in a very few functions in this book. This one is for WinBeginPaint(), style unaltered:

  case WM_PAINT:
    HPS hps; // cached-micro PS handle
    RECTL rcl; // bounding rectangle
    hps = WinBeginPaint ( hWnd, NULLHANDLE, &rcl );
    GpiErase ( hps );
    WinEndPaint ( hps );

  return 0;
Figure 1: Sample code from the book for the WM_PAINT message.

There you are, all done for this month. This book, due to the "not quite enough for me" chapter introductions, and the struggle with alphabetized versus sectionized layout, loses the A+ of the last book, but retains an A, and is still a great reference book. Another must-have from this series.


This is now my favorite PM reference book, as well as one of my only two PM reference books. I had a less successful time with the sectionized layout than with the Control Program API book, perhaps because of the more diverse nature of the mater ial, and I needed more of an explanation at the start of each chapter, due to the more complicated nature of the material, but got only the same level of explanation, so it gets an A instead. Still a great book, and so far without much competition as a PM reference book in my library. A must-have for serious PM programmers.

OS/2 Warp Presentation Manager API, Barnum

  • John Wiley and Sons. ISBN 0-471-03887-3. US$29.99, CAN$40
  • OS/2 C/C++ PM Programmers
  • Mark: A

Reviewed Books

Our Bookstore has reviews and links to Amazon for all books we have reviewed in the past, as well as several books waiting to be reviewed, and others which we recommend.