Link to home
Start Free TrialLog in
Avatar of sllyguy1
sllyguy1

asked on

API's

Ok, I was looking thourgh all the API's calls and there is some interesting things like:
-------------------------------------
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
---------------------------------
how do I use these...all it says is what I posted above. But how do I call these in my programs?
Avatar of vettranger
vettranger

The followin article is a little dated, as it was written for the 16 bit API, but its as good an article as I've seen on using the INI file API calls.

http://support.microsoft.com/support/kb/articles/Q75/6/39.ASP

Just make sure that you use the 32 bit declares, and define any variables in this articles sample code as Long instead of integer. And if you have any problems with it, post it here and I'll help you with it, I've used all these calls quite a few times.

BTW, in VB6 you have the GetSetting and SaveSetting functions, which are superior to saving information in INI files.
Actully What he is looking for is how to load them into a program, he doesnt care about INI file he was using that as an example of what he meant!
Avatar of sllyguy1

ASKER

Some one tell me how to load an api thing. Thanks I used the INI one as an example.
Some one tell me how to load an api thing. Thanks I used the INI one as an example.
Buy a copy of Dan Applemans book "Visual Basic Programmers Guide to the Win32 API". Cost is about $60US and comes with complete text & samples on CD. Worth every penny.

You put the DECLARE in your program in the (General) section. Then you call function just like any other:

CALL APIname(Param1,...)

Appleman's book has all the declares and stuff in cut & paste form so you can drop it into your program. Also has data type declarations and related stuff. Makes using them dead easy.

M
Well, the sample I provided also shows where to put declares and how to use them. You have to start with one, so why not the one he mentioned!
There is only one API call I use regularly, the one for ExecCmd. Source on my web page - cut & paste and run!

www.cyberchute.com/rvbus/madmark

M
APIs are difficult (and powerful) routines....they're stored mostly in DLL files and are called from an "entry point"...they're too difficult to describe in detail...you must have a good background in C/C++ since most of them are written in C.

If you're not a power user or a low-level system programmer, just use the available functions in VB or download a few shareware OCXes to plug into your VB code...I'm still having a hard time trying to understand some of the APIs....esp. the Systray API. Gives me a lot of problems! If you find anything useful, share it with me as well, ok?
The above synopsis of APIs is very misleading. Altho a few API calls are somewhat complicated, many are quite simple to use, and some are almost essential to use in VB programming.

Over the years, quite a few features that were built in to VB have been dropped because you're expected to use them from the API.

APIs are definitely for the use of EVERY VB programmer, not just power users.
ASKER CERTIFIED SOLUTION
Avatar of vettranger
vettranger

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial