Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cWndHandle Class Reference

#include <cWndHandle.h>

Inheritance diagram for GrayLib::cWndHandle:
Gray::CObject GrayLib::cWindow

Public Member Functions

 cWndHandle (HWND hWnd=WINHANDLE_NULL) noexcept
 
 cWndHandle (cWndHandle *pWnd) noexcept
 
virtual ~cWndHandle ()
 
bool isValidHwnd () const noexcept
 
virtual bool isValidCheck () const noexcept
 < memory allocation and structure definitions are valid. More...
 
 operator HWND () const noexcept
 
HWND get_Hwnd () const noexcept
 
HWND GetSafeHwnd () const noexcept
 
bool AttachHwnd (HWND hWnd)
 
void DetachHwnd ()
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 

Protected Attributes

HWND m_hWnd
 Handle to window (i may or may not have to destroy this) More...
 

Detailed Description

A basic window HWND wrapper. Very much like MFC CWnd Assumes nothing about ownership of the window. DOES NOT destroy this window automatically. since parents destroy children automatically anyhow. Similar to Gtk::Window() or MFC/ATL cWindow or CWnd

Constructor & Destructor Documentation

◆ cWndHandle() [1/2]

GrayLib::cWndHandle::cWndHandle ( HWND  hWnd = WINHANDLE_NULL)
inlinenoexcept

◆ cWndHandle() [2/2]

GrayLib::cWndHandle::cWndHandle ( cWndHandle pWnd)
inlinenoexcept

◆ ~cWndHandle()

virtual GrayLib::cWndHandle::~cWndHandle ( )
inlinevirtual
Note
If the WndProc/WindowProc is using this pointer we must detach it now! Its not valid anymore.

Member Function Documentation

◆ AttachHwnd()

bool GrayLib::cWndHandle::AttachHwnd ( HWND  hWnd)
inline

Ignore current value of m_hWnd. just overwrite it.

◆ DetachHwnd()

void GrayLib::cWndHandle::DetachHwnd ( )
inline

Do not destroy window on class destructor.

◆ get_Hwnd()

HWND GrayLib::cWndHandle::get_Hwnd ( ) const
inlinenoexcept

◆ GetSafeHwnd()

HWND GrayLib::cWndHandle::GetSafeHwnd ( ) const
inlinenoexcept

Same as get_Hwnd() but checks 'this' pointer for nullptr and validness.

◆ isValidCheck()

virtual bool GrayLib::cWndHandle::isValidCheck ( ) const
inlinevirtualnoexcept

< memory allocation and structure definitions are valid.

is memory allocation and structure definitions valid?

NOT in MFC so use COBJECT_IsValidCheck to call.

Note
This can't be called in constructors and destructors of course !

Reimplemented from Gray::CObject.

◆ isValidHwnd()

bool GrayLib::cWndHandle::isValidHwnd ( ) const
inlinenoexcept

is m_hWnd = WINHANDLE_NULL.

◆ operator HWND()

GrayLib::cWndHandle::operator HWND ( ) const
inlinenoexcept

Member Data Documentation

◆ m_hWnd

HWND GrayLib::cWndHandle::m_hWnd
protected

Handle to window (i may or may not have to destroy this)


The documentation for this class was generated from the following file: