The Windows Address Book is common to all versions of Windows and can be used in conjuction with Outlook, Outlook Express and other email clients.
If you want to create a list of contacts and their email addresses for emailing or any other purpose, try the following :-
Make sure the Windows Address Book is available through Outlook, Outlook Express or other email client.
Alternatively, launch [color blue]wab.exe[/color] via [color blue]ShellExecute()[/color], [color blue]WSH[/color] or the [color blue]RUN /N[/color] command.
In the [color blue].OLEDragDrop()[/color] event of a control, ([color blue].OleDropMode[/color] property of the control needs to be [color blue]1[/color]), of a VFP form, put :-
[color blue]
LOCAL aFiles[1] ,;
[tab]i,;
[tab]lcCont_name,;
[tab]lcEmail_Add,;
[tab]lnRecNo
DO CASE
CASE oDataObject.GETFORMAT(1)
[tab]oDataObject.GETDATA(1,@aFiles)
[tab]IF ALEN(aFiles) > 0
[tab][tab]CREATE CURSOR MAILINGLIST (cont_name C(100), email_add C(254))
[tab][tab]STRTOFILE(oDataObject.GETDATA(1),[C:\Temp\mailinglist.txt])
[tab][tab]CREATE CURSOR EMAILADDRESSES (cline C(254))
[tab][tab]APPEND FROM C:\Temp\mailinglist.txt SDF
[tab][tab]SCAN FOR ALLTRIM(EMAILADDRESSES.cline) = [E-mail Address(es):]
[tab][tab][tab]lnRecNo = RECNO([EMAILADDRESSES])
[tab][tab][tab]GO lnRecNo - 1
[tab][tab][tab]lcCont_Name = ALLTRIM(EMAILADDRESSES.cline)
[tab][tab][tab]GO lnRecNo + 1
[tab][tab][tab]lcEmail_add = ALLTRIM(EMAILADDRESSES.cline)
[tab][tab][tab]INSERT INTO MAILINGLIST (cont_name, email_add) VALUES (lcCont_Name, lcEmail_Add)
[tab][tab]ENDSCAN
[tab][tab]USE IN EMAILADDRESSES
[tab]ENDI
ENDC
[/color]
With both your VFP application and the Windows Address Book visible on the screen, all a user has to do it to select entries from the Windows Address Book, using SHIFT+CLICK, CTRL+CLICK or LEFT CLICK, and drag and drop them onto the VFP control.
To view the cursor put :-
[color blue]
SELECT MAILINGLIST
BROWSE[color black]
wherever it suits after the above code block.
There are many more properties available using this technique other than simply the name and email address and include the 'Notes' attached to the contact.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.