Calling the Windows API from Basic

The vague concept we usually call the Windows API is, in practical terms, a growing collection of dynamic-link libraries. Basic programmers can simply think of DLLs as libraries of procedures. You don’t really need to know that DLLs are loaded at run time, that multiple programs can use the same DLL at the same time, or that the procedures in DLLs must be carefully written to allow this to happen safely.

As a Basic programmer, the key fact you need to know about system DLLs is that they are written in another language—it doesn’t matter that it’s usually C. That other language has a different idea than Basic does about the best way to use addresses. This difference extends to all the fundamental questions of life:

These are closed questions with simple answers in Basic, but when you start calling DLLs, everything you know is, if not wrong, at least incomplete. To reach a deeper understanding of DLL functions, you have to go to that mysterious place where Basic parameters and variables meet C pointers and references: the stack.