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?
sllyguy1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vettrangerCommented:
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.
0
sexmachineCommented:
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!
0
sllyguy1Author Commented:
Some one tell me how to load an api thing. Thanks I used the INI one as an example.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

sllyguy1Author Commented:
Some one tell me how to load an api thing. Thanks I used the INI one as an example.
0
mark2150Commented:
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
0
vettrangerCommented:
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!
0
mark2150Commented:
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
0
st_steveCommented:
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?
0
vettrangerCommented:
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.
0
vettrangerCommented:
And also, I'm going to relock this with a response to 'load an API thing', since we all seemed to let this slip by us.

To make an API function available to your VB program :

1. Make a module, or open an existing one.

2. select the General Declarations section of the module.

3. Cut and paste the Declare statement into it.

4. If the API uses and constants, or data structures, cut and paste the definitions for them into the General Declarations section as well.

If you follow the steps given in the article I posted for you, it takes you thru the process of placing API code in the right places, and implementing the call itself.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.