Display Windows

A display window may be created as a generic application object, and its window procedure placed in a dynamic link library. The following steps are typically followed in creating such a window procedure:

  • Both the window procedure and a calling routine to create the window are written in the normal manner.

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

  • This routine returns the handle of the newly created window to the calling application, along with a success or failure code.

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

    The calling application then simply issues a single function call, such as:

    usSuccess = CreateEditWindow(hEdit);
    

    The CreateEditWindow() function within the DLL handles all necessary operations including registration of the window class and creation of the window, places the resulting window handle in the address indicated by the hEdit parameter, and returns a success or failure code (usSuccess) to the calling application.

    Note, however, that the above example assumes that the window is created with a predetermined title, size and position on the desktop. Should this not be the case, additional parameters to the CreateWindow() function would be required.

    The definition of the CreateEditWindow() function as the only entry point in the DLL enforces the consistency of using this function. The calling application is still provided with the window handle, which allows it to communicate with the window and to subclass the window if required.


    [Back: Generic Application Objects]
    [Next: Object Windows]