Using Aliases and Ordinals When Declaring DLL Procedures

When you declare a DLL procedure in an ATEasy application, you can use an alias instead of the actual exported DLL procedure name. You could declare a procedure with a name that is more meaningful or readable, or that conforms more closely to your organization's naming standards, than the actual name in the DLL. The original procedure name in the DLL can be either an alphabetical name or an ordinal number. (To see a list of procedure names in a DLL, right-click the DLL name in Windows Explorer and select Quick View.)

For example, the Windows API has two versions of each function that accepts strings as parameters: an ASCII version, which ends with an "A," and a Unicode version, which ends with a "W" (Wide). Following this convention, the IsCharAlpha function in User32.dll has two versions: IsCharAlphaA and IsCharAlphaW. If you wanted to declare the IsCharAlphaA function in your application, but did not want to enter the "A" suffix in your code each time that you called the function, you could use an alias as shown below:

Note that the name of the procedure exported from the DLL, "IsCharAlphaA," is in the Alias field, while the function name that you are declaring and using within ATEasy, "IsCharAlpha," is in the Name field.

You can also use aliases to declare the same procedure multiple times in an ATEasy application with different parameter types. For example, the DioRead function can be exported from Marvin Test Solutions's GtDio32.DLL. One test in an ATEasy application needs to use DioRead with a Word type parameter, and another test in the same application needs to use DioRead with a DWord type parameter. You could declare the DioRead parameter as type Any to accommodate both tests. Or, you could declare DioRead twice using aliases. The DioReadW parameter could be declared as type word, and the DioReadDW parameter could be declared as type DWord. By using aliases and declaring DioRead with specific data types, you can use type checking and validation.

When you declare a DLL procedure in an ATEasy application using an alias, you can refer to the ordinal number that identifies the procedure in the DLL rather than to its name.

check OS since GetAsyncKeyState has different ordinal in different OSs

For example, GetAsyncKeyState is a function located in User32.DLL. And this function has different ordinal in different OSs: in XP, The function's ordinal number is 342 and in 2K, it is 231. When declaring the GetAsyncKeyState function in an ATEasy program with an alias, you can create two such functions and refer to its respective ordinal number as shown below:

Note that if a function has unique ordinal number, then you simply enter the ordinal number of the procedure in the Alias field, while the function name that you are declaring within ATEasy is in the Name field.