home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PM-M2.ZIP / PMWIN.MOD < prev    next >
Text File  |  1990-08-05  |  4KB  |  106 lines

  1. (*----------------------------------------------------------------------------*)
  2. (* Example programs written in JPI Modula-2 Version 2 for OS/2 1.2 by         *)
  3. (* Chris Barker, August 1990                                                  *)
  4. (*                                                                            *)
  5. (* Notes:  I am distributing these programs so that others can learn and also *)
  6. (*         so I can elicit feedback from the user community on programming for*)
  7. (*         OS/2 PM using Modula-2.  If your have any questions, suggestions,  *)
  8. (*         or comments I'd love to hear from you.  I may be reached at the    *)
  9. (*         following addresses:                                               *)
  10. (*                                                                            *)
  11. (*         Compuserve ID: 72261,2312                                          *)
  12. (*         Pete Norloff's OS/2 Shareware BBS - (703) 385-4325                 *)
  13. (*         Max's Doghouse BBS - (703) 548-7849                                *)
  14. (*           The above two BBS carry the Fidonet OS/2 echo which I read       *)
  15. (*           regularly.                                                       *)
  16. (*         Programmer's Corner - (301) 596-1180                               *)
  17. (*         CPCUG Mix (Window Sig) BBS - (301) 738-9060                        *)
  18. (*                                                                            *)
  19. (*         I hope I hear from you!                                            *)
  20. (*                                                                            *)
  21. (*               - Chris                                                      *)
  22. (*                                                                            *)
  23. (*----------------------------------------------------------------------------*)
  24.  
  25. (*----------------------------------------------------------------------------*)
  26. (*  Program Notes:                                                            *)
  27. (*    My first attempt at creating an encapsulated PM window library that     *)
  28. (*    would simplify the task of creating PM windows.  This program           *)
  29. (*    demonstrates the use of JPI's OOP extensions to Modula-2.               *)
  30. (*                                                                            *)
  31. (*----------------------------------------------------------------------------*)
  32.  
  33. IMPLEMENTATION MODULE Pmwin;
  34.  
  35. (*# call(same_ds => off) *)
  36.  
  37.  
  38. IMPORT OS2DEF,Win,Gpi,Dos,Lib,SYSTEM;
  39. FROM OS2DEF IMPORT HDC,HRGN,HAB,HPS,HBITMAP,HWND,HMODULE,HSEM,
  40.                    POINTL,RECTL,PID,TID,LSET,NULL,
  41.                    COLOR,NullVar,NullStr,BOOL ;
  42.  
  43. TYPE
  44.   StrPtr = POINTER TO ARRAY[0..0] OF CHAR;
  45.  
  46.   Stdwin = CLASS
  47.     x , y,
  48.     cx, cy        : INTEGER;
  49.     hab           : HAB;
  50.     hmq           : Win.HMQ;
  51.     qmsg          : Win.QMSG;
  52.     client,
  53.     hwnd          : HWND;
  54.     r             : Win.MRESULT;
  55.  
  56.     PROCEDURE Init(details : LSET; titlestr : ARRAY OF CHAR);
  57.     BEGIN
  58.       hab := Win.Initialize(NULL);
  59.       hmq := Win.CreateMsgQueue(hab,0);
  60.  
  61.       hwnd := Win.CreateStdWindow(
  62.               Win.HWND_DESKTOP,
  63.               Win.WS_VISIBLE,
  64.               details,
  65.               StrPtr(NULL)^,
  66.               titlestr,
  67.               0,
  68.               NULL,
  69.               0,
  70.               client);
  71.     END Init;
  72.  
  73.     PROCEDURE Error;
  74.     BEGIN
  75.     END Error;
  76.  
  77.     PROCEDURE Done;
  78.     BEGIN
  79.       IF NOT Win.DestroyWindow(hwnd) THEN
  80.         Error;
  81.       END;
  82.  
  83.       IF NOT Win.DestroyMsgQueue( hmq ) THEN
  84.         Error;
  85.       END;
  86.  
  87.       IF NOT Win.Terminate(hab) THEN
  88.         Error;
  89.       END;
  90.     END Done;
  91.  
  92.     PROCEDURE Draw;
  93.     BEGIN
  94.     END Draw;
  95.  
  96.     PROCEDURE Process;
  97.     BEGIN
  98.       WHILE( Win.GetMsg(hab, qmsg, HWND(NULL),0,0)) DO
  99.         r := Win.DispatchMsg(hab,qmsg);
  100.       END;
  101.     END Process;
  102.  
  103.   END;
  104.  
  105. END Pmwin.
  106.