Object Windows

Object windows may be created and placed into dynamic link libraries in a similar manner to that already explained for display windows. However, object windows have an additional complication in that they are frequently created in secondary threads in order to handle long-running application tasks.

The steps in creating an object window for inclusion in a DLL are therefore as follows:

  • The window procedure, the calling routine to create the window and a routine to start the secondary thread from which the window is created, are written in the normal manner, as described in Threads Containing Object Windows.

  • The routine containing the code to start the secondary thread is declared as an exportable entry point, and may thus be called by applications.

  • The source code is compiled and link edited as described in Creating a DLL.

    Note that the routine called by the application does not return the handle of the newly created window. Indeed, it cannot do so, since the creation of the window takes place asynchronously, in a secondary thread.

    This obstacle is overcome by having the calling application (typically a window procedure) pass its own window handle as a parameter. This is passed to the object window, which then passes an acknowledgement message to the calling window procedure, containing its window handle. The calling window procedure may subsequently communicate with or subclass the object window as required. This technique is described, along with an example, in Threads Containing Object Windows.


    [Back: Display Windows]
    [Next: Subclassing]