
Take, for example, the following Visual Basic 6 Declare statement, which contains a mix of Integer and Long parameters:ĭeclare Function GlobalGetAtomName Lib "kernel32" _ Alias "GlobalGetAtomNameA" (ByVal nAtom As Integer, _ ByVal lpBuffer As String, ByVal nSize As Long) _ As Long Any parameter type or user-defined type member that was formerly a Long needs to be declared as Integer any member formerly declared as Integer needs to be declared as Short. NET, when you create a new Declare statement for a Windows API function, you need to be mindful of this difference. NET adds a new type called Short, which, in terms of size, is the replacement for the Visual Basic 6 Integer type. NET, an Integer is 32 bits and a Long is 64 bits. In Visual Basic 6, an Integer is 16 bits and a Long is 32 bits. Two changes that affect almost every Windows API function declaration involve the numeric types Integer and Long. NET Framework to complement or replace the Windows API calls you make in your application. It also shows how you can use classes contained in the. This section focuses on the language changes that affect the way you create Declare statements for API functions. NET carries this capability forward by enabling you to declare and call Windows API functions in the same way as before. It has done so since version 1, enabling you to add capabilities to your application that cannot be implemented in the Visual Basic language. However, because the Visual Basic language and forms package does not represent every Windows API function available, Visual Basic supports calling Windows API functions directly. In many cases, you can build a Visual Basic application without needing to call a Windows API function directly. Visual Basic, through the language and forms package, abstracts the Windows API to a set of easy-to-use statements, components, and controls.

Visual Basic applications are no exception. The foundation upon which every Windows application is built is the Windows API.
