home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / das_buch / windows / mdi / gen_mdi2.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-06-04  |  1015 b   |  46 lines

  1. PROGRAM Gen_MDI2;
  2.  
  3. USES WinTypes, WinProcs, OWindows;
  4.  
  5. {$R Gen_MDI.RES}
  6.  
  7. TYPE
  8.   tMyApplication = OBJECT(tApplication)
  9.     PROCEDURE InitMainWindow; VIRTUAL;
  10.   END;
  11.  
  12.   pMyMDIWindow = ^tMyMDIWindow;
  13.   tMyMDIWindow = OBJECT(tMDIWindow)
  14.     FUNCTION CreateChild: pWindowsObject; VIRTUAL;
  15.   END;
  16.  
  17.   pMyChild = ^tMyChild;
  18.   tMyChild = OBJECT(tWindow)
  19.     PROCEDURE Paint(PaintDC: hDC; VAR PaintInfo: tPaintStruct); VIRTUAL;
  20.   END;
  21.  
  22. PROCEDURE tMyChild.Paint(PaintDC: hDC; VAR PaintInfo: tPaintStruct);
  23. BEGIN
  24.   Rectangle(PaintDC, 10, 10, 100, 100);
  25. END;
  26.  
  27. FUNCTION tMyMDIWindow.CreateChild: pWindowsObject;
  28. BEGIN
  29.   CreateChild := Application^.MakeWindow(New(pMyChild,
  30.                               Init(@Self, 'New MDI Child')));
  31. END;
  32.  
  33. PROCEDURE tMyApplication.InitMainWindow;
  34. BEGIN
  35.   MainWindow := New(pMyMDIWindow, Init('MDI Test Program 2',LoadMenu(hInstance, 'Generic')));
  36. END;
  37.  
  38. VAR
  39.   MyApp : tMyApplication;
  40.  
  41. BEGIN
  42.   MyApp.Init('MyProgram');
  43.   MyApp.Run;
  44.   MyApp.Done;
  45. END.
  46.