![]() |
|
Published 1997-09-01 Printer-friendly version
Tom showed a 2.003 application implemented using objects and the Windows API. Since objects have been thoroughly covered elsewhere, let's see how Tom encapsulated the Windows API into that app.
Tom pointed out that there is an important reason for using the Windows API (an API being just a set of function calls provided by the software provider). Using the Windows API, we can do things that are not possible in Clarion or, sometimes, that are easier than in Clarion. Some of the functions that were used in the app included copying, moving, converting and viewing files (his app worked mostly with image files).
The first step is to select the desired API calls to be included in the object. This, naturally, requires some research into or knowledge of the Windows API.
The next step is to create prototypes for the functions and declarations for the constants used. This is easily accomplished using the WinAPI Viewer including in Clarion Professional. You can use the WinAPI app to create an include file for use in your applications.
To ensure that the declarations used by the Win API are compatible with Clarion, you must also include WinEqu.clw from your LIBSRC subdirectory. This file Equates Windows' language with their Clarion equivalents.
To encapsulate all of this in an object, you create a source file and declare the class, then include the files you previously created. The key is to ensure that the class declaration includes a Module ('modulename') declaration. That file will include the methods (procedures and functions) that you want to effect (i.e., the way in which you want to use the various API calls).
Tom showed easily constructed templates that include the API class in the Global and declarations areas of your app and another that creates the objects to be used in the application. The source can be found at http://www.cwsuperpage.com.
Copyright © 1999-2008 by CoveComm Inc. All Rights Reserved. Reproduction in any form without the express written consent of CoveComm Inc., except as described in the subscription agreement, is prohibited.
Clarion Magazine ISSN 1718-9942
One year: $189
(includes all back issues since '99)
Renewals from $139
Two years: $289
Renewals from $239