Dela via


Windows API Programming for Visual Basic 6.0 Users

The use of Windows APIs is generally not necessary in Visual Basic 2008, and the techniques for calling them differ somewhat from those used in Visual Basic 6.0.

Conceptual Differences

In Visual Basic 6.0, it was often necessary to call Windows APIs in order to provide advanced functionality that Visual Basic itself did not provide.

Visual Basic 2008 incorporates the .NET Framework; in most cases, Windows API calls are no longer necessary because much of the functionality of the Windows API is wrapped up in the .NET Framework.

Declaring Windows API's

In Visual Basic 6.0, the Declare statement is used to call the Windows API in order to access functionality not provided by Visual Basic.

In Visual Basic 2008, you can still use the Declare statement to call an API, but there are some differences to be aware of. For example, some of the data types in Visual Basic 2008 have no direct equivalent; they must be marshaled in order to be passed to an API call. For more information, see Walkthrough: Calling Windows APIs.

Upgrade Notes

When a Visual Basic 6.0 application is upgraded to Visual Basic 2008, calls to Windows APIs are upgraded in place—they are not replaced with their.NET Framework equivalents. When data-type issues are encountered, upgrade warnings are added to your code and to the upgrade report. In most cases you will want to replace these API calls with their .NET Framework equivalents.

See Also

Concepts

Data Type Changes for Visual Basic 6.0 Users

Reference

Declare Statement

Other Resources

Help for Visual Basic 6.0 Users