HWND_vpapa User’s Guide

Related Documents

Contents

Overview

This class is a virtual base for various mix-ins that deal with windows. Its concept is to make a C++ object that is synonomous with a HWND.

Even if fully refactored, the basic units of functionality of a windowing class like eagduru have one thing in common: they need the corresponding HWND. There is also another thing that needs to be a virtual base, and that’s the can_handle base class for efficient smart pointers.

This class is designed to be used as a virtual base to provide both features. See eagduru for more about the architecture.

By itself, this class’s concept is to provide a correspondance between an HWND and a C++ object. So the feature set presented is that of an “is-a” relationship. Anything derived from this class “is-a” HWND. However, it is like an “interface” concept in that it provides semantics but not mechanism. It does not create the correspondance, but it provides a protected interface to allow classes like message_tap and foreign_window to do so, and provides a uniform way for other mix-in derived classes to access this relationship.

Threading Issues

The public interface has no special threading issues. The implementation of the protected interface—the code that sets and clears the HWND—will note its own issues.

Housekeeping Issues

Objects cannot be copied or assigned. They should be allocated on the heap and used with the smart pointers.

How to Use

Declare this as a virtual base class. One mix-in must provide implementation to call set_window_handle to set up and destroy the correspondance. Other mix-ins can access the HWND using window_handle.