What Is an API Call?


API (application programming interface) allows you to access the built-in programming functions from DLL and EXE files, particularly the ones that drive Windows. Other third-party applications also use DLL files for libraries of functions, and if you are lucky, you may even be supplied with documentation on how to work the functions.

API calls are normally functions that return a value of some type, although they often take some action at the same time. There are also subroutines that only take action (remember the earlier distinction between a function and a subroutine). To use them, you must first declare the function or subroutine you wish to use, and this is the hardest part. The Declare statement sets up the description of the function or subroutine statement within the Dynamic Link Library (DLL) file. It describes which DLL will be used, what the name of the function or subroutine is, and what the parameters to be passed are. The declarations are quite complicated and if any mistake is made, the call will not work and may even crash the system. Before making an API call, make sure that your file has been saved because they are not very forgiving when things go wrong. You may find that you have to reboot your computer to get things running again, and this will lose any data that you have not saved. API calls are not very forgiving if they go wrong, and pressing CTRL-BREAK to stop them will have no effect whatsoever. For example, simply passing the wrong type of value is enough to cause a crash. However, they are an example of the wonderful versatility of VBA and when used properly they can provide functionality not normally available in Excel.




Excel VBA Macro Programming
Excel VBA Macro Programming
ISBN: 0072231440
EAN: 2147483647
Year: 2004
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net