Home arrow Visual Basic arrow Page 2 - Accessing the Windows API in Visual Basic
VISUAL BASIC

Accessing the Windows API in Visual Basic


The Windows Application Programming Interface, or API, is a complex set of functions for interacting with Windows. In this article, Jason attempts to shed some light on this topic by explaining what an API is, and providing an example of how to access one through Visual Basic.

Author Info:
By: Jason Brimblecombe
Rating: 4 stars4 stars4 stars4 stars4 stars / 127
December 12, 2001
TABLE OF CONTENTS:
  1. · Accessing the Windows API in Visual Basic
  2. · What is the Windows API?
  3. · Exploring the API function list
  4. · Your first API call
  5. · Calling the API
  6. · Conclusion

print this article
SEARCH DEVARTICLES

Accessing the Windows API in Visual Basic - What is the Windows API?
(Page 2 of 6 )

You have probably heard of the Windows API numerous times, but you may not know exactly what it is. Basically, it is a whole set of implementation specific DLL hosted functions, which are accessible through Visual Basic, C++, Java and Delphi. The main API functions reside in three system DLL files, which are located on every computer that is using the Windows operating system.
  1. User32.dll - Handles the user interface
  2. Kernel32.dll - Working with files and your computers memory
  3. Gdi32.dll - Graphical commands
There are many more DLLs which are accessible through the Windows Operating System, however, they are seperated into numerous other system DLL files, which we will not discuss here.

Microsoft bundled all of the API functions into system DLL's so that they were easily accessible for developers from a number of programming languages. One advantage of using the Windows API is that each function is highly optimised, and usually written in C/C++, meaning that they are a lot faster than using the standard set of functions available in Visual Basic.

It is possible to use functions from other DLL files, as long as you know the declarations to access the functions. The developer of the DLL must provide a detailed set of documentation, telling other developers how to create an API decleration for the functions contained within that DLL.

API calls can be used to perform almost any Windows task, from shutting down a computer to installing a printer. Because of the multi-threaded mature of the Windows operating system, several programs can access the Windows API simultaneously.

Later in this tutorial, I will describe how to use one of the most common Windows API calls in Visual Basic.

Windows API functions are very fast and powerful, but actually calling them up and executing them can be time consuming. I would recommend that you only use Windows API functions if the task you are trying to implement is not available as a regular Visual Basic function or statement. Of course, the task that you want to implement may not be available as a Windows API function.
blog comments powered by Disqus
VISUAL BASIC ARTICLES

- Developing an XML Web Service Using Visual S...
- Creating an HTML File List with VB
- Fun with Email: VB6, CDO, MAPI, and a Remote...
- Extranet/Intranet Dictionary Cracker in VB
- Finding Default App Icons With Visual Basic
- Registry Fever With Visual Basic
- Implementing An ADO Data Control With VB6
- Printing With Visual Basic
- MSMQ Part 1/2: Architecture and Simple Imple...
- Magnifying The Desktop With Visual Basic
- Sending Email With MAPI Components in Visual...
- Two Person Chat With The Winsock Control And...
- A Real-Time ActiveX News Control
- Accessing the Windows API in Visual Basic

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials