API is a fairly simple concept really. The core Windows dlls (e.g. Kernel32, User32 etc) contain thousands of functions that can extend any language, including VB
Once you have made a declare statement (effectively a line of code that tells VB were to find the function you want), you call it like you would call any other custom or built-in VB function. The SetCursorPos API example would be this;
what that is saying is that you want the SetCursorPos function which is found in User32.dll. Paste that into the declaration section of a form or module and you can call it like any other function. Here's the whole thing;VB Code:
Private Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long
That will move the mouse cursor very close to the top left of the screen. The numbers are in pixelsVB Code:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Private Sub Form_Load() SetCursorPos 10, 20 End Sub
