BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
| |
 |
 |
 |
 |
 |
| Introduction to the API and it's use in Wise |
 |
|
|
By: Chris Benatar
Posted On: 2/22/2002
Introduction
This article describes what the API is, how to use it in Wise and why you may want to use it. Wise is first and foremost used for software distribution, but as software distributions can be very complex, users needs may change.
The need for flexibility
Wise comes with a fairly extensive set of commands (or actions) but this list is by no means comprehensive and there is always something that you want to do that Wise cannot do. If you are like me, you probably also use Wise as a very quick and easy compiled language to do all sorts of maintenance and day to day things. Unfortunately the more I want to do with wise, the more the limited command set causes me problems. Fortunately, Wise Solutions have lived up to their name and given us the ability to extend the command set by using the API.
What is the API
Although many people will be familiar with the API, not everyone knows what it is so I will give a very general description here and then some pointers to find out more. API stands for Application Programming Interface which is really in essence just a link into various Windows standard libraries of functions and procedures. These functions and procedures allow you to do just about anything within Windows and they are used by the Windows code itself. So if you want to check the system time, check the status of a service, lock a workstation or any one of hundreds of Windows functions you can do it through the API.
About the API
If the thought of all this power has whetted your appetite, you may be wondering where you can find out more about the API and what functions are available. Certainly a web search will be very useful but to get you going my recommendations are:
General (Excellent) introduction to what the API is and how it works:
http://www.vbapi.com/articles/intro/
Easily accessible list of over 900 API functions describing their action together with library name (which DLL file) parameter requirements and in most cases a VB example of how to use the functions (download the API Guide for quick access):
http://www.allapi.net
Accessing the API from wise
In order to use the API from wise, you need to understand the Wise interface to the API interface. Below is a screenshot of the dialog that comes up when you select the "Call DLL" command in Wise.

The "DLL Pathname" is the path to the relevant DLL or library file and the name of that DLL
The "Function Name" is the specific function you want to access and usually ends in an "A" to specify the ascii version of the function
The "Call a function written specifically for Wise" option is not covered by this article
The "Call a function with variable parameter list" has 2 main parts:
- The various general passing parameters
- The return value and return value type
You can Add, Edit or Delete parameters from the list box. The options available for Adding and Editing are;
Parameter type - Is it a string (buffer or pointer to a string), a short on long number etc.
Buffer Length - If a string buffer is selected, how many bytes in length is that buffer
Passing Type - Is it a structure or a part of a structure. Usually just select "Normal" if you are passing simple variables.
Value Source - Are we using a variable or a constant - usually we will use variables.
Variable Name - Which variable are we going to use
Constant Value - If using a constant, you can set it's value here.

The parameters you add here are the parameters that are described in the API Guide. Make sure you match the order and type correctly because most functions are extremely sensitive and will not work otherwise.
|
 |
 |
 |
|
|