Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows Address Book from VB6

Posted on 2004-04-03
11
Medium Priority
?
1,670 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

916 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