Solved

Windows Address Book from VB6

Posted on 2004-04-03
11
1,602 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
Comment Utility
Not possible in VB.
0
 
LVL 48

Expert Comment

by:Mikal613
Comment Utility
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
Comment Utility
0
 

Author Comment

by:pablob
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0
 

Expert Comment

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

Thanks.
0
 

Expert Comment

by:Caverous
Comment Utility
0
 

Expert Comment

by:astrix2
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now