home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol11n01.zip / LN1101.ZIP / EMPTYWIN.PAS < prev    next >
Pascal/Delphi Source File  |  1991-12-10  |  2KB  |  65 lines

  1. PROGRAM EmptyWin;
  2. Uses WinTypes, WinProcs, WObjects;
  3. {$R EMPTYWIN}
  4. {$D Copyright (c) 1991 by Neil J. Rubenking}
  5. CONST
  6.   AppName : PChar = 'EmptyWin';
  7. TYPE
  8.   TMyApplication = object(TApplication)
  9.     PROCEDURE InitMainWindow; virtual;
  10.   END;
  11.  
  12.   PTestWindow = ^TTestWindow;
  13.   TTestWindow = OBJECT(TWindow)
  14.     CONSTRUCTOR Init(AParent : PWindowsObject; AName : PChar);
  15.     DESTRUCTOR Done; Virtual;
  16.     PROCEDURE SetUpWindow; Virtual;
  17.     FUNCTION GetClassName : PChar; Virtual;
  18.     PROCEDURE GetWindowClass(var AWndClass: TWndClass); virtual;
  19.     PROCEDURE Paint(pDC : hDC; VAR PS : TPaintStruct); Virtual;
  20.   END;
  21.  
  22. {--------------------------------------------------}
  23. { TTestWindow's methods                            }
  24. {--------------------------------------------------}
  25.   CONSTRUCTOR TTestWindow.Init(AParent : PWindowsObject; AName : PChar);
  26.   BEGIN
  27.     TWindow.Init(AParent, AName);
  28.     Attr.Menu := LoadMenu(hInstance, AppName);
  29.   END;
  30.  
  31.   PROCEDURE TTestWindow.SetUpWindow;
  32.   BEGIN TWIndow.SetUpWindow; END;
  33.  
  34.   DESTRUCTOR TTestWindow.Done;
  35.   BEGIN TWindow.Done; END;
  36.  
  37.   FUNCTION TTestWindow.GetClassName;
  38.   BEGIN GetClassName := AppName; END;
  39.  
  40.   PROCEDURE TTestWindow.GetWindowClass(VAR AWndClass :
  41.     TWndClass);
  42.   BEGIN
  43.     TWindow.GetWindowClass(AWndClass);
  44.     AWndClass.hIcon := LoadIcon(HInstance, AppName);
  45.   END;
  46.  
  47.   PROCEDURE TTestWindow.Paint(pDC : hDC; VAR PS : TPaintStruct);
  48.   BEGIN TWindow.Paint(pDC, PS); END;
  49.  
  50. {--------------------------------------------------}
  51. { TMyApplication's method implementations:         }
  52. {--------------------------------------------------}
  53.   PROCEDURE TMyApplication.InitMainWindow;
  54.   BEGIN MainWindow := New(PTestWindow, Init(Nil, AppName)); END;
  55.  
  56. {--------------------------------------------------}
  57. { Main program:                                    }
  58. {--------------------------------------------------}
  59. VAR MyApp: TMyApplication;
  60. BEGIN
  61.   MyApp.Init(AppName);
  62.   MyApp.Run;
  63.   MyApp.Done;
  64. END.
  65.