Results 1 to 7 of 7

Thread: api?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106
    I was just wondering... how the hell do some of these people come up with those weird api functions.. and what is an api function? post some common and rare apis here!!

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    An API function is one that comes as part of an Application Programming Interface, supplied with the product. In most cases (for VB anyway) this is the Win32 API. The functions are stored inside a DLL, and VB loads them at runtime.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106
    and where can we find all these functions listed?

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    VB comes with a viewer which contains all the VB definitions. For documentation, check out MSDN on http://msdn.microsoft.com/library

    Look under "Platform SDK" for the details, organised by category.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Yeah, including the dreaded "As Any". I usually use the viewer definitions, then if it doesn't work, go to the header files and write my own.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    Guest
    Here is a way to determine if an API Function is available.

    Code:
    Private Declare Function LoadLibrary Lib "kernel32" _
      Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
    
    Private Declare Function GetProcAddress Lib "kernel32" _
      (ByVal hModule As Long, ByVal lpProcName As String) As Long
    
    Private Declare Function FreeLibrary Lib "kernel32" _
      (ByVal hLibModule As Long) As Long
    Code:
    
    
    Public Function APIFunctionPresent(ByVal FunctionName _
       As String, ByVal DllName As String) As Boolean
    
    Dim bAvail as boolean
    bAvail = APIFunctionPresent("GetDiskFreeSpaceExA", "kernel32")
    
        Dim lHandle As Long
        Dim lAddr  As Long
    
        lHandle = LoadLibrary(DllName)
        If lHandle <> 0 Then
            lAddr = GetProcAddress(lHandle, FunctionName)
            FreeLibrary lHandle
        End If
        
        APIFunctionPresent = (lAddr <> 0)
    
    End Function

  7. #7
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    What's wrong with the as Any Keyword, It's really useful I thought.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width