home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / owlsrc.pak / WINDOWDC.CPP < prev    next >
C/C++ Source or Header  |  1997-07-23  |  894b  |  53 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Implementation of TWindowDC, TScreenDC, TDesktopDC & TClientDC
  6. //----------------------------------------------------------------------------
  7. #include <owl/owlpch.h>
  8. #include <owl/dc.h>
  9.  
  10. TWindowDC::TWindowDC()
  11. :
  12.   TDC()
  13. {
  14. }
  15.  
  16. TWindowDC::TWindowDC(HWND wnd)
  17. :
  18.   TDC(),
  19.   Wnd(wnd)
  20. {
  21.   Handle = ::GetWindowDC(Wnd);
  22.   CheckValid();
  23. }
  24.  
  25. TWindowDC::~TWindowDC()
  26. {
  27.   RestoreObjects();
  28.   if (ShouldDelete)
  29.     ::ReleaseDC(Wnd, HDC(Handle));
  30.   Handle = 0;
  31. }
  32.  
  33. TScreenDC::TScreenDC()
  34. :
  35.   TWindowDC(0)
  36. {
  37. }
  38.  
  39. TDesktopDC::TDesktopDC()
  40. :
  41.   TWindowDC(::GetDesktopWindow())
  42. {
  43. }
  44.  
  45. TClientDC::TClientDC(HWND wnd)
  46. :
  47.   TWindowDC()
  48. {
  49.   Wnd = wnd;
  50.   Handle = ::GetDC(Wnd);
  51.   CheckValid();
  52. }
  53.