IDefineDLL.DefineAlias method assigns an alias to the specified routine located in a DLL. You can call the routine from a dynamic link library by using the routine name or alias.
A library may contain several functions that have similar names and perform similar actions. However, applications may call these functions from the DLL by a common name that differs from the original function names, but is mapped to these names. The common function name is automatically replaced with the appropriate original function name when compiling the application. For example, User32.dll contains two functions,
DrawTextExW. However, in application code you usually call both these functions by the same name,
DrawTextEx, in spite of the fact that there is actually no function named
DrawTextEx in the DLL, and depending on whether the application works with ANSI or Unicode strings, the appropriate function (
DrawTextExW) is called from the DLL. Thus, you can create an alias equal to such a common function name in your test in order to call the routine from your script in the same manner as you call it in other programs (by the common name).
|IDefineDLLObj||An expression, variable or parameter that specifies a reference to an IDefineDLL object|
The method is applied to the following object:
The method has the following parameters:
The alias name to be created for the ProcName routine.
The name of the routine to which the ProcAlias alias will be assigned.
For instance, the GDI32.DLL includes the
CreateFontA function. To call it using the
CreateFont alias, add the following string to your script: