Every window, including the main Uniface window has a window procedure.
This runs constantly in the background and handles windows messages that
are continually being sent to that window, for example in response to typing on
the keyboard and mouse movement.
It is possible to replace the window procedure of any window with a customised
window procedure, which performs some additional processing and then calls the
original window procedure. This process of hooking in an alternative window
procedure is sometimes referred to as subclassing. Search the Microsoft web
site for more information.
This feature of Windows makes it possible to control some of the behaviour of
Uniface that would otherise be out of reach of Uniface proc code. For example,
it can be used to intercept the WM_SETTEXT message to change the main
Uniface window title text. Search for UDLLEVENT or WM_SETTEXT
in the Uniface listserver archives (the older messages) for more information.
In this example, the window procedure of the main Uniface window is tailored
so that when the development environment log on form appears the operating
system user name is automatically entered. This might be useful if there must be
a single shared Uniface INI file and the users in the development environment
have the same names as the Windows users.
To implement this function the provided DLL, hook.dll, must be included on
the preload line of the Uniface INI file. And the following line must be added
to the [application] section of the Uniface INI file to actually activate the feature:
[application]
autologonIDF=on
Further information about creating Uniface DLLs can be found in the document
by Charlton Barreto here, or if that link fails then here or here. Although it was
written around 1995 for Uniface Six it is still largely relevant.
Notes
This example DLL was developed and tested using Microsoft Visual C++ 5.0
and Uniface 7.2.04 on Windows NT.
Be warned that the Windows features used by this DLL are not supported
by Uniface, for although the 3gl samples provided with Uniface advocate the
creation of other windows, it is probably a dangerous practice to alter the
Uniface window procedure to intercept its messages.