Share via


CWindow::Detach

Detaches m_hWnd from the CWindow object and sets m_hWnd to NULL.

HWND Detach( ) throw();

Return Value

The HWND associated with the CWindow object.

Example

//The following example attaches an HWND to the CWindow object and  
//later detaches the CWindow object from the HWND when no longer needed

CWindow myWindow;
myWindow.Attach(hWnd);

//call CWindow wrappers 

//We don't need the C++ object any more, so detach it from the HWND.
myWindow.Detach(); 

Requirements

Header: atlwin.h

See Also

Reference

CWindow Class

CWindow::Attach

Other Resources

CWindow Members