|
-
Aug 15th, 2000, 01:55 AM
#1
Thread Starter
New Member
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?
-
Aug 15th, 2000, 03:09 AM
#2
Addicted Member
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.. 
-
Aug 15th, 2000, 08:42 AM
#3
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.
-
Aug 15th, 2000, 03:00 PM
#4
Monday Morning Lunatic
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
-
Aug 16th, 2000, 05:48 AM
#5
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|