home *** CD-ROM | disk | FTP | other *** search
/ Arawak OS/2 Shareware / PAKLED.ISO / docs / edm / edmi2-4.inf (.txt) < prev    next >
Encoding:
OS/2 Help File  |  1994-04-09  |  157.8 KB  |  1,580 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. April 1994's Title Page ΓòÉΓòÉΓòÉ
  3.  
  4.           Welcome to EDM/2 - The Electronic OS/2 Developer's Magazine!
  5.                    Portions copyright (c) by Larry Salomon Jr.
  6.                                 Volume 2, issue 4
  7.  
  8. Copyright Notice and Other Stuff 
  9.  
  10. The editor of this electronic magazine is Larry Salomon, Jr. 
  11.  
  12. Portions of EDM/2 are copyrighted by the editors.  This publication may be 
  13. freely distributed in electronic form provided that all parts are present in 
  14. their original unmodified form.  A reasonable fee may be charged for the 
  15. physical act of distribution; no fee may be charged for the publication itself. 
  16.  
  17. All articles are copyrighted by their authors. No part of any article may be 
  18. reproduced without permission from the original author. 
  19.  
  20. Neither this publication nor the editors are affiliated with International 
  21. Business Machines Corporation. 
  22.  
  23. OS/2 is a registered trademark of International Business Machines Corporation. 
  24. Other trademarks are property of their respective owners.  Any mention of a 
  25. product in this publication does not constitute an endorsement or affiliation 
  26. unless specifically stated in the text. 
  27.  
  28. Administrivia 
  29.  
  30. Leftovers 
  31.  
  32. Last month seemed to be the month of corrections.  I have finally - thanks 
  33. David Singer - updated the information about obtaining EDM/2 from within and 
  34. without IBM on their gopher and WWW servers.  Many other corrections have been 
  35. made, and thanks go to all who sent me email with bug fixes to INSTALL.CMD, 
  36. etc. 
  37.  
  38. I mentioned last issue that I would hopefully be attending the Technical 
  39. Interchange in San Fransisco at the end of April. Unfortunately, that is no 
  40. longer true because I have changed jobs;  as of April 4, I am an employee of 
  41. Cheyenne Software, Inc.  As such, I have lost the approval from my management 
  42. at my last job to go to San Fransisco.  :) 
  43.  
  44. Speaking of New Employment 
  45.  
  46. Our collective net-friend Timothy Sipples has finally been swept into the Blue 
  47. Family.  Congratulations go to Timothy; hopefully, he will be able to continue 
  48. his perpetual fight for truth, justice, and OS/2-for-the-masses from within 
  49. IBM. 
  50.  
  51. More Recognition? 
  52.  
  53. Just a quick note here:  I have started receiving mail at my house as the 
  54. editor of this magazine.  While I still wonder how my mailing address got out - 
  55. maybe I am the victim of a smart mailing list merging program :) - I am happy 
  56. that the magazine is getting recognized more and more as a real magazine. 
  57.  
  58. Rumor Central/2 
  59.  
  60. Rumor has it that OS/2 2.2 has slipped to November of this year.  I don't know 
  61. what that portends, nor what ramifications it holds, but it sure is 
  62. interesting.  :) 
  63.  
  64. Another rumor is that the volunteer authors are spending a lot of time on 
  65. Spring Break and mid-terms, so this issue is a bit lean.  I would have written 
  66. some more myself, but I already have two columns and just recently contracted 
  67. this virus called 'Internet Relay Chat'.  :)  My apologies, therefore, for the 
  68. lack of quantity this month. 
  69.  
  70. Rexx Symposium 
  71.  
  72. Cathie Dager sent this to me and I thought the readers would find it 
  73. interesting. 
  74.  
  75. The Rexx Symposium is the Rexx event of the year!  It is a participtory 
  76. conference for technical exchange, so bring your ideas, programs, diskettes, 
  77. announcements, and questions to share.  Author Mike Cowlishaw will attend and 
  78. speak, along with implementers and developers for REXX on OS/2 and other 
  79. platforms, including several for Unix.  Also Timothy Sipples, the OS/2 FAQ 
  80. author, will speak as well as developers for Object REXX for OS/2 and for 
  81. several visual versions: VX-REXX, VisPro REXX and GPF REXX. 
  82.  
  83. This is your opportunity to share information and interact personally with 
  84. implementers and others interested in using and enjoying programming in REXX. 
  85.  
  86. Registration is $200, $75 for students.  To register contact Village Travel at 
  87. 1-800-245-3260, 1-415-326-0510, fax 1-415-326-0245. 
  88.  
  89. In addition, the kick-off meeting of the REXX Language Association (RexxLA) 
  90. will be held Monday, May 2, at 7:30 PM also at the Omni Parker House. 
  91.  
  92.  
  93. ΓòÉΓòÉΓòÉ 2. Features for April 1994 ΓòÉΓòÉΓòÉ
  94.  
  95. The following articles constitute this issue's features: 
  96.  
  97. o Debugging Classes in Borland C++ 
  98.  
  99.  
  100. ΓòÉΓòÉΓòÉ 2.1. Debugging Classes in Borland C++ ΓòÉΓòÉΓòÉ
  101.  
  102.  
  103. ΓòÉΓòÉΓòÉ 2.1.1. Introduction ΓòÉΓòÉΓòÉ
  104.  
  105. Written by Timm Steinbeck 
  106.  
  107. Introduction 
  108.  
  109. When using Borland C++ for OS/2 I quickly found out that there are certain 
  110. problems involved when debugging programs.  Several of these were related to my 
  111. programs, several were of a nature general to debugging and some were and are 
  112. very specific problems due to Borland's debugger.  The second type of problems 
  113. manifested themself in a context of Murphy's law:  Everything goes wrong when 
  114. you expect it the least, meaning your program has a fault especially when you 
  115. are not debugging it.  The third category meant that when debugging rather 
  116. often, not only my program would crash but also the debugger. 
  117.  
  118.  
  119. ΓòÉΓòÉΓòÉ 2.1.2. The Base Protocol Class ΓòÉΓòÉΓòÉ
  120.  
  121. The Base Protocol Class 
  122.  
  123. To avoid these types of problems I decided to write a class that would enable 
  124. me easily to put statements in the code to write some sort of comment in a file 
  125. for later analysis.  I decided to write it so that there would be one globally 
  126. accessible instance of this class in every program that uses it. That way I 
  127. would not have to worry about initialization and deinitialization in the 
  128. programs.  I could put this code in the constructor and destructor and forget 
  129. about it.  I also made it it so that the constructor and destructor also wrote 
  130. the time and date of the beginning and ending of the session. 
  131.  
  132. After some time I realized that it would be quite useful having routines for 
  133. writing a complete PM message or a number without having to manually convert 
  134. them to strings.  So together with the function for writing text to the file I 
  135. then had a class declaration that looked like this: 
  136.  
  137. class OProtocol {
  138. protected:
  139.   char* PathName;              // Pointer for the name of the file
  140.                                // were comments are to be stored
  141.   int IO;                      // Indicator whether file can be
  142.                                // opened or not
  143. public:
  144.   OProtocol(char* Name);      // Filename is passed to class
  145.   ~OProtocol();
  146.   virtual void Text(char* Text);
  147.   virtual void Msg(HWND hWnd, UINT Msg, MPARAM P1, MPARAM P2);
  148.   virtual void Long(char *c, long l);
  149. };
  150.  
  151.  
  152. ΓòÉΓòÉΓòÉ 2.1.3. The Procedure Protocol Class ΓòÉΓòÉΓòÉ
  153.  
  154. The Procedure Protocol Class 
  155.  
  156. After some time I even became too lazy to put statements at the beginning and 
  157. end of each procedure.  While nothing could be done about the beginning I 
  158. decided to write another class for procedure-comments, using the OProtocol 
  159. class for writing the comments to the file.  For this class I only needed to 
  160. write a constructor and a destructor.  When an instance of the class is 
  161. declared at the beginning of a procedure the constructor writes a comment about 
  162. the procedure being started.  The destructor is then called automatically when 
  163. the procedure ends, so this is a good place for writing a comment about the end 
  164. of the procedure.  This left me with the following class declaration: 
  165.  
  166. class OProcedure {
  167. protected:
  168.   char *ProcName;
  169. public:
  170.   OProcedure(char * Name);
  171.   ~OProcedure();
  172. };
  173.  
  174. I wrote the constructor so, that it wrote something like "Function <name> 
  175. started" in the protocol file.  The destructor then writes "Function <name> 
  176. ended".  So when creating an instance of this class in a function passing the 
  177. name of the function I had a list of when this function was called and when it 
  178. was ended. 
  179.  
  180.  
  181. ΓòÉΓòÉΓòÉ 2.1.4. The Method Protocol Class ΓòÉΓòÉΓòÉ
  182.  
  183. The Method Protocol Class 
  184.  
  185. But even this capability did not satisfy me, since whenever working with 
  186. several instances of a class I only knew that a member function was called, but 
  187. not to which instance it did belong.  Of course I could call 
  188. OProtocol::Long(this) but being lazy, I sought a better - or rather easier - 
  189. way to do this.  The solution was to write a new class that was similar to the 
  190. OProcedure class but whose constructor accepted a PVOID as an argument and 
  191. could then write this pointer to the protocol file as well. 
  192.  
  193. class OMethod {
  194. protected:
  195.   char *ProcName;
  196.   void *that;
  197. public:
  198.   OMethod(void *That, char *Name);
  199.   ~OMethod();
  200. };
  201.  
  202. This class is of course not much different from OProcedure, but it has the 
  203. additional advantage of providing a standardized format in the file for method 
  204. calls.  I did not derive the OMethod class from the OProcedure class on purpose 
  205. because I wanted to have the whole comment in one line, so that I had no use 
  206. for the OProcedure constructor. 
  207.  
  208.  
  209. ΓòÉΓòÉΓòÉ 2.1.5. Some Helping Hands ΓòÉΓòÉΓòÉ
  210.  
  211. Some Helping Hands 
  212.  
  213. What I described so far are just the classes.  But until now when I used them 
  214. during a debugging cycle and then finished the program I would have to delete 
  215. everything by hand.  As I am sure you will have guessed by now, this did not 
  216. satisfy me and so I went ahead and wrote a couple of macros for calling the 
  217. functions.  The first macro actually is for creating and initializing an 
  218. instance of the OProtocol class. 
  219.  
  220. #define PROT_NEW(ClasS, FilE) ClasS Protocol(FilE);ProtP=3D&Protocol
  221.  
  222. ProtP is a global pointer to OProtocol.  So for using a protocol file in a 
  223. program I would then write PROT_NEW(OProtocol, "Foo.Prt");.  This approach also 
  224. enables other users to derive classes from OProtocol and then use these for 
  225. writing the messages.  The other macros I defined just went about and called 
  226. ProtP methods or created instances of OProcedure or OMethod respectively. And 
  227. not to forget the reason for this operation I used preprocessor directives for 
  228. empty versions of all these macros. 
  229.  
  230. The actual implementation of all this is rather straightforward and will 
  231. therefore not be elaborated further; there are, of course, comments in the 
  232. source file. 
  233.  
  234.  
  235. ΓòÉΓòÉΓòÉ 2.1.6. Usage ΓòÉΓòÉΓòÉ
  236.  
  237. Usage 
  238.  
  239. For the classes to be of some use, you must know how to use them.  For this 
  240. purpose I will put some exemplary statements here. 
  241.  
  242. PROT_NEW(OProtocol, "C:\\FOO\\BAR.PRT");
  243.  
  244. This will initialize the protocol session in a file C:\FOO\BAR.PTR.  A 
  245. statement like that has to occur before any other protocoling attempts take 
  246. place.  And there should only be one of them as well. 
  247.  
  248. PROT_TEXT("Sample debugging text");
  249.  
  250. This writes 
  251.  
  252. Sample debugging text
  253. in the previously initialized file, in this case C:\FOO\BAR.PRT.  If you want a 
  254. line feed here you have to pass it yourself, but it is not much work rewriting 
  255. the code, so that it is done automatically. 
  256.  
  257. PROT_LONG("A sample long", ASampleLong);
  258.  
  259. The Result of this will be 
  260.  
  261. A sample long: 0x1234\n
  262. or with whatever value ASampleLong happens to have. 
  263.  
  264. PROT_MSG(AnHWND, WM_CREATE, 0, 0);
  265.  
  266. After this call you will be able to read 
  267.  
  268. Message: 0x1234        0x1      0x0       0x0\n
  269. in your protocol file. 
  270.  
  271. PROT_METHOD("SampleMethod");
  272.  
  273. This statement in a method will result in two lines: 
  274.  
  275. Object 0x1234\tMethod --> SampleMethod\n
  276. Object 0x1234\tMethod <-- SampleMethod\n
  277. The this pointer of the object need not be given specifically 
  278.  
  279. PROT_PROCEDURE can be used similarly to PROT_METHOD. But whereas you can use 
  280. PROT_PROCEDURE in methods as well, you can't use PROT_METHOD in a simple 
  281. function, since it it assumes that this is properly defined. 
  282.  
  283. To determine what you want to include and what you don't want when compiling 
  284. there are several #defines.  These are: 
  285.  
  286. o DBG_PROT_TEXT 
  287.  
  288. o DBG_PROT_MSG 
  289.  
  290. o DBG_PROT_LONG 
  291.  
  292. o DBG_PROT_PROC 
  293.  
  294. o DBG_PROT_ALL 
  295.  
  296. All of those defines will result in the including of the OProtocol class and 
  297. DBG_PROT_PROC will also include OProcedure and OMethod.  They will also control 
  298. the expansation of the PROT_* macros to something useful or just empty macros. 
  299.  
  300. DBG_PROT_TEXT This will expand the PROT_TEXT macro for text into a call to 
  301. OProtocol::Text(). 
  302.  
  303. DBG_PROT_MSG This will expand the PROT_MSG macro into a call to 
  304. OProtocol::Msg(). 
  305.  
  306. DBG_PROT_LONG This will enable the use of OProtocol::Long() via PROT_LONG. 
  307.  
  308. DBG_PROT_PROC This results in the expansion of the PROT_PROCEDURE and 
  309. PROT_METHOD for access to the OProcedure and OMethod classes. 
  310.  
  311. Finally, to use it you need to link PROT.OBJ to your executable when you are 
  312. debugging it.  When you haven't defined any of the DBG_PROT_* defines there is 
  313. no need to do so. 
  314.  
  315. I will also add one word or warning:  be careful not to put too many 
  316. protocoling statements in a program, especially be wary with protocolin 
  317. messages.  You can quickly end up having a protocol file of more than half a 
  318. megabyte.  Try to reduce the usage to the finished parts. 
  319.  
  320.  
  321. ΓòÉΓòÉΓòÉ 3. Columns ΓòÉΓòÉΓòÉ
  322.  
  323. The following columns can be found in this issue: 
  324.  
  325. o /dev/EDM/BookReview 
  326. o C++ Corner 
  327. o Introduction to PM Programming 
  328. o Scratch Patch 
  329.  
  330.  
  331. ΓòÉΓòÉΓòÉ 3.1. /dev/EDM/BookReview ΓòÉΓòÉΓòÉ
  332.  
  333.  
  334. ΓòÉΓòÉΓòÉ 3.1.1. Introduction ΓòÉΓòÉΓòÉ
  335.  
  336. /dev/EDM2/BookReview 
  337.  
  338. Written by Carsten Whimster 
  339.  
  340. /dev/EDM2/BookReview is a monthly column which focuses on development oriented 
  341. books and materials.  This will mostly consist of programming books, such as 
  342. this month's Learning to Program OS/2 2.0 Presentation Manager by Example, but 
  343. could also cover books like The Design of OS/2.  The column is from a beginning 
  344. PM programmer's eyes (because that's what I am), and hopefully that is most 
  345. useful to the community in general.  As I get on with the column, however, I 
  346. expect to get better, and so within a year or so, I will presumably :)  qualify 
  347. as an intermediate programmer, or perhaps even somewhat of an expert. 
  348. Hopefully you, the readers, will move with me in that respect.  When reading 
  349. this column, try to pick up whichever book strikes your fancy, and join the 
  350. growing group of people following our introductory PM programming columns.  I 
  351. will try to review books aimed at beginners to start with, and then move on 
  352. from there. 
  353.  
  354. The column will largely be demand-oriented (after I get my own books out of the 
  355. way early on), so if you have a book you would like reviewed, send me e-mail 
  356. and tell me about it, or even better, send me the book.  Finally, please send 
  357. me your comments and thoughts so that I can make this column as effective as 
  358. possible.  After all, this is our magazine, and it will be most effective with 
  359. lots of reader feedback. 
  360.  
  361. This month's selection was chosen because I own a copy :), and because it has a 
  362. number of good chapters in it.  It was purchased through IBM. It is obviously 
  363. for the previous version of OS/2, and so does not have any 2.1 features in it. 
  364. However, most of the API is unchanged so there is still lots of useful material 
  365. in it. 
  366.  
  367.  
  368. ΓòÉΓòÉΓòÉ 3.1.2. Errata ΓòÉΓòÉΓòÉ
  369.  
  370. Errata 
  371.  
  372. After the March review I was contacted by someone who told me that the Watcom 
  373. makefile wasn't on the disk that came with Real World Programming for OS/2 2.1. 
  374. I took a quick look, and at first glance he appeared to be right.  I looked a 
  375. little closer, however, and found the file in a:\brief\backup\watcom.mak. 
  376. Fairly well hidden, but there nonetheless. Why it was two levels deep remains a 
  377. mystery, as the other makefiles were in the root directory.  It does look like 
  378. it is a Watcom C386 makefile, though. I don't know enough about their product 
  379. to say whether it will work with Watcom C/C++, but I imagine it probably will. 
  380.  
  381. Some people have commented on Borland problems as well, so here is how to make 
  382. RWPOS2 work with Borland: 
  383.  
  384.  1. edit BORLAND.MAK to say OS2 instead of OS2386 in both TLINK lines. 
  385.  
  386.     OR 
  387.  
  388.     if you have the Toolkit, make sure that BC can find OS2386.LIB . This lets 
  389.     you recompile the programs (link, to be accurate). 
  390.  2. set an environment variable called LIB to point to your BCOS2\LIB 
  391.     directory. This fixes the command-line MAKE command. 
  392.  3. if you don't have the Toolkit (see above), then you will have to edit the 
  393.     definition file from chapter 3 to include these lines to be able to 
  394.     recompile that particular program: 
  395.  
  396.            IMPORTS
  397.               Win32StretchPointer = PMWIN.968
  398.  
  399.  
  400. ΓòÉΓòÉΓòÉ 3.1.3. Learning to Program OS/2 2.0 Presentation Manager by Example ΓòÉΓòÉΓòÉ
  401.  
  402. Learning to Program OS/2 2.0 Presentation Manager by Example 
  403.  
  404. This book has been an eye-opener for me.  When I first bought it, I was a 
  405. little disappointed with the fairly dry presentation, and the only 230 pages. 
  406. As I started reviewing it in earnest, however, I realized that its small size 
  407. is misleading.  Before I go any further, let me list the chapter headings: 
  408.  
  409.  1. Overview 
  410.  2. Working With Messages 
  411.  3. Drawing in the Client Area 
  412.  4. Working With Resources 
  413.  5. Message and Dialog Boxes 
  414.  6. Animation 
  415.  7. Implementing a Help Interface 
  416.  8. Working With Time 
  417.  9. Notable OS/2 2.0 Enhancements 
  418.  
  419. This doesn't look like much on the face of it, but several of these chapters 
  420. are very well written, and give a very good introduction to their material. 
  421. Unfortunately, the installation "program" for the sample code (on a 3.5" disk) 
  422. consists of a series of copy statements, so there is no great learning material 
  423. in that area. 
  424.  
  425. First, I should note that I didn't really get a chance to read very much in 
  426. chapters 3, 6, and 8, so, sorry Q, I don't know if the animation you are 
  427. looking for is in chapter 6 :).  It looks like it is only the imaginative 
  428. application of GpiBitBlt and DosSleep, however, with GpiSetPattern thrown in 
  429. for the fade effect demonstrated.  No sprites.  Chapter 3 looks like a fairly 
  430. good introduction to GPI functions, working with fonts, kerning and so on. 
  431. Chapter 8 contains a brief introduction to using WM_TIMER messages, DosSleep(), 
  432. and threads. 
  433.  
  434. The chapters I did read in depth (chapters 1, 2, 4, 5, and 7) are very good, 
  435. though.  "Overview" is perhaps a bit brief, but I think that most programmers 
  436. prefer getting their feet wet quickly, so no great loss there. 
  437.  
  438. "Working With Messages" introduces the first snippets of code.  By the way, 
  439. this book has only one sample program!  It is a puzzle-type application, in 
  440. which you cut the screen up into a grid, scramble the rectangles, and try to 
  441. put it back together again.  This program eventually grows to be fairly large, 
  442. and serves to introduce a number of important basic areas, but if you are 
  443. looking for a series of diverse applications and lots of sample code, look 
  444. elsewhere.  Having said that, let me explain why this is a good beginner's book 
  445. after all.  The introduction to why PM programs are as strangely laid out as 
  446. they are is quite good, and the code is well documented and explained. This 
  447. chapter lays out the obligatory skeleton program, on which the rest of the 
  448. features are hung along the way. 
  449.  
  450. Each chapter adds its own components to the basic program, until at the end of 
  451. the book, the full source code listing is presented in an appendix.  In this 
  452. manner, "Working With Resources" explains how the various pointers, bitmaps, 
  453. the application icon, the menus, and the accelerator keys are added to the 
  454. application.  This chapter is probably the best written in the book, and goes a 
  455. long way towards explaining why I appreciate this book.  This doesn't mean that 
  456. it goes into incredible depth, merely that each of the relevant resource 
  457. statements is well explained, and the proper usage demonstrated. 
  458.  
  459. "Message and Dialog Boxes" explains how these types of windows are created and 
  460. manipulated, and how they can be used most effectively, but again, there isn't 
  461. great depth here, just very careful explanations. 
  462.  
  463. And so it goes: "Implementing a Help Interface" explains briefly how to use the 
  464. tagging language to make HLP and INF files, and how to interface your 
  465. application to them. It skips some of the more advanced features of IPFC, but 
  466. covers the basics pretty well. 
  467.  
  468. Finally, "Notable OS/2 2.0 Enhancements" discusses the theoretical value of the 
  469. file dialog, the font dialog, the value set control, the slider control, the 
  470. container control, and the notebook control, but gives no code. This, for me, 
  471. was disappointing, since I am trying to add a notebook to my application. 
  472.  
  473. In summary, for the rank novice, this book has some very good explanations, 
  474. including good discussions of the various data structures, but it does not go 
  475. into great depth anywhere.  You will not become an expert in any one field by 
  476. reading this book, but you will have a solid foundation on which to build. 
  477. There aren't very many explanations of calls other than the ones used by the 
  478. author, though.  The language is a little dry, with less humour than I prefer, 
  479. but it is also very competent.  I feel that the description on the back of the 
  480. book is a little ambitious given its size and content.  If this book was 
  481. rewritten with maybe another application or two to explain other techniques, 
  482. more pages, more professional animation techniques, some 2.1 additions, and 
  483. more depth (lotsa code!), especially in chapter 9, I would buy it (again). 
  484. Especially if some chuckles were added. 
  485.  
  486.  
  487. ΓòÉΓòÉΓòÉ 3.1.4. Summary and Ratings ΓòÉΓòÉΓòÉ
  488.  
  489. Summary and Ratings 
  490.  
  491. This book is a bit of a mixed bag.  It completely skips such areas as profile 
  492. management, compatibility with 16 bit code, device drivers, WPS, SOM, and 
  493. numerous others.  It also brushes very lightly over DLLs, common dialogs, 
  494. notebooks, etc.  But, and it is a big "but", it has very good introductory 
  495. chapters on messages, resources (including bitmaps, icons, pointers, menus, and 
  496. accelerator keys), message boxes, dialog boxes, and implementing a help 
  497. interface.  If you are just getting into PM C programming (which I am), these 
  498. chapters explain their material very well, and I went from knowing next to zip 
  499. about resources to writing very nice dialogs, menus, and so on.  It is slim, 
  500. and expensive for its size, but in my case, it is what the doctor prescribed. 
  501. In my humble opinion it needs rewriting for OS/2 2.1, and should have more 
  502. depth in most areas, but it is still a good book for beginners.  Intermediate 
  503. and expert programmer's won't find much in here, though. 
  504.  
  505. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  506. ΓöéBOOK                                ΓöéAUDIENCE    ΓöéMARKΓöéCOMMENTS                                          Γöé
  507. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  508. ΓöéReal World Programming for OS/2 2.1,ΓöéIntermediateΓöéB+  ΓöéLots of good code examples, but sometimes it is   Γöé
  509. ΓöéBlain, Delimon, and English, SAMS   Γöéto Advanced Γöé    Γöétoo complex for novices. Accurate.  Well          Γöé
  510. ΓöéPublishing. ISBN 0-672-30300-0.     ΓöéPM C        Γöé    Γöéorganized.  The index needs a little beefing up.  Γöé
  511. ΓöéUS$40, CAN$50.                      Γöéprogrammers Γöé    ΓöéGood, but not entirely complete how-to reference. Γöé
  512. Γöé                                    Γöé            Γöé    ΓöéGood purchase.                                    Γöé
  513. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  514. ΓöéLearning to Program OS/2 2.0        ΓöéBeginning PMΓöéB-  ΓöéThis book can be both frustrating and very        Γöé
  515. ΓöéPresentation Manager by Example,    ΓöéC           Γöé    Γöérewarding.  It is not very large, and a bit       Γöé
  516. ΓöéKnight, Van Nostrand Reinhold. ISBN ΓöéProgrammers Γöé    Γöépricey, but has some excellent chapters on        Γöé
  517. Γöé0-442-01292-6. US$40, CAN$50.       Γöé            Γöé    Γöébeginning topics, such as messages, resources,    Γöé
  518. Γöé                                    Γöé            Γöé    ΓöéIPF, and dialog boxes.  Strictly for beginners.   Γöé
  519. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  520.  
  521. This table contains all books I have reviewed, so that you can find what you 
  522. are looking for at a glance.  I will be very careful to rate books fairly 
  523. relative to each other, but I will rate conservatively until I get a better 
  524. feel for what's out there.  If I feel a need to adjust ratings, I will adjust 
  525. all of them at the same time, and write a note explaining why I felt this 
  526. necessary, for example, a new book came out which was so good that there wasn't 
  527. enough room at the top of the scale to properly convey this.  :) Please note 
  528. that books aimed at different audiences should only be compared with great 
  529. care, if at all.  I may revise, expand, or add categories in the future.  By 
  530. the way, if you are expecting a Siskel and Ebert type dicing and slicing show, 
  531. you will be disappointed.  I intend to concentrate on the strong points of the 
  532. books I review, since I don't think too many people really deserve being cut up 
  533. for a piece of work they have laboured over.  Having said that, I will  point 
  534. out any weaknesses, but in a constructive manner.  Read the reviews carefully 
  535. for what you are looking for. 
  536.  
  537. BOOK: The name of the book, author(s), publishing company, ISBN, and price 
  538. (approximate.) 
  539.  
  540. AUDIENCE: This is a description of the audience I think the book targets best. 
  541. This is not intended as gospel, just a guideline for people not familiar with 
  542. the book. 
  543.  
  544. MARK:  My opinion of the success of the book's presentation, and how well it 
  545. targets its audience.  Technical content, accuracy, organization, readability, 
  546. and quality of index all weigh heavily here, but the single most important item 
  547. is how well the book covers what it says it covers.  I don't expect to see any 
  548. book score less than C, but the scale is there if necessary. 
  549.  
  550. ΓöîΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  551. ΓöéA+ ΓöéGround-breaking, all-around outstanding book                          Γöé
  552. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  553. ΓöéA  ΓöéExcellent book. This is what I want to see happen a lot               Γöé
  554. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  555. ΓöéA- ΓöéExcellent book with minor flaws                                       Γöé
  556. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  557. ΓöéB+ ΓöéVery good book with minor flaws or omissions                          Γöé
  558. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  559. ΓöéB  ΓöéGood book with some flaws and omissions                               Γöé
  560. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  561. ΓöéB- ΓöéGood book, but in need of improvement                                 Γöé
  562. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  563. ΓöéC  ΓöéMediocre book with some potential, but in need of repairing           Γöé
  564. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  565. ΓöéD  ΓöéDon't buy this book unless you need it, and nothing else exists       Γöé
  566. Γö£ΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  567. ΓöéF  ΓöéDon't buy this book. Period                                           Γöé
  568. ΓööΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  569.  
  570. COMMENTS: This is a summary of the review proper, although in a very brief 
  571. format. 
  572.  
  573.  
  574. ΓòÉΓòÉΓòÉ 3.1.5. Coming Up ΓòÉΓòÉΓòÉ
  575.  
  576. Coming Up 
  577.  
  578. Next month I will be looking at The Art of OS/2 C Programming, Panov, Salomon, 
  579. and Panov, if it gets here in time.  Otherwise I will review Writing OS/2 2.1 
  580. Device Drivers in C, 2nd Edition, Mastrianni. The books I currently intend to 
  581. review are (not necessarily in this order): 
  582.  
  583. o The Art of OS/2 C Programming, Panov, Salomon, and Panov 
  584. o Writing OS/2 2.1 Device Drivers in C, 2nd Edition, Mastrianni 
  585. o OS/2 Presentation Manager GPI, Winn 
  586. o OS/2 Presentation Manager Programming, Petzold - 1994 - not yet published, I 
  587.   am told :( 
  588. o The Design of OS/2, 2nd Edititon, Kogan and Deitel - 1994 - maybe not 
  589.   published yet?  I will review the old version if someone sends me one, but if 
  590.   I have to buy it I will wait for the new edition. 
  591.  
  592. This list is not set in stone, but they are books I am interested in.  I am 
  593. considering reviewing the IBM OS/2 Redbooks, since they are readily and cheaply 
  594. available, and look like good introductory reference.  I am also considering 
  595. reviewing OS/2 Unleashed, but it is not strictly speaking a development book, 
  596. so I'm going to wait until the list of real development books has diminished a 
  597. bit.  By the way, does anyone know why the special edition of OS/2 Unleashed 
  598. has completely different authors?  And what is different about the Special 
  599. Edition? 
  600.  
  601. I would also like to review a REXX book, as I have VX-REXX 2.0, but I don't 
  602. really know what books are supposed to be good, so if anyone has ideas here, 
  603. please write. 
  604.  
  605. If anyone has a book they want to see reviewed, I will be happy to oblige as 
  606. long as I can afford it.  Of course, the request could be satisfied a lot 
  607. quicker if accompanied by a book.  :) 
  608.  
  609.  
  610. ΓòÉΓòÉΓòÉ 3.2. C++ Corner ΓòÉΓòÉΓòÉ
  611.  
  612.  
  613. ΓòÉΓòÉΓòÉ 3.2.1. Queues Continued ΓòÉΓòÉΓòÉ
  614.  
  615. Written by Gordon Zeglinski 
  616.  
  617. Queues Continued 
  618.  
  619. We start by looking at what we have accomplished last time.  In the last issue, 
  620. OS/2 queues were encapsulated and a very simple shared memory management scheme 
  621. was developed to manage the memory used by the queues.  It was found that this 
  622. scheme was next to useless for real applications.  In the last issue, we 
  623. concluded that in order to have a more usable queue object, we need better 
  624. memory management.  So now the goal is to develop a new method for using the 
  625. shared memory.  In this issue we start by looking for a new memory management 
  626. scheme.  Fortunately, OS/2 already provides a mechanism that fits our needs - 
  627. suballocation!  Yeah that's the ticket. 
  628.  
  629. The Saga Begins 
  630.  
  631. After a day of frustration, a short email is sent. Following is a paraphrased 
  632. transcript: 
  633.  
  634. "Hey Lar, U ever use DosSubSetMem with shared Memory?"
  635.  
  636. "No, but try a simple example and work from there ..."
  637.  
  638. "Sounds like a good idea to me..."
  639.  
  640.  
  641. ΓòÉΓòÉΓòÉ 3.2.2. Off to the Races ΓòÉΓòÉΓòÉ
  642.  
  643. Off to the Races 
  644.  
  645. Something simple...hmmm...Okay, lets try this: 
  646.  
  647. #define INCL_DOSMEMMGR
  648. #include <os2.h>
  649.  
  650. #include <iostream.h>
  651. #include <conio.h>
  652.  
  653.  
  654. void main() {
  655.    int ret;
  656.    void *BaseAddr,*SubAdr;
  657.    char *MemoryName="\\SHAREMEM\\Mem.Mem";
  658.  
  659. //Allocate some shared memory
  660.    ret=DosAllocSharedMem(&BaseAddr,MemoryName,1024*30,
  661.          PAG_EXECUTE|PAG_READ|PAG_WRITE);
  662.    cout<<"Alloc Return : "<<ret<<endl;
  663.    cout<<"Base Adr : "<<BaseAddr<<endl;
  664.  
  665. //Prepare shared Memory for sub allocation
  666.    ret=DosSubSetMem(BaseAddr,DOSSUB_SPARSE_OBJ|DOSSUB_SERIALIZE|DOSSUB_INIT,
  667.                         1024*30);
  668.    cout<<"SubSet Return : "<<ret<<endl;
  669.  
  670.    cout<<"Press Return"<<endl;
  671.    getch();
  672.  
  673. //suballocate a bit of memory
  674.    ret=DosSubAllocMem(BaseAddr,&SubAdr,1024);
  675.    cout<<"SubAlloc Return : "<<ret<<endl;
  676.    cout<<"SubAlloc Adr : "<<SubAdr<<endl;
  677.  
  678.    cout<<"Press Return"<<endl;
  679.    getch();
  680.  
  681. //free the suballocated ram
  682.    ret=DosSubFreeMem(BaseAddr,SubAdr,1024);
  683.    cout<<"SubFree Return : "<<ret<<endl;
  684.  
  685.    cout<<"Press Return"<<endl;
  686.    getch();
  687.  
  688. //Uninitialze suballocation struvtures
  689.    ret=DosSubUnsetMem(BaseAddr);
  690.    cout<<"SubUnSet Return : "<<ret<<endl;
  691.  
  692. //Free up the main memory block
  693.    ret=DosFreeMem(BaseAddr);
  694.    cout<<"FreeBase Return : "<<ret<<endl;
  695. }
  696.  
  697. The above program creates a heap in shared memory, prepares it for 
  698. suballocation, suballocates a chunk of the heap, and frees everything up. 
  699. That's simple enough, and it even works! 
  700.  
  701. Time to make it a bit more interesting.  The following program is to be 
  702. executed after the program above.  The reason the program above has the "Press 
  703. Return" messages in it is so that it can be paused long enough for this 
  704. following program to be run. 
  705.  
  706. #define INCL_DOSMEMMGR
  707. #include <os2.h>
  708.  
  709. #include <iostream.h>
  710. #include <conio.h>
  711.  
  712.  
  713. void main() {
  714.    int ret;
  715.    void *BaseAddr,*SubAdr;
  716.    char *MemoryName="\\SHAREMEM\\Mem.Mem";
  717.  
  718.    ret=DosGetNamedSharedMem(&BaseAddr,MemoryName,
  719.          PAG_READ|PAG_WRITE|PAG_EXECUTE);
  720.    cout<<"Open Return : "<<ret<<endl;
  721.    cout<<"Base Adr : "<<BaseAddr<<endl;
  722.  
  723. //Get access to the named shared memory
  724.    ret=DosSubSetMem(BaseAddr,DOSSUB_SPARSE_OBJ|DOSSUB_SERIALIZE,
  725.                         1024*30);
  726.    cout<<"SubSet Return : "<<ret<<endl;
  727.  
  728.    cout<<"Press Return"<<endl;
  729.    getch();
  730.  
  731.    ret=DosSubAllocMem(BaseAddr,&SubAdr,1024);
  732.    cout<<"SubAlloc Return : "<<ret<<endl;
  733.    cout<<"SubAlloc Adr : "<<SubAdr<<endl;
  734.  
  735.    cout<<"Press Return"<<endl;
  736.    getch();
  737.  
  738.    ret=DosSubFreeMem(BaseAddr,SubAdr,1024);
  739.    cout<<"SubFree Return : "<<ret<<endl;
  740.  
  741.    cout<<"Press Return"<<endl;
  742.    getch();
  743.  
  744.    ret=DosSubUnsetMem(BaseAddr);
  745.    cout<<"SubUnSet Return : "<<ret<<endl;
  746.  
  747.    ret=DosFreeMem(BaseAddr);
  748.    cout<<"FreeBase Return : "<<ret<<endl;
  749. }
  750.  
  751. This one works too!  So what was the big deal?  As it turns out, the size 
  752. parameter in the call to DosSubSetMem() must be the same in both processes. 
  753. This doesn't really make sense to me, as one would think that the second 
  754. process would be able to know the size used by the first process. After all, 
  755. the memory block is already initialized by the first process.  The thing that 
  756. bothered me the most about the DosSubSetMem() call, is that it returns error 
  757. codes which aren't even documented as being returned by this function!  This 
  758. certainly didn't make life any easier the first time. 
  759.  
  760. Included Files 
  761.  
  762. Compiled versions of the above code are included as MEMCREATE and MEMOPEN. 
  763. When executing these programs, MEMCREATE must be executed first and be paused 
  764. at one of the "Press Enter" requests before MEMOPEN can be started.  For fun, 
  765. try running these programs while stopping them at different "Press Enter" 
  766. requests.  What you will notice, is that the allocated pointers offset will 
  767. vary depending on where the other program is stopped.  This indicates that the 
  768. memory block is being properly shared by the two processes. 
  769.  
  770. The Memory API 
  771.  
  772. We've used many of the memory management function found in the Dos* API. A 
  773. quick overview follows : 
  774.  
  775.  
  776.  API Call                 Function
  777.  
  778.  DosAllocSharedMem        Allocate a block of named or
  779.                           unnamed shared memory.
  780.  
  781.  DosGetNamedSharedMem     Get access to a named block of
  782.                           shared memory.
  783.  
  784.  DosSubSetMem             Initialize memory for
  785.                           suballocation if DOSSUB_INIT
  786.                           is used; otherwise, it
  787.                           attaches to an existing block
  788.                           of memory (provided
  789.                           DOSSUB_GROW is not used)
  790.  
  791.  DosSubAllocMem           Allocate a chunk of ram from
  792.                           the heap created by
  793.                           DosSubSetMem.
  794.  
  795.  DosSubFreeMem            Return memory to the heap.
  796.  
  797.  DosSubUnsetMem           Undo the effects of
  798.                           DosSubSetMem.
  799.  
  800.  DosFreeMem               Free the memory allocated by
  801.                           DosAllocSharedMem.
  802.  
  803. More details on these functions can be found in Control Program Guide and 
  804. Reference. 
  805.  
  806. To emphasize an important detail, when DosSubSetMem() is used with shared 
  807. memory, the length parameter must be the same in all processes using the shared 
  808. memory block. 
  809.  
  810.  
  811. ΓòÉΓòÉΓòÉ 3.2.3. Back to OOP ΓòÉΓòÉΓòÉ
  812.  
  813. Back to OOP 
  814.  
  815. Memory Objects 
  816.  
  817. The key to our new and improved Queue objects is better use of shared memory. 
  818. Shared memory uses the same API as private memory.  This gives us an 
  819. opportunity to flex our OOP muscles a bit by creating a hierarchy that has the 
  820. potential to encapsulate both shared and non-shared memory. 
  821.  
  822.  
  823.              ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  824.              ΓöéMemoryObjΓöé
  825.              ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  826.               Γöé       Γöé
  827. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ   ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  828. ΓöéSharedMemoryObjΓöé   ΓöéPrivateMemoryObjΓöé
  829. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ   ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  830.  
  831.  
  832. Memory Object Hierarchy 
  833.  
  834. Although we won't develop the PrivateMemoryObj here, it's prototype is included 
  835. in the header file for the memory objects.  The difference between the shared 
  836. and private memory objects, is that the private memory object would use 
  837. DosAllocMem() instead of DosAllocSharedMem() to allocate memory for the heap. 
  838.  
  839. MemoryObj 
  840.  
  841. As the base of this hierarchy, this class provides methods and data members 
  842. which encapsulate properties which are common to both private and shared 
  843. memory.  These properties are: a base address, methods for suballocation, and a 
  844. method to free the base memory. 
  845.  
  846. SharedMemoryObj and PrivateMemoryObj 
  847.  
  848. These classes provide the methods necessary to create or gain access to the 
  849. base memory block.  In the case of shared memory, the name of the memory block 
  850. is also stored. 
  851.  
  852. Included Files 
  853.  
  854. The files MEMOBJ.H and MEMOBJ.CPP contain all the source code necessary to 
  855. compile the MemoryObj and SharedMemoryObj objects. 
  856.  
  857. New and Improved Queues 
  858.  
  859. One of the nice things about OOP is that even though the internals of an object 
  860. are changed, code external to the object can use it without modification 
  861. providing the objects interface remains the same.  This is almost the case 
  862. here.  The queue client remains the same.  However, because memory is now 
  863. "officially allocated" in the client, the queue server now has to deallocate 
  864. the memory the queue client allocates.  The new version of the server code 
  865. follows. 
  866.  
  867. int main() {
  868.  
  869.    int loop;
  870.    QueueMessage *Mesg;
  871.    EventSemaphore Sem((char*)NULL,Semaphore::SemCreate,DC_SEM_SHARED);
  872.  
  873.    ServerQueueObj InQueue(SMemName,NemSize,QName,0,&Sem);
  874.  
  875.  
  876.    loop=1;
  877.  
  878.    Sem.Reset();
  879.  
  880.    cout<<"Queue Server Active !"<<endl;
  881.  
  882.    while(loop){
  883.  
  884.       Mesg=(QueueMessage *) InQueue.Read(0,1);
  885.       while(InQueue.GetError() ){
  886.          Sem.Wait();
  887.          Mesg=(QueueMessage *) InQueue.Read(0,1);
  888.       }
  889.  
  890.       if(Mesg->Number == -1){
  891.          loop=0;
  892.          cout<<"Terminating"<<endl;
  893.       }
  894.       else{
  895.          cout<<"Number= "<<Mesg->Number<<endl;
  896.       }
  897.       InQueue.FreeLastReadMem();
  898.    }
  899.  
  900. return 0;
  901. }
  902.  
  903. We now have queue objects which are not limited by the way they use shared 
  904. memory.  Our goal has been accomplished. 
  905.  
  906. Included Files 
  907.  
  908. Only the files QUEUEOBJ.CPP, QUEUEOBJ.H, and QSERVE.CPP are different than 
  909. those included in part one of this column.  However, for convenience, the 
  910. complete set of files will be included. 
  911.  
  912.  
  913. ΓòÉΓòÉΓòÉ 3.2.4. Summary ΓòÉΓòÉΓòÉ
  914.  
  915. Summary 
  916.  
  917. Building upon our experience with shared memory from last issue, we developed a 
  918. new memory hierarchy.  The memory hierarchy was developed only far enough as to 
  919. be useful to manipulate the shared memory pool used by the queue objects. 
  920. Extending it further is left as an exercise to the reader.  The new queue 
  921. objects are not limited by the shared memory allocation scheme as were the ones 
  922. developed last time. 
  923.  
  924.  
  925. ΓòÉΓòÉΓòÉ 3.3. Introduction to PM Programming ΓòÉΓòÉΓòÉ
  926.  
  927.  
  928. ΓòÉΓòÉΓòÉ 3.3.1. Introduction ΓòÉΓòÉΓòÉ
  929.  
  930. Written by Larry Salomon, Jr. 
  931.  
  932. Introduction 
  933.  
  934. The purpose of this column is to provide the readers out there who are not 
  935. familiar with PM application development the information necessary to satisfy 
  936. their curiousity, educate themselves, and give them an advantage over the 
  937. documentation supplied by IBM.  Of course, much of this stuff could probably be 
  938. found in one of the many books out there, but the problem with books in general 
  939. is that they don't answer the questions you have after you read the book the 
  940. first time through. 
  941.  
  942. I will gladly entertain feedback from the readers about what was "glossed over" 
  943. or what was detailed well, what tangential topics need to be covered and what 
  944. superfluous crap should have been removed.  This feedback is essential in 
  945. guaranteeing that you get what you pay for.  :) 
  946.  
  947. It should be said that you must not depend solely on this column to teach you 
  948. how to develop PM applications; instead, this should be viewed as a supplement 
  949. to your other information storehouses (books, the network conferences, etc.). 
  950. Because this column must take a general approach, there will be some topics 
  951. that you would like to see discussed that really do not belong here.  Specific 
  952. questions can be directed to the Scratch Patch, where an attempt to answer them 
  953. will be made. 
  954.  
  955.  
  956. ΓòÉΓòÉΓòÉ 3.3.2. Last Month ΓòÉΓòÉΓòÉ
  957.  
  958. Last Month 
  959.  
  960. Last month, we began looking at dialog boxes and their components.  This month, 
  961. we'll continue by delving into the source code to HELLO which was presented 
  962. last month.  We'll examine the messages in our dialog procedure, and will begin 
  963. looking at how controls are used within dialogs. 
  964.  
  965.  
  966. ΓòÉΓòÉΓòÉ 3.3.3. nameDlgProc() ΓòÉΓòÉΓòÉ
  967.  
  968. nameDlgProc() 
  969.  
  970. Below is the dialog procedure from HELLO.C condensed a bit: 
  971.  
  972. MRESULT EXPENTRY nameDlgProc(HWND hwndWnd,
  973.                              ULONG ulMsg,
  974.                              MPARAM mpParm1,
  975.                              MPARAM mpParm2)
  976. {
  977.    switch (ulMsg) {
  978.    case WM_INITDLG:
  979.         :
  980.       break;
  981.    case WM_CONTROL:
  982.          :
  983.       break;
  984.    case WM_COMMAND:
  985.          :
  986.       break;
  987.    default:
  988.       return WinDefDlgProc(hwndWnd,ulMsg,mpParm1,mpParm2);
  989.    } /* endswitch */
  990.  
  991.    return MRFROMSHORT(FALSE);
  992. }
  993.  
  994. We looked at the WM_INITDLG message last issue; let's take a look at the other 
  995. two. 
  996.  
  997. WM_COMMAND 
  998.  
  999. This message occurs when a command is to be performed, or when a key 
  1000. combination is translated to a WM_COMMAND accelerator message. 
  1001.  
  1002. Parameters 
  1003.  
  1004.    param1 
  1005.  
  1006.       usId (USHORT) 
  1007.  
  1008.          Identifier of the command or accelerator key. 
  1009.  
  1010.       usSource (USHORT) 
  1011.  
  1012.          A CMDSRC_* constant describing the source of the message 
  1013.  
  1014.    param2 
  1015.  
  1016.       bPointer (BOOL) 
  1017.  
  1018.          Pointer indicator 
  1019.  
  1020.          TRUE      The message is the result of a pointer action. 
  1021.          FALSE     The message is the result of a keyboard action. 
  1022.  
  1023. Returns 
  1024.  
  1025.    reply 
  1026.  
  1027.       ulReserved (BIT32) 
  1028.  
  1029.          Reserved, and must be zero. 
  1030.  
  1031. WM_CONTROL 
  1032.  
  1033. This message occurs when a control has a significant event to report to its 
  1034. owner. 
  1035.  
  1036. Parameters 
  1037.  
  1038.    param1 
  1039.  
  1040.       usId (USHORT) 
  1041.  
  1042.          Identifier of the control sending the notification. 
  1043.  
  1044.       usNotify (USHORT) 
  1045.  
  1046.          The notification code.  This is specific to the window class of the 
  1047.          control. 
  1048.  
  1049.    param2 
  1050.  
  1051.       pvData (PVOID) 
  1052.  
  1053.          Control data.  This is specific to the notification code being sent. 
  1054.  
  1055. Returns 
  1056.  
  1057.    reply 
  1058.  
  1059.       ulReserved (BIT32) 
  1060.  
  1061.          Reserved, and must be zero. 
  1062.  
  1063. Okay, "big deal," you say.  Just add two more entries to your list of messages 
  1064. that you now know about?  Well, these messages are a bit more important than 
  1065. that... 
  1066.  
  1067.  
  1068. ΓòÉΓòÉΓòÉ 3.3.4. The WM_COMMAND Message ΓòÉΓòÉΓòÉ
  1069.  
  1070. The WM_COMMAND Message 
  1071.  
  1072. The WM_COMMAND message is important because it is the focal point through which 
  1073. your application will get notified that something needs to get done.  Among 
  1074. other things... 
  1075.  
  1076. o menu items send this message when they are selected 
  1077. o pushbuttons send this message when they are selected 
  1078. o the frame window sends this message whenever the user presses a key 
  1079.   combination that is defined in the accelerator table 
  1080. o dialogs automatically receive this whenever Enter or Escape are pressed. 
  1081.  
  1082. It doesn't look like much, but as you travel the PM developer's journey, you'll 
  1083. find that this message is frequently sent.  It becomes your central interface 
  1084. to the user, since most actions are requested by the user through menus on 
  1085. client windows and through pushbuttons on dialogs. 
  1086.  
  1087. Let's take a look at how this message is treated in HELLO.C. 
  1088.  
  1089. case WM_COMMAND:
  1090.    switch (SHORT1FROMMP(mpParm1)) {
  1091.    case DID_OK:
  1092.       WinDismissDlg(hwndWnd,TRUE);
  1093.       break;
  1094.    case DID_CANCEL:
  1095.       WinDismissDlg(hwndWnd,FALSE);
  1096.       break;
  1097.    default:
  1098.       return WinDefDlgProc(hwndWnd,ulMsg,mpParm1,mpParm2);
  1099.    } /* endswitch */
  1100.    break;
  1101.  
  1102. It isn't obvious in the documentation, if I remember correctly, so don't feel 
  1103. ashamed if you don't understand the constants DID_OK and DID_CANCEL. 
  1104.  
  1105. DID_OK              Sent whenever the user presses Enter 
  1106. DID_CANCEL          Sent whenever the user presses Escape 
  1107.  
  1108. It is imperative that you understand that these messages are not sent by 
  1109. pushbuttons.  Thus, even though your dialog might not have pushbuttons, it is 
  1110. possible to receive these messages.  (If you don't believe me, comment out the 
  1111. DEFPUSHBUTTON and PUSHBUTTON lines in HELLO.RC, recompile and try.) 
  1112.  
  1113. Dismissal Revisited 
  1114.  
  1115. When reading last month's column, I realized that I was talking about the 
  1116. dismissal of dialogs like we were all old pro's at it; if we were, I thought, 
  1117. this column wouldn't have a reason for existance. 
  1118.  
  1119. BOOL WinDismissDlg(HWND hwndDlg,ULONG ulResult);
  1120.  
  1121. This function is used to dismiss a dialog.  As was mentioned last time, this 
  1122. does not destroy the dialog by default; it only hides the dialog.  What does 
  1123. this have to do with the WM_COMMAND message? Well, the typical action for 
  1124. DID_OK and DID_CANCEL is to dismiss the dialog (for DID_OK, data is usually 
  1125. read from the dialog also and verified), so you can see that this function is 
  1126. used frequently. 
  1127.  
  1128. In the above, no data is read from the dialog.  How does the program know what 
  1129. name to display?... 
  1130.  
  1131.  
  1132. ΓòÉΓòÉΓòÉ 3.3.5. The WM_CONTROL Message ΓòÉΓòÉΓòÉ
  1133.  
  1134. The WM_CONTROL Message 
  1135.  
  1136. What happens whenever an item in a listbox is selected?  Or whenever the text 
  1137. in an entryfield changes?  Or when a checkbox is clicked on by the user? For 
  1138. all of these, and many other events, the owner of the control is sent a 
  1139. WM_CONTROL message, meaning that something occurred that could have an effect 
  1140. on the behavior of the application. 
  1141.  
  1142. This is a broad message, which has a specific set of parameters based on two 
  1143. criteria: 
  1144.  
  1145.  1. the class of the control sending the message 
  1146.  2. the event that generate the message 
  1147.  
  1148. Thus, for the first scenario, the usNotify is LN_SELECT, and pvData is the 
  1149. handle of the listbox.  For the second, usNotify is EN_CHANGE and pvData is the 
  1150. handle of the entryfield.  And so on... 
  1151.  
  1152. case WM_CONTROL:
  1153.    switch (SHORT1FROMMP(mpParm1)) {
  1154.    case DNAME_LB_NAMELIST:
  1155.       switch (SHORT2FROMMP(mpParm1)) {
  1156.       case LN_SELECT:
  1157.          {
  1158.             HWND hwndLb;
  1159.             SHORT sIndex;
  1160.  
  1161.             hwndLb=WinWindowFromID(hwndWnd,DNAME_LB_NAMELIST);
  1162.  
  1163.             sIndex=WinQueryLboxSelectedItem(hwndLb);
  1164.             WinQueryLboxItemText(hwndLb,
  1165.                                  sIndex,
  1166.                                  pndiInfo->achName,
  1167.                                  sizeof(pndiInfo->achName));
  1168.  
  1169.             WinSetDlgItemText(hwndWnd,
  1170.                               DNAME_EF_NAME,
  1171.                               pndiInfo->achName);
  1172.          }
  1173.          break;
  1174.       case LN_ENTER:
  1175.          WinPostMsg(hwndWnd,WM_COMMAND,MPFROMSHORT(DID_OK),0);
  1176.          break;
  1177.       default:
  1178.          return WinDefDlgProc(hwndWnd,ulMsg,mpParm1,mpParm2);
  1179.       } /* endswitch */
  1180.       break;
  1181.    default:
  1182.       return WinDefDlgProc(hwndWnd,ulMsg,mpParm1,mpParm2);
  1183.    } /* endswitch */
  1184.    break;
  1185.  
  1186. You probably don't understand the specific functions, but you can see for 
  1187. yourself by running the application that, whenever an item is selected in the 
  1188. listbox, the name selected is placed in the entryfield. 
  1189.  
  1190. .And the Point is... 
  1191.  
  1192. The point of introducing the WM_COMMAND and WM_CONTROL messages is to 
  1193. demonstrate the usefulness of them.  As we begin to look at the controls, we 
  1194. will examine how they interact with the application through these messages; 
  1195. careful exploitation will (eventually) allow you to control the execution of 
  1196. your application. 
  1197.  
  1198.  
  1199. ΓòÉΓòÉΓòÉ 3.3.6. New Functions ΓòÉΓòÉΓòÉ
  1200.  
  1201. New Functions 
  1202.  
  1203. In addition to the WinDismissDlg() function, we will look at three additional 
  1204. PM APIs. 
  1205.  
  1206. BOOL WinSetWindowText(HWND hwndWnd,PSZ pszText);
  1207.  
  1208. LONG WinQueryWindowText(HWND hwndWnd,LONG lSzBuf,PSZ pszBuffer);
  1209.  
  1210. LONG WinQueryWindowTextLength(HWND hwndWnd);
  1211.  
  1212. WinSetWindowText sets the text of the specified window to the specified value. 
  1213. It returns a success flag. 
  1214.  
  1215. WinQueryWindowText queries the text of the specified window and copies up to 
  1216. either the end of the text or lSzBuf characters into the buffer pointed to by 
  1217. pszBuffer.  It returns the number of characters copied. 
  1218.  
  1219. WinQueryWindowTextLength returns the length of the text for the specified 
  1220. window. 
  1221.  
  1222. It is important to note that how the window text is actually used differs from 
  1223. control to control.  For example, the window text of an entryfield is what is 
  1224. displayed in the entryfield itself.  This is also true for a titlebar. However, 
  1225. a listbox has many text entries, which cannot be described by a single text 
  1226. item so it ignores the window text.  Some controls use their window text in 
  1227. other ways.  A frame, for example, notices when its window text changes and 
  1228. updates the titlebar's window text, if a titlebar exists. 
  1229.  
  1230. In other words, your mileage may vary.  :) 
  1231.  
  1232.  
  1233. ΓòÉΓòÉΓòÉ 3.3.7. Summary ΓòÉΓòÉΓòÉ
  1234.  
  1235. Summary 
  1236.  
  1237. This month we introduced two very important messages - WM_COMMAND and 
  1238. WM_CONTROL - and described their purpose in a window or dialog procedure.  We 
  1239. also looked at four new PM APIs and looked at window text for the first time 
  1240. since they were mentioned in volume 2, issue 1. 
  1241.  
  1242. Next month, we will continue with HELLO by begining to examine the controls 
  1243. within it individually. 
  1244.  
  1245.  
  1246. ΓòÉΓòÉΓòÉ 3.4. Scratch Patch ΓòÉΓòÉΓòÉ
  1247.  
  1248. Written by Larry Salomon, Jr. 
  1249.  
  1250. Welcome to this month's "Scratch Patch"!  Each month, I collect various items 
  1251. that fit into this column sent to me via email. The ones that I feel contribute 
  1252. the most to developers, whether in terms of information or as a nifty trick to 
  1253. tuck into your cap, get published in this column. 
  1254.  
  1255. To submit an item, send it via email to my address - os2man@panix.com - and be 
  1256. sure to grant permission to publish it (those that forget will not be 
  1257. considered for publication).  This month, we have the following: 
  1258.  
  1259. o Questions and Answers 
  1260. o Snippet(s) of the Month 
  1261. o Want Ads 
  1262.  
  1263.  
  1264. ΓòÉΓòÉΓòÉ 3.4.1. Questions and Answers ΓòÉΓòÉΓòÉ
  1265.  
  1266. Questions and Answers 
  1267.  
  1268. Ed Blackman (ebb7683@venus.tamu.edu) writes: 
  1269.  
  1270. Here's the question: 
  1271.  
  1272. Where does OS/2 store its default icons/bitmaps, and how can I access them in 
  1273. my programs?  Say, for instance, I wanted to have a container that looks just 
  1274. like the default folder.  I could just get a copy of the icon of a default 
  1275. folder (by invoking the Icon Editor from the General page of the Settings 
  1276. notebook), but it seems wasteful to make a copy when the original has to be 
  1277. around somewhere. 
  1278.  
  1279. The answer to this is tricky, since OS/2 stores them in many places.  A long 
  1280. time ago, it was really easy since PMWIN.DLL was the only PM DLL per se.  Now, 
  1281. we also have a mess of auxilliary DLLs and also the WPS DLL (PMWP.DLL) to 
  1282. consider. 
  1283.  
  1284. The bottom line, however, is that - unless you can get at the icon or bitmap 
  1285. through the PM APIs - you're going to have to copy them into your own resource 
  1286. file anyway.  The APIs I am alluding to are WinGetSysBitmap and 
  1287. WinQuerySysPointer. 
  1288.  
  1289. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ 
  1290.  
  1291. Semir Patel (spatel@cs.utexas.edu) writes: 
  1292.  
  1293. Is it possible to change the priorities of processes/threads of processes that 
  1294. are not direct descendants of the current process? I haven't found a documented 
  1295. API that will do such a thing, but maybe someone knows of some undocumented 
  1296. API's that will handle the above. Thanks. 
  1297.  
  1298. Unfortunately, there is no API that I know of that will do what you are asking. 
  1299. The issue here is one of security; an OS designer cannot implement something 
  1300. like this and hope to have any semblence of security.  For example, you could - 
  1301. if such a function existed - bring the system to a crawl by setting the 
  1302. priority of the WPS to idle time, -30.  That wouldn't be a good thing, I am 
  1303. sure.  :) 
  1304.  
  1305.  
  1306. ΓòÉΓòÉΓòÉ 3.4.2. Snippet(s) of the Month ΓòÉΓòÉΓòÉ
  1307.  
  1308. Snippet(s) of the Month 
  1309.  
  1310. Yet another month with no submissions from the readers, so I have pulled out 
  1311. another (after doing some searching this time...I'm running out of these) 
  1312. function that I have found quite useful in the past. 
  1313.  
  1314. BOOL sizeMajorTabs(HWND hwndNb)
  1315. //-------------------------------------------------------------------------
  1316. // This function sizes the major tabs of a notebook according to the
  1317. // largest text.
  1318. //
  1319. // Input:  hwndNb - handle of the notebook
  1320. // Returns:  TRUE if successful, FALSE otherwise
  1321. //-------------------------------------------------------------------------
  1322. {
  1323.    HPS hpsTemp;
  1324.    SIZEL szlMax;
  1325.    ULONG ulMajor;
  1326.    ULONG ulPage;
  1327.    CHAR achText[256];
  1328.    BOOKTEXT btText;
  1329.    POINTL aptlBox[TXTBOX_COUNT];
  1330.    ULONG ulStyle;
  1331.  
  1332.    hpsTemp=WinGetPS(hwndNb);
  1333.  
  1334.    szlMax.cx=0;
  1335.    szlMax.cy=0;
  1336.  
  1337.    ulMajor=LONGFROMMR(WinSendMsg(hwndNb,
  1338.                                  BKM_QUERYPAGEID,
  1339.                                  MPFROMLONG(0),
  1340.                                  MPFROM2SHORT(BKA_FIRST,BKA_MAJOR)));
  1341.    while (ulMajor!=0) {
  1342.       ulPage=ulMajor;
  1343.  
  1344.       while (ulPage!=0) {
  1345.          btText.pString=achText;
  1346.          btText.textLen=sizeof(achText);
  1347.  
  1348.          WinSendMsg(hwndNb,
  1349.                     BKM_QUERYTABTEXT,
  1350.                     MPFROMLONG(ulPage),
  1351.                     MPFROMP(&btText));
  1352.  
  1353.          GpiQueryTextBox(hpsTemp,
  1354.                          strlen(btText.pString),
  1355.                          btText.pString,
  1356.                          TXTBOX_COUNT,
  1357.                          aptlBox);
  1358.  
  1359.          aptlBox[TXTBOX_TOPRIGHT].x-=aptlBox[TXTBOX_BOTTOMLEFT].x;
  1360.          aptlBox[TXTBOX_TOPRIGHT].y-=aptlBox[TXTBOX_BOTTOMLEFT].y;
  1361.  
  1362.          szlMax.cx=max(szlMax.cx,aptlBox[TXTBOX_TOPRIGHT].x);
  1363.          szlMax.cy=max(szlMax.cy,aptlBox[TXTBOX_TOPRIGHT].y);
  1364.  
  1365.          ulPage=LONGFROMMR(WinSendMsg(hwndNb,
  1366.                                       BKM_QUERYPAGEID,
  1367.                                       MPFROMLONG(ulPage),
  1368.                                       MPFROM2SHORT(BKA_NEXT,0)));
  1369.          if (ulPage!=0) {
  1370.             ulStyle=LONGFROMMR(WinSendMsg(hwndNb,
  1371.                                           BKM_QUERYPAGESTYLE,
  1372.                                           MPFROMLONG(ulPage),
  1373.                                           0));
  1374.             if ((ulStyle & BKA_MAJOR)!=0) {
  1375.                ulPage=0;
  1376.             } /* endif */
  1377.          } /* endif */
  1378.       } /* endwhile */
  1379.  
  1380.       ulMajor=LONGFROMMR(WinSendMsg(hwndNb,
  1381.                                     BKM_QUERYPAGEID,
  1382.                                     MPFROMLONG(ulMajor),
  1383.                                     MPFROM2SHORT(BKA_NEXT,BKA_MAJOR)));
  1384.    } /* endwhile */
  1385.  
  1386.    WinReleasePS(hpsTemp);
  1387.  
  1388.    WinSendMsg(hwndNb,
  1389.               BKM_SETDIMENSIONS,
  1390.               MPFROM2SHORT(szlMax.cx*4/3,szlMax.cy*3/2),
  1391.               MPFROMSHORT(BKA_MAJORTAB));
  1392.  
  1393.    return TRUE;
  1394. }
  1395.  
  1396.  
  1397. ΓòÉΓòÉΓòÉ 3.4.3. Want Ads ΓòÉΓòÉΓòÉ
  1398.  
  1399. Want Ads 
  1400.  
  1401. Below are the hot topics as of this issue's writing.  Feel free to write on any 
  1402. of these. 
  1403.  
  1404. Workplace Shell Programming (hot) - lately, I have noticed two things: 1) lots 
  1405. of people want to learn how to write new Workplace Shell classes and 2) no one 
  1406. who knows anything about it is telling the rest of us how to do it. 
  1407.  
  1408. Client/Server (hot) - using either named pipes (with or without a network) or 
  1409. sockets, client/server programming is all the rage these days.  On a related 
  1410. note, some people have also expressed an interest in learning about interfacing 
  1411. with the various protocol drivers (e.g.  NDIS, IPX/SPX, etc.).  Any articles in 
  1412. this area are most welcome. 
  1413.  
  1414. Multimedia (warm) - last month we had two articles on this topic.  However, 
  1415. they both dealt with sound, which we all know is not the only alternative media 
  1416. type.  Articles on anything else - MIDI, video, etc. - are needed. 
  1417.  
  1418. Animation (warm) - a few readers expressed an interest in the various animation 
  1419. techniques that can be applied to PM applications.  The ultimate article, in my 
  1420. opinion, would be one that develops a sprite library a la the Commodore 64's 
  1421. (and Amiga's?) built-in routines, since this is probably the hardest component 
  1422. of any good animation sequence.  Call this a "personal request"... 
  1423.  
  1424.  
  1425. ΓòÉΓòÉΓòÉ 4. How do I get EDM/2? ΓòÉΓòÉΓòÉ
  1426.  
  1427. EDM/2 can be obtained in any of the following ways: 
  1428.  
  1429. On the Internet 
  1430.  
  1431. o All back issues are available via anonymous FTP from ftp.cdrom.com in the 
  1432.   /pub/os2/2_x/program/newsltr directory. 
  1433. o The EDM/2 mailing list.  Send an empty message to edm2-info@knex.via.mind.org 
  1434.   to receive a file containing (among other things) instructions for 
  1435.   subscribing to EDM/2.  This is a UUCP connection, so be patient please. 
  1436. o IBM's external gopher/WWW server in Almaden. The address is 
  1437.   index.almaden.ibm.com and it is in the "Non-IBM-Originated" submenu of the 
  1438.   "OS/2 Information" menu; the URL is 
  1439.   "gopher://index.almaden.ibm.com/1nonibm/os2nonib.70". 
  1440.  
  1441. On Compuserve 
  1442.  
  1443. All back issues are available in the OS/2 Developers Forum 2. 
  1444.  
  1445. IBM Internal 
  1446.  
  1447. o IBM's internal gopher/WWW server in Almaden. The address is 
  1448.   n6tfx.almaden.ibm.com and it is in the "Non-IBM-Originated Files" menu; the 
  1449.   URL is "gopher://n6tfx.almaden.ibm.com/1!!nonibm/nonibm.70". 
  1450. o IBM's REQUEST command on all internal VM systems.  Enter the VM command 
  1451.   REQUEST LIST FROM ASSELIN AT RALVM12 and a list of the requestable packages 
  1452.   will be sent to you; in this list are the names of the packages containing 
  1453.   the EDM/2 issues. 
  1454.  
  1455.  
  1456. ΓòÉΓòÉΓòÉ 5. Contributors to this Issue ΓòÉΓòÉΓòÉ
  1457.  
  1458. Are You a Potential Author? 
  1459.  
  1460. We are always looking for (new) authors.  If you have a topic about which you 
  1461. would like to write, send a brief description of the topic electronically to 
  1462. any of the editors, whose addresses are listed below, by the 15th of the month 
  1463. before the month in which your article will appear.  This alerts us that you 
  1464. will be sending an article so that we can plan the issue layout accordingly. 
  1465. After you have done this, get the latest copy of the Article Submission 
  1466. Guidelines  from ftp.cdrom.com  in the /pub/os2/2_x/program/newsltr directory. 
  1467. (the file is artsub.zip)  The completed text of your article should be sent to 
  1468. us no later than five days prior to the last day of the month; any articles 
  1469. received after that time may be pushed to the next issue. 
  1470.  
  1471. The editors can be reached at the following email addresses: 
  1472.  
  1473. o Larry Salomon - os2man@panix.com (Internet). 
  1474.  
  1475. The following people contributed to this issue in one form or another (in 
  1476. alphabetical order): 
  1477.  
  1478. o Larry Salomon, Jr. 
  1479. o Timm Steinbeck 
  1480. o Carsten Whimster 
  1481. o Gordon Zeglinski 
  1482. o Network distributors 
  1483.  
  1484.  
  1485. ΓòÉΓòÉΓòÉ 5.1. Larry Salomon, Jr. ΓòÉΓòÉΓòÉ
  1486.  
  1487. Larry Salomon 
  1488.  
  1489. Larry Salomon wrote his first Presentation Manager application for OS/2 version 
  1490. 1.1 in 1989.  Since that time, he has written numerous VIO and PM applications, 
  1491. including the Scramble applet included with OS/2 and the I-Brow/Magnify/Screen 
  1492. Capture trio being distributed by IBM with the Professional Developers Kit 
  1493. CD-ROM.  Currently, he works for International Masters Publishers in Stamford, 
  1494. Connecticut and resides in Bellerose, New York with his wife Lisa. 
  1495.  
  1496. Larry can be reached electronically via the Internet at os2man@panix.com. 
  1497.  
  1498.  
  1499. ΓòÉΓòÉΓòÉ 5.2. Timm Steinbeck ΓòÉΓòÉΓòÉ
  1500.  
  1501. Timm Steinbeck can be reached at Timm_Steinbeck@ac3.maus.de. 
  1502.  
  1503.  
  1504. ΓòÉΓòÉΓòÉ 5.3. Carsten Whimster ΓòÉΓòÉΓòÉ
  1505.  
  1506. Carsten Whimster 
  1507.  
  1508. I am an undergraduate computer science student at the University of Waterloo, 
  1509. and an OS/2 enthusiast as of OS/2 2.0.  I am currently in my third year, taking 
  1510. mainly operating system, language, compiler, and graphics courses, as much as 
  1511. possible.  :) 
  1512.  
  1513. This summer I will be working at the University as a tutor in CS241, an 
  1514. introductory course to compilers. 
  1515.  
  1516. I am a beginning OS/2 PM programmer with a few projects on the go, and many 
  1517. more in my head.  I try to buy as many books as I can afford on the subject, 
  1518. but if you work for a publisher, I would certainly not turn down any donations, 
  1519. and if the books are interesting and development-oriented, I will try to review 
  1520. them as time permits. 
  1521.  
  1522. I am a TEAM-OS/2 member, and stay busy trying to keep up with several OS/2 
  1523. groups on the Internet. 
  1524.  
  1525. I am also an original member of the Kitchener-Waterloo OS/2 Users' Group, and 
  1526. have recently volunteered to help out organizing the events. 
  1527.  
  1528. It's a miracle my girl-friend puts up with my doing all these things :) 
  1529.  
  1530. You may reach me... 
  1531.  
  1532. ...via email: 
  1533.  
  1534. bcrwhims@undergrad.math.uwaterloo.ca - Internet 
  1535.  
  1536. gopher://descartes.math.uwaterloo.ca:70/h0/mathSOC/.csc/.www/.bcrwhimster/homepage.html 
  1537. - Mosaic homepage 
  1538.  
  1539. ...via snail mail: 
  1540.  
  1541. Carsten Whimster
  1542. 319 Erb Street West, 3rd floor
  1543. Waterloo, Ontario
  1544. Canada
  1545. N2L 1W4
  1546.  
  1547.  
  1548. ΓòÉΓòÉΓòÉ 5.4. Gordon Zeglinski ΓòÉΓòÉΓòÉ
  1549.  
  1550. Gordon Zeglinski 
  1551.  
  1552. Gordon Zeglinski is a freelance programmer/consultant who received his Master's 
  1553. degree in Mechanical Engineering with a thesis on C++ sparse matrix objects. 
  1554. He has been programming in C++ for 6 years and also has a strong background in 
  1555. FORTRAN.  He started developing OS/2 applications with version 2.0 . 
  1556.  
  1557. His current projects include a client/server communications program that 
  1558. utilitizes OS/2's features which has entered beta testing.  Additionally, he is 
  1559. involved in the development of a "real-time" automated vehicle based on OS/2 
  1560. and using C++ in which he does device driver development and designs the 
  1561. applications that comprise the control logic and user interface. 
  1562.  
  1563. He can be reached via the Internet at zeglins@cc.umanitoba.ca. 
  1564.  
  1565.  
  1566. ΓòÉΓòÉΓòÉ 5.5. Network distributors ΓòÉΓòÉΓòÉ
  1567.  
  1568. Network Distributors 
  1569.  
  1570. These people are part of our distribution system to provide EDM/2 on networks 
  1571. other than the Internet.  Their help to provide access to this magazine for 
  1572. others is voluntary and we appreciate them a lot! 
  1573.  
  1574. o Paul Hethman (hethman@cs.utk.edu) - Compuserve 
  1575. o Gess Shankar (gess@knex.via.mind.org) - Internet 
  1576. o David Singer (singer@almaden.ibm.com) - IBM Internal 
  1577. o Andre Asselin (ASSELIN AT RALVM12) - IBM Internal 
  1578.  
  1579. If you would like to become a "network distributor", be sure to contact the 
  1580. editors so that we can give you the credit you deserve!