Calling functions in the Windows API by typing them in manually is time consuming and prone to errors. A better alternative is the API Viewer utility that is installed with VB.

Many powerful VB 6 programming techniques involve calling functions in the Windows API. This requires you to place the function declarations in your program; and, in some cases, you'll also need constant and type declarations. Typing them in manually is time consuming and prone to errors; therefore, it's much better to use the API Viewer utility that is installed with VB.

To start this program, go to the Start menu and select Microsoft Visual Basic 6.0 Tools and then API Text Viewer. Although the API data is supplied as a text file, the first time you use the Viewer, you can convert this to a database file for faster access. Here's how:

  1. Select File | Load Text File from the Viewer's menu.
  2. Select Win32API.txt and click Open.
  3. Select File | Convert Text to Database.
  4. Accept the default name Win32API.mdb and click Save. (If this file already exists, the conversion has already been performed, so you can cancel the operation.)

Once the database conversion has been performed, you'll load the database each time you start the API Viewer by selecting File | Load Database File from the menu.

To use the Viewer, select the type of item you're looking for in the API Type list: Constants, Declares, or Types. The available items will be listed in the Available items list. You can scroll to find the item you need or, if you know the name, start typing it in the Type box to scroll automatically. Once you locate the item, select it by clicking it.

The next step is to specify whether you want the item declared as Public or Private by selecting the appropriate option. Then click Add to add the item to the Selected Items list.

Repeat these steps until all the items you need are added to the list. Finally, click the Copy button to copy the items to the clipboard. Now you can switch back to the VB IDE and use the Edit | Paste command to insert the declarations in your source code. No typing, no errors--it's a real time-saver!

Do you need help with VB/VB.Net? Gain advice from Builder AU forums

Related links

Comments

1

Muhalif RS - 13/11/06

Thanks all on your support.

Yes....I need Visual Basic Code

» Report offensive content

2

mohammad - 18/05/08

API as Microsoft Visual Basic 6.0

12345679

» Report offensive content

Leave a comment

You must read and type the 6 chars within 0..9 and A..F

* indicates mandatory fields.

2

mohammad - 18/05/08

API as Microsoft Visual Basic 6.0 12345679 ... more

1

Muhalif RS - 13/11/06

Thanks all on your support.Yes....I need Visual Basic Code ... more

Log in


Sign up | Forgot your password?

What's on?

  • Optus Deal

    Broadband + home phone + PlayStation®3 in a single package price!