Library tutorials & articles
API Programming Series #2
Aliasing
Aliasing is a technique used to call a function with a different name than its original name as
defined in the DLL to avoid naming problems ambiguities etc. Occasionally, a DLL procedure has a
name that is not a legal identifier. It might have an invalid character (such as a hyphen), or the name
might be the same as a Visual Basic keyword (such as GetObject). When this is the case, use the
Alias keyword to specify the illegal procedure name.
For example, some procedures in the operating environment DLLs begin with an underscore character. While you can use an underscore in a Visual Basic identifier, you cannot begin an identifier with an underscore. To use one of these procedures, you first declare the function with a legal name, then use the Alias clause to reference the procedure's real name.
We can also use the Alias clause to change a procedure name whenever it's convenient say, to remove the ambiguity problem discussed earlier in this article. If you do substitute your own names for procedures, make sure that you thoroughly document the changes so that your code can be maintained at a later date.
In our example therefore, GetComputerNameA is the name of the function and
GetComputerName is its alias. This could be confusing the first time around. Don't worry; it's
simple once you get the hang of it.
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
The current release of the ApiViewer can now be found here:
http://www.activevb.de/rubriken/apiviewer/index-apiviewereng.html
or (German):
http://www.ApiViewer.de
charcoal
he's already posted part 4... i've just gotta get around to publishing 'em
i thought he was never gonna come back
This thread is for discussions of API Programming Series #2.