home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / PROG / PASCAL / SPEED2 / SAMPLES / PMMDI / PMMDI.PAS < prev    next >
Pascal/Delphi Source File  |  1994-10-06  |  3KB  |  285 lines

  1. PROGRAM PMMdi;
  2.  
  3.  
  4. {***************************************************************************
  5. *                                                                          *
  6. *                Speed-Pascal/2 Sample program "PMMdi"                     *
  7. *                                                                          *
  8. *           (C) 1993,94 Rene Nürnberger. All rights reserved.              *
  9. *                                                                          *
  10. *                                                                          *
  11. *  This sample program can be used as a template for your own MDI          *
  12. *  Applications !                                                          *
  13. *                                                                          *
  14. *                                                                          *
  15. ****************************************************************************}
  16.  
  17.  
  18. USES Api,PmObject,Crt,PmTypes;    {bind Units used}
  19.  
  20.  
  21. RESOURCE PMMDI;  {bind external Resources}
  22.  
  23. TYPE
  24.      TMyApplication=OBJECT(TMDIApplication)
  25.                         CONSTRUCTOR Init;
  26.                         DESTRUCTOR Done;
  27.                         FUNCTION HandleEvent(Win:HWND;Msg:ULONG;
  28.                                              Para1,Para2:POINTER;
  29.                                              VAR Handled:BOOLEAN):
  30.  
  31.                                              ULONG;VIRTUAL;
  32.                     END;
  33.  
  34. CONST
  35.      CM_NEWCHILD=500;
  36.  
  37. VAR MyApp:TMyApplication;
  38.  
  39.  
  40. {define Methods}
  41.  
  42. CONSTRUCTOR TMyApplication.Init;
  43. BEGIN
  44.  
  45.      Inherited.Init;
  46.      InsertResources(TRUE,FALSE,TRUE); {Application has menu and icon}
  47. END;
  48.  
  49.  
  50. DESTRUCTOR TMyApplication.Done;
  51. BEGIN
  52. END;
  53.  
  54. {Virtual Method HandleEvent. All Messages come here first}
  55. FUNCTION TMyApplication.HandleEvent(Win:HWND;Msg:ULONG;Para1,Para2:POINTER;
  56.                                     VAR Handled:BOOLEAN):ULONG;
  57. VAR r:LONGWORD;
  58.     H:BOOLEAN;
  59.     Command:WORD;
  60.     fr:ULONG;
  61.     Frame:HWND;
  62. BEGIN
  63.      H:=TRUE;
  64.      r:=Inherited.HandleEvent(Win,Msg,Para1,Para2,Handled);
  65.      CASE Msg OF
  66.          WM_COMMAND:
  67.          BEGIN
  68.               Command:=WORD(Para1);
  69.               CASE Command OF
  70.                   CM_NEWCHILD:
  71.                   BEGIN
  72.                        fr:=FCF_ICON; {MDI window has an icon}
  73.                        Frame:=CreateMDIChild(1001,'MDI Child',NIL,fr,
  74.                                              CLR_BLACK,CLR_CYAN);
  75.                   END;
  76.               END; {case}
  77.          END;
  78.          ELSE IF not handled THEN H:=FALSE;
  79.      END; {Case}
  80.      Handled:=H;
  81.      HandleEvent:=r;
  82. END;
  83.  
  84. BEGIN  {Main}
  85.      MyApp.Init;
  86.      MyApp.Run(1000,'PMMDI Sample Application',CLR_DARKGRAY,CLR_WHITE);
  87.      MyApp.Done;
  88. END.
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.