?
Solved

Windows Address Book from VB6

Posted on 2004-04-03
11
Medium Priority
?
1,690 Views
Last Modified: 2010-05-18
Hi Experts.

I'm trying to access the Windows Address Book (WAB) from Visual Basic 6.0. I have found that MAPI contains some Methods for this, but Microsoft doesn't support them and that will overhead my application with MAPI files.

WAB32.DLL it's the file in Windows that contains the information for getting Contacts information from the Address Book, but I haven't found a VB6 example to use this DLL within VB.

I would apreciate if you can tell me how to get the Contacts information from WAB without using MAPI or other external DLL or file (only with WAB32 library) using Visual Basic 6.0.

Thank you in advance!

Regards,
Pablo Barvo
0
Comment
Question by:pablob
8 Comments
 
LVL 18

Expert Comment

by:Sethi
ID: 10750260
Not possible in VB.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10750700
Youll have to do it manually

Youll probably have to register but

http://www.devcity.net/forums/topic.asp?tid=46944&highlight=read%7Cwab

Take a look at the bottom paragraph there is a VB project that uses an api to do the job.
The path of the Windows Address Book (wab) file used by Outlook Express can be found in the registry at: HKEY_CURRENT_USER\Software\Microsoft\WAB\WAB4\Wab File Name.

Here's what I've managed to figure out about the wab file format, looking at it with a hex editor (first byte of the file is byte zero).

Byte #:
32-35 ($20-$23) - Location (Address) in the file of the start of the table that tells where the information for each contact is located (I'll refer to it as the Contact Data Table).
36 ($24) - Number of entries in the Contact Data Table.
48-51 ($30-$33) - Location in the file of the list of Display Names for the persons (contacts) in the address book.
52 ($34) - Number of Display Names in the file
64-67 ($40-$43) - Location in the file of the list of Last Names for the contacts.
68 ($44) - Number of Last Names in the file.
80-83 ($50-$53) - Location in the file of the list of First Names for the contacts.
84 ($54) - Number of First Names in the file.
96-99 ($60-$63) - Location in the file of the list of E-Mail Addresses.
100 ($64) - Number of E-Mail Addresses in the file.

In you're trying to read the file in binary mode using VB, you'll need to add one each to each of the values above, since VB considers the first byte of a file to be byte one, not byte zero.

Format of the Contact Data Table (location as specified above):
Each entry in this table occupies 8 bytes. The first four bytes of each entry are what we'll call the Contact Index, a value that uniqely identifies each contact in the address book. The 5th through 8th bytes are the location (address) in the file where the Contact Data Record (Home Address, Home Phone, Work Phone, etc.) can be found. The exact format of the Contact Data Record is not something I've figured out yet.

Format of the other lists above (Display Name, Last Name, First Name, and E-Mail Address):
Each entry in one of these lists occupies 68 bytes. The bytes are stored as Unicode, meaning there are two bytes for each character, with the upper byte being zero (at least in English language versions of Windows). By reading every other byte, you can get the ASCII values that represent each character in an entry in the list. When you come to a byte pair where the lower order byte is zero, you've reached the end of the text for that entry. The 65th to 68th bytes of each entry are the Contact Index. By matching up Contact Index values between lists, you can tell which entry in one list goes with an entry in another (i.e., which Display Name belongs with which E-Mail Address). You can also match the Contact Index in these lists to the one in the Contact Data Table to determine where the rest of the contact's information is located in the file.
0
 
LVL 28

Expert Comment

by:Ark
ID: 10754202
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 

Author Comment

by:pablob
ID: 11256815
Hi Experts,

I have test all the answers you have send, and no body have answered my question yet.... I'm planning to get a refund because the solution has not been posted.

Please post your comments....

Thank you
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11305363
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0
 

Expert Comment

by:ozguny
ID: 11633382
Why isn't it possible to use WAB32 from Visual Basic?

Thanks.
0
 

Expert Comment

by:Caverous
ID: 12866238
0
 

Expert Comment

by:astrix2
ID: 21264094
Very nice the code in

http://www.locati.it/michele/kwab/

Have good source code for extrac simple the address book:

http://www.locati.it/michele/kwab/download/kwab1.2.zip

Thanks for the link!!!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question