CDIntf EnablePre event

If you are a VFP developer and have any questions about using our products from VFP here is the place to post them.
Post Reply
sbutts
Posts: 7
Joined: Tue Oct 01 2002

CDIntf EnablePre event

Post by sbutts »

How do you recommend I create the CDIntf object and capture the EnablePre event in Foxpro. I have subclassed the CDIntf object and I create a form on the fly and add the object to the form, Call the DriverInit of the CDIntf object and call CaptureEvents.

PUBLIC loAmyuniPDFForm as Form
loAmyuniPDFForm= CREATEOBJECT("Form")
loAmyuniPDFForm.ADDOBJECT("CDIntfEx","CDIntfEx")
loCDIntfEx = loAmyuniPDFForm.CDIntfEx
loCDIntfEx.DriverInit("IMS PDF Printer")
loCDIntfEx.CaptureEvents(.t.)

the EnablePre event DOES NOT fire when this code is run within the applicaton. If I run this code from the command prompt everything works fine. If I run this code from ANOTHER instance of Foxpro it works. What am I doing wrong here. Any help would be appreciated.

Thanks
Scott
chopsdogg
Posts: 16
Joined: Mon Dec 27 2004

Post by chopsdogg »

Did you ever figure this out?
sbutts
Posts: 7
Joined: Tue Oct 01 2002

Post by sbutts »

I sure did, I ended up doing everything from a modal form and it seems to work just fine.

Scott
chopsdogg
Posts: 16
Joined: Mon Dec 27 2004

Post by chopsdogg »

I'm trying to listen for the EnabledPre event by using EVENTHANDLER in VFP. I can't seem to be able to bind to the event though.

In my application init I'm creating up two global objects oAPDF (this is an instance of CDINTFEX.CDINTFEX) and oMyPDFWriter (an instance of the class def below).

I then try to bind to the event to my event handler object with the command below, but it always returns false like it is failing to bind.

llReturn = EVENTHANDLER(oAPdf, oMyPDFWriter, .T.)
(note llReturn is always false after the call)

Stepping through my code at the time of the EVENTHANDLER call both my variables are pointing to valid objects so both my classes are initialized, etc.

I then try to print through the application and the messagebox call in my event handler indeed isn't firing. Any idea why this doesn't seem to be binding up? The VFP help shows an example where my event hanlder class uses an interface, but i wouldn't think this should be nessecary.

DEFINE CLASS MyPDFWriter As Custom
PROCEDURE EnabledPre
MESSAGEBOX("In EnabledPre")
oAPdf.EnablePrinter("xxx", "xxx")
ENDPROC
ENDDEFINE
sbutts
Posts: 7
Joined: Tue Oct 01 2002

Post by sbutts »

I did not use EventHandler but reading the help it says "The class must implement the events interface for the particular COM object being passed in the first parameter". I would be interested to know how you get this resolved.

Good Luck

Scott
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Are you turning BroadCast messages ON ?
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Post Reply