I've created a COM that is used to send data through the modem. The COM is build as a EXE and it use the MSComm object. It work great, except that when I quit it, it give me an error message (This application has caused an illegal operation and will be shut down...). If I build the COM as a DLL, it doesn't give me this error message.
To get this COM to work, I have used the VFPCOM.BindEvents(). I have also used some DOEVENTS, this command is not allowed in a DLL, so that's why I'm stuck with a EXE.
Here is the code in the Init():
THIS.ModemComm = NEWOBJECT("MSCOMMLib.MSComm")
THIS.EventHandler = NEWOBJECT("OnComm", "Comm")
THIS.VFPCOM = NEWOBJECT("VFPCOM.ComUtil")
THIS.VFPCOM.BindEvents(THIS.ModemComm, THIS.EventHandler)
And here is the Destroy():
THIS.VFPCOM.UnBindEvents(THIS.ModemComm, THIS.EventHandler)
THIS.VFPCOM = NULL
THIS.EventHandler = NULL
THIS.ModemComm = NULL
If I comment out these lines in the Init() and Destroy(), I don't get the error, so I guess that something there is causing me problems. It crashes also if I don't put code in the Destroy() event.
Help...
TIA
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only