Solved

Windows Address Book from VB6

Posted on 2004-04-03
11
1,606 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
11 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 27

Expert Comment

by:Ark
ID: 10754202
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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