Jump to content
xisto Community
Sign in to follow this  
mole2k9

Newb Api Tutorial API tutorial explained

Recommended Posts

Alrighty! newb api VB tutorial coming up.

API is a piece of cake. If you know how to use a function in VB then you know how to use API. Example, take this function,


Private Function MyFunc(ByVal x As Integer, ByVal y As Integer) As Integer   MyFunc = x * y   ' 3 and 4 get passed to hereEnd Function


Private Sub Command1_Click()MsgBox MyFunc(3, 4)  ' gives you 12, or returns 12End Sub

Returns 12 if you feed the function 3 and 4.


API is exactly the same except the functions are stored in Dll's, like msvbvm60.dll, user32.dll etc...

So you pass values to those funtions in the dlls and you get a return value or so.

So if there was a function in a dll called MyFunc, you first have to declare the function in your vb program first such as

Private Declare Function MyFunc Lib "path to dll" (ByVal x As Integer, ByVal y As Integer) As Integer

then simply call it from your app,


Private Sub Command1_Click()   MsgBox MyFunc(3, 4)  ' gives you 12, or returns 12End Sub

Thats basically API.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.