home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PM-M2.ZIP / SCROLLBR.MOD < prev    next >
Text File  |  1990-08-05  |  4KB  |  96 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. (*    Puts a big scrollbar on the screen.  This program should be run from    *)
  32. (*    an OS/2 full screen session since there is no provision for the program *)
  33. (*    to terminate itself.                                                    *)
  34. (*    Source code on page 47.                                                 *)
  35. (*----------------------------------------------------------------------------*)
  36. MODULE SCROLLBR;
  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. CONST
  49.   WINDOW_ID = 1;
  50.  
  51. VAR
  52.   hab           : HAB;
  53.   hmq           : Win.HMQ;
  54.   qmsg          : Win.QMSG;
  55.   hwndScrollBar : HWND;
  56.   r             : Win.MRESULT;
  57.  
  58. PROCEDURE Error;
  59. BEGIN
  60. END Error;
  61.  
  62. BEGIN
  63.   hab := Win.Initialize(NULL);
  64.   hmq := Win.CreateMsgQueue(hab,0);
  65.  
  66.  
  67.   hwndScrollBar := Win.CreateWindow(
  68.                    Win.HWND_DESKTOP,
  69.                    StrPtr(Win.WC_SCROLLBAR)^,
  70.                    'Test',
  71.                    Win.WS_VISIBLE+Win.SBS_HORZ,
  72.                    100, 100,
  73.                    400, 30,
  74.                    NULL,
  75.                    Win.HWND_TOP,
  76.                    WINDOW_ID,
  77.                    NIL,
  78.                    NIL);
  79.  
  80.  
  81.   WHILE( Win.GetMsg( hab, qmsg, HWND(NULL), 0, 0 ) ) DO
  82.     r := Win.DispatchMsg( hab, qmsg );
  83.   END;
  84.  
  85.   IF NOT Win.DestroyMsgQueue( hmq ) THEN      (* and                          *)
  86.     Error;
  87.   END;
  88.  
  89.   IF NOT Win.Terminate( hab ) THEN            (* terminate the application    *)
  90.     Error;
  91.   END;
  92.  
  93.   HALT;
  94.  
  95. END SCROLLBR.
  96.