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

  1. (*----------------------------------------------------------------------------*)
  2. (* Example OS/2 Presentation Manager Program adapted from the book            *)
  3. (* "OS/2 Presentation Manager - Programming Primer" by Asael Dror &           *)
  4. (* Robert Lafore                                                              *)
  5. (*                                                                            *)
  6. (* Example programs converted to JPI Modula-2 Version 2 for OS/2 1.2 by       *)
  7. (* Chris Barker, August 1990                                                  *)
  8. (*                                                                            *)
  9. (* Notes:  I am distributing these programs so that others can learn and also *)
  10. (*         so I can elicit feedback from the user community on programming for*)
  11. (*         OS/2 PM using Modula-2.  If your have any questions, suggestions,  *)
  12. (*         or comments I'd love to hear from you.  I may be reached at the    *)
  13. (*         following addresses:                                               *)
  14. (*                                                                            *)
  15. (*         Compuserve ID: 72261,2312                                          *)
  16. (*         Pete Norloff's OS/2 Shareware BBS - (703) 385-4325                 *)
  17. (*         Max's Doghouse BBS - (703) 548-7849                                *)
  18. (*           The above two BBS carry the Fidonet OS/2 echo which I read       *)
  19. (*           regularly.                                                       *)
  20. (*         Programmer's Corner - (301) 596-1180                               *)
  21. (*         CPCUG Mix (Window Sig) BBS - (301) 738-9060                        *)
  22. (*                                                                            *)
  23. (*         I hope I hear from you!                                            *)
  24. (*                                                                            *)
  25. (*               - Chris                                                      *)
  26. (*                                                                            *)
  27. (*----------------------------------------------------------------------------*)
  28.  
  29. (*----------------------------------------------------------------------------*)
  30. (*  Program Notes:                                                            *)
  31. (*    This is the basic program to create a standard client window with       *)
  32. (*    scrollbars on the left and bottom and ability to resize itself.         *)
  33. (*    Source code on page 55.                                                 *)
  34. (*                                                                            *)
  35. (*----------------------------------------------------------------------------*)
  36. MODULE STDWIN;
  37.  
  38. (*# call(same_ds => off) *)
  39.  
  40. IMPORT OS2DEF,Win,Gpi,Dos,Lib,SYSTEM;
  41. FROM OS2DEF IMPORT HDC,HRGN,HAB,HPS,HBITMAP,HWND,HMODULE,HSEM,
  42.                    POINTL,RECTL,PID,TID,LSET,NULL,
  43.                    COLOR,NullVar,NullStr,BOOL ;
  44.  
  45. TYPE
  46.   StrPtr = POINTER TO ARRAY[0..0] OF CHAR;
  47.  
  48. VAR
  49.   hab           : HAB;
  50.   hmq           : Win.HMQ;
  51.   qmsg          : Win.QMSG;
  52.   client,
  53.   hwnd          : HWND;
  54.   r             : Win.MRESULT;
  55.   flcreateFlags : LSET;
  56.  
  57. PROCEDURE Error;
  58. BEGIN
  59. END Error;
  60.  
  61. BEGIN
  62.   flcreateFlags := Win.FCF_TITLEBAR + Win.FCF_SYSMENU + Win.FCF_SIZEBORDER +
  63.                    Win.FCF_MINMAX + Win.FCF_VERTSCROLL + Win.FCF_HORZSCROLL +
  64.                    Win.FCF_SHELLPOSITION + Win.FCF_TASKLIST;
  65.  
  66.   hab := Win.Initialize(NULL);
  67.   hmq := Win.CreateMsgQueue(hab,0);
  68.  
  69.  
  70.   hwnd := Win.CreateStdWindow(
  71.               Win.HWND_DESKTOP,
  72.               Win.WS_VISIBLE,
  73.               flcreateFlags,
  74.               StrPtr(NULL)^,
  75.               ' - My first Window',
  76.               0,
  77.               NULL,
  78.               0,
  79.               client);
  80.  
  81.  
  82.   WHILE( Win.GetMsg( hab, qmsg, HWND(NULL), 0, 0 ) ) DO
  83.     r := Win.DispatchMsg( hab, qmsg );
  84.   END;
  85.  
  86.   IF NOT Win.DestroyWindow(hwnd) THEN      (* and                          *)
  87.     Error;
  88.   END;
  89.  
  90.   IF NOT Win.DestroyMsgQueue( hmq ) THEN      (* and                          *)
  91.     Error;
  92.   END;
  93.  
  94.   IF NOT Win.Terminate( hab ) THEN            (* terminate the application    *)
  95.     Error;
  96.   END;
  97.  
  98.   HALT;
  99.  
  100. END STDWIN.
  101.  
  102.