Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Event Notification from WinFax Pro in VFP App
Message
From
25/09/1999 15:28:12
 
 
To
24/09/1999 16:42:19
Rich Lieblich
Infosys Technologies, Inc.
Fanwood, New Jersey, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00268782
Message ID:
00268985
Views:
39
>I have designed a VFP6 app (under NT4) that allows my end users to automatically fax reports to clients. It uses Symantec's WinFax Pro V8.03 as its fax engine. In production for about a year and a half, this app was originally a VFP3 design under Win 3.1 and used DDE to pass fax requests to the WFP fax engine. The WinFax SDK included with V8.0 introduced communication via OLE automation so that a fax send could be intiated via code similar to
>
>SendObj=CreateObject("WinFax.SDKSend")
><< set up fax recipient name, phone number, cover page, etc.>>
>SendObj.Send(1)
>
>An inherent problem in my design has always been EVENT NOTIFICATION... and hence the PACING of "Send Fax" request. When I issue a Send request, I have NO way of knowing the status of the fax programatically..... UNTIL NOW. Microsoft has recently issued a utility called VFPCOM that gives Visual FoxPro the same capability that the Visual Basic's DIM...WITH EVENTS feature provides. According to a post elsewhere, this .DLL "....allows you to bind VFP code to COM events..."
>
>My REAL problem is that the concepts of COM, ActiveX Automation Servers and the Event Notification capability (outlined in the WFP SDK) are over my head. All I want to do is this:
>
>1. send a fax request to WFP.
>2. wait for notification that the fax completed.
>3. loop until all faxes have been sent.
>
>Can anyone help me with understanding VFPCOM.DLL and WFP's Event Notification... and at least get started on the right track?? Thanks!

The easiest way to do this would be if WinFax had a status property that you could check in a loop until the status changed to "finished". If no such proprety is available, and the only notification is through event notification, then you will have to define a class (this is easiest with ExportEvents) with an event with the same name as the event in the WinFax COM object:

0SendObj=CreateObject("WinFax.SDKSend")
oVFPCOM = CREATEOBJECT("VFPCOM.ComUtil")

oVFPCOM.ExportEvents(oSendObj, "c:\WinFaxClass.prg")

Now, modify the class definition in WinFaxClass.pgr and add a property called "done". And add some code to the method in the class the corresponds to the event in question in the WinFax object that sets the object's Done proprty to .T.

THIS.Done = .T.

Now, in your program code, Instanciate the WinFax control, your WinFaxClass, and the VFPCOM utility. Use the VFPCOM utility's bindevents method to bind your method to the control's event, and then poll your control's "Done" property until it is .T.

oSendObj=CreateObject("WinFax.SDKSend")
oMyWinFax = CREATEOBJECT("WinFaxClass")
oVFPCOM = CREATEOBJECT("VFPCOM.ComUtil")

oVFPCOM.BindEvents(oSendObj, oMyWinFax)
* Do your fax setup code here
oSendObj.Send()

nStart = SECONDS()
nTimeOut = 60 && this is optional, but good practice

DO WHILE oMyWinFax.Done = .F. OR (nTimeOut < SECONDS() + nStart)
ENDDO

* When the code reaches here, either the fax is done, or the operation timed out.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform