home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PM-M2B.ZIP / SCROLLBR.MOD < prev    next >
Text File  |  1990-10-03  |  4KB  |  99 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, October 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. (*# data(heap_size=> 3000) *)
  40.  
  41. IMPORT OS2DEF,Win,Gpi,Dos,Lib,SYSTEM;
  42. FROM OS2DEF IMPORT HDC,HRGN,HAB,HPS,HBITMAP,HWND,HMODULE,HSEM,
  43.                    POINTL,RECTL,PID,TID,LSET,NULL,
  44.                    COLOR,NullVar,NullStr,BOOL ;
  45. FROM OS2MAC IMPORT SHORT1FROMMP,SHORT2FROMMP,MPFROMSHORT,MPFROM2SHORT;
  46.  
  47.  
  48. TYPE
  49.   StrPtr = POINTER TO ARRAY[0..0] OF CHAR;
  50.  
  51. CONST
  52.   WINDOW_ID = 1;
  53.  
  54. VAR
  55.   hab           : HAB;
  56.   hmq           : Win.HMQ;
  57.   qmsg          : Win.QMSG;
  58.   hwndScrollBar : HWND;
  59.   r             : Win.MRESULT;
  60.  
  61. PROCEDURE Error;
  62. BEGIN
  63. END Error;
  64.  
  65. BEGIN
  66.   hab := Win.Initialize(NULL);
  67.   hmq := Win.CreateMsgQueue(hab,0);
  68.  
  69.  
  70.   hwndScrollBar := Win.CreateWindow(
  71.                    Win.HWND_DESKTOP,
  72.                    StrPtr(Win.WC_SCROLLBAR)^,
  73.                    'Test',
  74.                    Win.WS_VISIBLE+Win.SBS_HORZ,
  75.                    100, 100,
  76.                    400, 30,
  77.                    NULL,
  78.                    Win.HWND_TOP,
  79.                    WINDOW_ID,
  80.                    NIL,
  81.                    NIL);
  82.  
  83.  
  84.   WHILE( Win.GetMsg( hab, qmsg, HWND(NULL), 0, 0 ) ) DO
  85.     r := Win.DispatchMsg( hab, qmsg );
  86.   END;
  87.  
  88.   IF NOT Win.DestroyMsgQueue( hmq ) THEN      (* and                          *)
  89.     Error;
  90.   END;
  91.  
  92.   IF NOT Win.Terminate( hab ) THEN            (* terminate the application    *)
  93.     Error;
  94.   END;
  95.  
  96.   HALT;
  97.  
  98. END SCROLLBR.
  99.