Results 1 to 5 of 5

Thread: Just don't get it

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Location
    Mesa,Az,USA
    Posts
    3

    Angry

    Im trying to learn api
    declare function publicname lib "libname" _ <--I understand
    Alias "alias" Byval variable as type <--- don't understand
    can any help expain?
    what do i treat the returned data as?

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Ill give it a shot

    Am new too api as well but ill give it a shot.

    Ok the (ByVal As Variable as type) means

    Whatever you set the variable in the type declaration like this


    Public type Woah

    Integer * 25 <--- thats the The value that the api uses

    End Type


    Hope i made sense..

  3. #3
    Guest
    1) The libname is the library in which the API function is in.
    2) ByVal simply means that you are passing a copy of the value. When using API's, always pass arguments with ByVal.
    3) Most API's have a return value of 0 (if an error occured) or 1 (if it was a success). Others such as FindWindow will return important information, such as the handle of a window.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The Alias keyword is very important for the Win32 API. Basically, it means that if you have:
    Code:
    Private Declare Function WindowsFunc Lib "kernel32" Alias "WindowsFuncA" () As Long
    ...then in the DLL, the function is called WindowsFuncA, but you would rather refer to it as WindowsFunc. Many functions in the API have two versions, an A version, and a W version. The 'A' is for ANSI (Windows 9x), and the 'W' is for Wide (Unicode on NT).
    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
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282
    Alias is also important because many functions have names which are illegal in VB so you can provide one that's legal. For example it might be a reserved word or contain characters which can't be used ( such as starting with a _ ).

    A really good place to look at these declarations is on the MSDN CD, under books. 'Hardcore VB' gives a thorough and clear explanation of how to create declarations from just the C export info. Well worth reading.

    That's Mr Mullet to you, you mulletless wonder.

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