Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

(C++) Scoped_hdc

 

Data type to manage a handle to a device context (HDC).

 

*        View the cope of scoped_hdc in plain text.

 

 

#include <windows.h>

#include <boost/noncopyable.hpp>

 

//From http://www.richelbilderbeek.nl/CppScoped_hdc.htm

struct Scoped_hdc : public boost::noncopyable

{

Scoped_hdc(const HWND hwnd)

: m_hwnd(hwnd),

m_hdc(GetDC(hwnd))

{

 

}

~Scoped_hdc()

{

ReleaseDC(m_hwnd,m_hdc);

}

const HDC Get() const { return m_hdc; }

 

private:

const HWND m_hwnd;

const HDC m_hdc;

};

 

 

 

 

References

[0]          ...

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.