Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Address Book

Status
Not open for further replies.

wgcs

Programmer
Mar 31, 2002
2,056
EC
Has anyone had any success in accessing the "Windows Address Book" from VFP?

I know I can go through Outlook automation (and I will), but I wanted another way for clients who don't have Outlook installed (since, I belive, Outlook Express also uses the WAB, and doesn't support automation).

a VB.net example is here:
a C example is here:
and here:

a reference to the WAB api for C is here:

The basic trouble with using the C-code is that, while the WAB api is COM-based it is not ActiveX: the WABOpen is a class factory for the IAddrBook interface, which cannot (as far as I can tell) be instantiated directly through CreateObject.

Anyone know how to call a method through an IDispatch interface from VFP?

(basically: what is the VFP translation of:
Code:
//I know this line can be xlated to a DECLARE-DLL statement in VFP:
ssWABOpen = (fWABOpen)GetProcAddress(hModule, "WABOpen");
//And this line can be a simple function call, 
// returning the pointer as a number, 
// or, probably, returning the object as a string,
//   though that would seem to be useless...
HRESULT hr = (ssWABOpen)(&lpAddrBook, &lpWABObject, NULL, 0);
// This is where I get stuck: is there an API to
//   "dereference" the "OpenEntry" method from the COM 
//   object pointer (number) returned from WABOpen? 
hr = lpAddrBook->OpenEntry(lpcbEntryID, lpEntryID,
       NULL, ulFlags,  &ulObjType, &lpIUnknown);

I know VFP can "implement interfaces", but I think that is the exact opposite of what is needed here...

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Thanks, Mike,

I hadn't thought about the MAPI api calls!

This may just do it.
(it doesn't necessarily get to WAB, though: I use Eudora, and it opens the Eudora Address Book, which is not the WAB. I assume if Outlook Express was my default mail client, it would have gone through that to the wab, but I guess I care more about getting the user's primary address book, whatever it is.)

For anyone interested in seeing/managing their "Windows Address Book" directly, try running "WAB.EXE" from the Start-Run dialog.



- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top