VFP6 and WinFaxPro
                  -- Phil Bartow--
         -- VFUG NewsLetter Nov 1999--
About a year ago I tried to find a program to Fax from within a VFP6 application. 
There was an ad in FOXPRO magazine for a program to fax (unnamed here) but it would not work with NT.  WinFaxPro was half the price but the people at Semantic were less than helpful in providing an example on how to use WinFaxPro in VFP.  

With some experimentation , the following evolved.  It has been used extensively, several times a days in several applications now for the past year. 

In essence, WinFaxPro is used as a printer.
(It is necessary to SET PRINTER TO WINFAX)   
WinFaxPro is evoked from within VFP6 to fax (print) a report.
The ***start here:*** is where the WinFaxPro set up begins.  This is extracted from a  PRG file that is called on a  Command button click .
***start faxing here** *  is in the middle of a loop that sends a report  to 1 to 12 sites depending upon the logic before ***start faxing here**.  
The fax numbers and recipient information are fields in a table.
The timing loop is used to give the modem time to clear before the next fax is sent. 
*******************************************************************

* DO WHILE .T.     &&.....  inside the body  of   reporting program

****  start faxing here
 

faxNUM  = TRIM(faxno)    && faxno is field name

fax2name = TRIM(person)   && person is a field name
 
************  NEED TIME FOR FAX TO CLEAR
*  wait timeout 1.5
ts1 = SECONDS()
ts2 = SECONDS()
DO WHILE .T.
      ts2 = SECONDS()
     IF ts2-ts1 > 2
EXIT
    ENDIF
ENDDO

faxtime = time()
faxdate = date()

FaxChan =DDEINITIATE("FAXMNG32","CONTROL")
retvar=DDEEXECUTE(FaxChan,"GO Idle")
retvar=DDEPOKE(FaxChan,"sendfax",'showsendscreen("0")')
retvar=DDEPOKE(FaxChan,"sendfax",'recipient("&faxnUM","&faxtime","&faxdate",
"&fax2name")')
retvar=DDEPOKE(FaxChan,"Sendfax",'resolution("HIGH")' )
***
REPORT FORM BOOKING1 TO PRINT NOCONSOLE &&===========>
***
retvar=DDEEXECUTE(FaxChan,"GO Active")
retvar=DDETERMINATE(FaxChan)

* *** *  end faxing here

*  test for exit or for next fax
*ENDDO

****************************************************************************
********************************

Phil Bartow
Bartow Associates, Inc