OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Many of the functions in the ObjectWindows GDI classes might look familiar to you; this is because many of them have the same names and very nearly, if not exactly, the same function signature as regular Windows API functions.
Because the ObjectWindows GDI classes replicate the functionality of so many Windows objects, there was no need to alter the existing terminology. Therefore, function names and signatures have been deliberately kept as close as possible to what you are used to in the standard Windows GDI functions.
Some improvements, however, have been made to the functions. These improvements include such things as cracking packed return values and using ObjectWindows objects in place of Windows-defined structures.
None of these changes are hard and fast rules; just because a function can somehow be converted does not mean it necessarily has been. But if you see an ObjectWindows function with the same name as a Windows API function that looks a little different, one of the following reasons should explain the change to you:
The TGdiObject base object maintains a handle to each object. The ObjectWindows version then uses that handle when passing the call on to Windows. For example, when selecting an object in a device context, you would normally use the SelectObject API function, as shown here:
The ObjectWindows version of this function is encapsulated in the TDC class, which is derived from TGdiObject. The following example shows how the previous function would appear in a member function of a TDC-derived class. Notice the difference between the two calls to SelectObject:
The uint32 must then must be cracked to get the data from it. The ObjectWindows versions of these functions take a reference to some appropriate object as a parameter. The function then places the data into the object, relieving the programmer from the responsibility of cracking the value. These functions usually return a bool, indicating whether the function call was successful.
For example, the Windows version of SetViewportOrg returns a uint32, with the old value for the viewport origin contained in it. The ObjectWindows version of SetViewportOrg takes a TPoint reference in place of the two ints the Windows version takes as parameters. It also takes a second parameter, a TPoint *, in which the old viewport origins are placed.