Determining the contents of an API is made significantly easier with the use of the API Text Viewer, which is automatically installed with eMbedded Visual Tools in the \Windows CE Tools\BIN folder of your installation drive as APILOAD.EXE. The API Text Viewer can be used to open, browse, and seek through an API declaration file, which is simply a formatted text file that lists all an API's functions, constants, and structures (UDTs). In Windows CE, most of the core Windows functionality is contained in the file Coredll.dll, and eVB comes with a API declaration file that covers most of Coredll.dll. The file is WINCEAPI.TXT and the default installation places it also in the \Windows CE Tools\BIN folder of your installation drive. Running APILOAD.EXE presents you with the simple interface shown in Figure 9.1. Figure 9.1. The API Viewer application. Choosing Open from the File menu displays the Windows Open File dialog, which you can then use to navigate to and open WINCEAPI.TXT. Opening the API declaration file will immediately populate the Available Items list box in the middle of the form. This is the list of all functions, or declares, listed in the opened file. By changing the API Type combo box, you can also list all the defined constants. Note The combo box has Types as an option as well, but selecting Types gives you nothing in the Available Items list. This is because eVB doesn't natively support Types, which are simply UDTs or structures. We'll look at getting past this inconvenience later in the chapter. For now, just get used to using the API viewer to get function and constant declarations into an eVB project. If you choose Declares and select a function to copy by either double-clicking its name or highlighting the name and clicking Add, you will see that the API declaration will be added to the Selected Items text box at the bottom of the form. The same can be done for Constants (see Figure 9.2). Figure 9.2. The API Viewer after selecting the CharLower API declare and the ERROR_ACCESS_DENIED and ERROR_ADAP_HDW_ERR constants. You can select any number and any combination of declares or constants, and when you've selected all the APIs you need, press Ctrl+C or click Copy to move the contents of the Selected Items to your Clipboard. From there, simply paste the declarations into the top of your code module by choosing Paste from the Edit menu in the eVB IDE. |