Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fax # parameter passed
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00079994
Message ID:
00080906
Views:
29
>Thanks Paul for responding,
>
>Could you help me buy the Program/Code for Delrina WinFax and DDE
>so I can send the Fax # to be Faxed in Foxpro 2.6.
>
>Also does this program allow me to send a Cover Sheet I created
>in Foxpro's Report Writer ????
>
>Thanks,
>David Anderson

David,
The basic premise is that you have to open a channel to delrian, set it to be the default printer, send the information for the fax, and then print your report. Some of this may be accomplished in an easier way, but here is a summary of what I am doing:

* Open DDE Connection and turn off faxing because if Winfax tries to fax
* while I am sending, it causes problems
mchannel2 = DDEInitiate("FAXMNG","CONTROL")
mres=DDEExecute(mchannel2,"GoIdle")


* Open channel to send a fax
mchannel = DDEInitiate("FAXMNG","TRANSMIT")


* Set printer driver stuff
SET LIBRARY TO SYS(2004)+"FOXTOOLS.FLL"
MFAXDRIVER=SPACE(144) && Initialize string for Fax Driver
MDEFDRIVER=SPACE(144) && Initialize string for Default Driver

*
* Open WIN.INI
*
MREGISTER=REGFN("GETPROFILESTRING","CCC@CI","I")

*
* Gets value set in [devices] section of win.ini for WinFax
* example: if the WinFax line says WinFax=WinFax,FaxModem,
* MFAXDRIVER will hold the value "WinFax,FaxModem"
*
MCALL=CALLFN(MREGISTER,"devices","WinFax","",@MFAXDRIVER,256)

*
* Gets value set in [windows] section of win.ini for device which is
* the current default printer
*
MCALL=CALLFN(MREGISTER,"WINDOWS","DEVICE","",@MDEFDRIVER,256)

*
* If no fax driver found, abort
*
IF EMPTY(MFAXDRIVER)
WAIT WINDOW "DELRINA WINFAX PRINTER DRIVER NOT INSTALLED"
IF !EMPTY(THEDBF)
SELECT(THEDBF)
ENDIF
RETURN .F.
ENDIF

*
* Reset default printer to WinFax
*
MAPPNAME="WINDOWS"
MKEYNAME="DEVICE"
MSETTING="WinFax,"+MFAXDRIVER
MREGISTER=REGFN("WRITEPROFILESTRING","CCC","I")
MCALL=CALLFN(MREGISTER,MAPPNAME,MKEYNAME,MSETTING)


*** This section of code can be put in a loop to add all recipients who need to
*** Receive this fax
*
* Parameter string for DDE call
*
MFAXNUM = IIF(EMPTY(SUBSTR(FAXNUM,2,3)),FAXNUM,"1"+FAXNUM)
MFAXSTRING = '"'+ALLTRIM(MFAXNUM)+'","'+ALLTRIM(FAXTIME)+'","'+ALLTRIM(FAXDATE)+'","'+ALLTRIM(NAME)+'","'+ALLTRIM(COMPANY)+;
'","'+ALLTRIM(SUBJECT)+'","'+ALLTRIM(KEYWORDS)+'","'+ALLTRIM(BILLCODE)+'"'

*
* DDE Call to send recipient data
*
mres=DDEPoke(mchannel,"Sendfax",'recipient('+MFAXSTRING+')')
if mres = .f.
FAXERROR = .T.
endif

**** These commands will set the coverpage, as well as fill the coverpage text
**** area
*
* DDE Call to set cover page
*
IF !EMPTY(COVERPAGE)
mres=DDEPoke(mchannel,"Sendfax",'setcoverpage("'+COVERPAGE+'")')
if mres = .f.
FAXERROR = .T.
endif
ENDIF


*
* DDE Call to set cover page text
*
IF !EMPTY(COVERMSG)
mres=DDEPoke(mchannel,"Sendfax",'fillcoverpage("'+COVERMSG+'")')
if mres = .f.
FAXERROR = .T.
endif
ENDIF

*** Next send the report
REPORT FORM &FAXREPORT TO PRINTER NOCONSOLE


*** Finally, reset the default printer and close dde

*
* Close DDE link
*
=DDETerminate(mchannel)
MCALL=CALLFN(MREGISTER,MAPPNAME,MKEYNAME,ALLTRIM(MDEFDRIVER))



I hope this all makes sense. In terms of performance, you only want to open and close the DDE channel once if you are faxing a lot of reports, as that is most time-consuming operation.

I have run this code against WinFax versions 4.0 through 8.0 and it works with all of them. The only compatibility problem I have run into is that under Windows 3.1 when sending hundreds of report, we would get DDE resource errors and crash the computer. This problem went away when we went to Windows 95.

Hope this helps!

Paul
Paul R. Moon
Business Software Solutions
paul@businessoftware.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform