About API declarations in Access VBA

G

Guest

I'm amazed to see the ease with which you guys use API declatations to get
Access do what you want to do. I realise the potential there is enormous.
What I would like to Know are:
1) I'm using modules suggested by this newsgroup, which use a bunch of API
calls. I'm afraid if different modules added to my application declare the
same API functions. If so, is that simply inefficient coding (on my part) or
does that result in a resource leak ?
2) Where do I find a comprehensive Tutorial / Knowledge Base that equips me
with enough courage to use these functions myself. I want to know what all
can be done and how it can be done using API calls in MS Access. I want to
have total control over what I am doing in my modules.
 
A

Allen Browne

API calls can look a bit daunting, and I suspect that most VBA developers
just treat them as black boxes: provided you pass the right things in, you
get the right things back, and that's all you have to know. :)

It is a bit inefficient to have the same API aliased differently in
different modules. They're not to difficult to track down though. My
personal preference is to put all API calls into a module of their own, and
the duplication becomes obvious fairly easily.

The best resources are problably in the pure Visual Basic sites (not VBA nor
VB.NET), such as:
http://vbnet.mvps.org/api/_api/index.html
http://vb.mvps.org/samples/apixref.asp
There are a few differences in Access (e.g. controls in Access don't have an
hWnd if they don't have focus), but it's generally the same for most things
you do, and way you pass the data types is the same.

If you really want to understand APIs in more depth, you probably need to
learn some C, at least to grasp pointers and structures, and how to pass
them from VBA.

But please keep in mind that the brilliant thing about Access is the
simplicity and safety with which you can build your tables, relationships,
queries, and interface (forms and reports.) There's only a limited number of
places where you really need API calls, and most of them are listed here:
http://www.mvps.org/access/api/index.html
 
G

Guest

Allen,

Thank you very much for the 'detailed briefing' on the topic. Obviously, the
learning curve is very steep here. However, I'm determined to make a start.

Thanks again.
 
S

Stephen Lebans

First and most importantly you need to learn how to search:
GoogleGoups
MSDN

A couple of books to get you started:
Visual Basic Programmer's Guide to the Win32 API by Appleman
Hardcore Visual Basic - MCKinney (Available free online)

Any VB graphics book by Rod Stephens


For API in general the standard is "Programming Windows" by Charles
Petzold. It is written for C developers but is still a must read for any
developer starting out with API.


Finally, the best source, is well, the source. VIsit the MSDN site here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/wingdistart_9ezp.asp


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top