Skip to Content
A Programmer's Introduction to Visual Basic® .NET
book

A Programmer's Introduction to Visual Basic® .NET

by Craig Utley
December 2001
Intermediate to advanced content levelIntermediate to advanced
360 pages
9h 6m
English
Sams
Content preview from A Programmer's Introduction to Visual Basic® .NET

Calling Windows API Functions

One of the major features of .NET is that it is platform independent. However, there are many powerful functions available in the Windows API, so there is little doubt that some developers will want to a call Windows API function from time to time. Fortunately, VB .NET includes the Declare statement, which allows you to call Windows API functions.

The Declare statement in VB .NET is very similar to the one from VB6, with some minor modifications. You might recall from your VB6 work that functions have both an ANSI and a Unicode implementation in the API: an A suffix means the ANSI version, whereas a W suffix indicates Unicode. Examine the following sample Declare statement:

 Declare Function GetComputerName Lib "kernel32.dll" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Visual Basic® Programmer's Guide to the .NET Framework Class Library

Visual Basic® Programmer's Guide to the .NET Framework Class Library

Lars Powers, Mike Snell
Application Development Using Visual Basic® and .NET

Application Development Using Visual Basic® and .NET

Robert J. Oberg, Peter Thorsteinson, Dana L. Wyatt
Visual Basic® .NET by Example

Visual Basic® .NET by Example

Gabriel Oancea, Bob Donald

Publisher Resources

ISBN: 0672322641Purchase book