Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 110,752 times

Contents

Related Categories

API Programming Series #1 - How can we access API functions from VB?

sreejath

How can we access API functions from VB?

Since these functions are encapsulated within external DLLs they are not available in VB by default. Before invoking (i.e. using) them, we must declare them. Usually this is done in the General | Declarations part of the module in which they are to be used.

One important thing should be remembered while declaring API functions within a form module. VB does not allow public Declare statements within form modules. So the Declare statements should be explicitly specified as Private since all object module members are considered Public by default. But this makes them invisible outside the module in which they are defined. So the functions should be declared in every module that needs to use them.
Declaring them in a separate .BAS module where they can be declared as Public and are therefore accessible to all the modules eliminates this duplication. This also permits easier maintenance.

Note: We will see how to declare and use API functions in the second article of this series.

Comments

  • Re: [2371] API Programming Series #1

    Posted by spirit.mbs on 31 May 2007

    plz help me 4r api.gv some books on api[:(]

  • Re: [2371] API Programming Series #1

    Posted by Praseeda on 09 Mar 2007

    The article is really valuble.It will give good exposure to Windows API

  • creatin sytem dedicated application

    Posted by hackaback on 19 Sep 2005

    hey ther, can anyone gve me an idea how to retrive the system's information in vb so that i could create a system dedicated application. or any other method

  • Posted by teambanana on 12 Mar 2003

    Look in the registry:

    For WinNT/2K (I assume this works on XP too...)

    [pre]HKLM\Software\Microsoft\Windows NT\Current Version\RegisteredOrganization[/pre]

    You'll need to find a way to read th...

  • API call for system registration information

    Posted by RT on 28 Nov 2002

    Hey
    just wondering if anyone has an advice for a problem tha i'm trying to solve:

    I need to make an API call from VBA within Excel to get information about the compnany that the machine is regist...