In situations where an object window is created in a secondary thread to manipulate a data object such as a database, or to handle access to a remote device or system, it is often desirable to have a single object window performing the requested actions, in response to requests from multiple display windows. This follows the basic architecture of a client-server application, in accordance with the object-oriented rule of allowing access to a data object only from a single application object, and therefore implements the concept of encapsulation.
For example, a user may use different display windows to access different views of the same database. However, for reasons of efficiency and data integrity, the actual database access should be coordinated by a single object window, preferably in a secondary thread in case a database access request causes a lengthy search.
The question then arises of how the handle of the object window may be made available to multiple display windows. A number of options are available:
The final method described above is therefore the recommended solution. Object windows that will perform "server" tasks on behalf of a number of display window "clients" should be created by the window procedure for the application's main window, immediately upon creation of the main window, and the handles of the object windows stored in a data structure accessed via the window words of the main window.