Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The DESTROY event -- clearing classes? from memory ?
Message
From
25/04/2002 14:25:06
Patrick O'Neil
American Specialty Information Services
Roanoke, Indiana, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
The DESTROY event -- clearing classes? from memory ?
Miscellaneous
Thread ID:
00649238
Message ID:
00649238
Views:
50
I'm using the VFPCOM utility for VFP6 (SP5) -- Win2k.

(By the way ... So far, I've been running this only from the VFP IDE )

The whole process works just fine, but I have a question about garbage collection here...

I'm starting up Word97 and binding the Word.Application events to the WordEvents procedures, as in the following:
  PUBLIC obj_VFPCOM
  PUBLIC obj_Word
  PUBLIC obj_WordEvents
  PUBLIC int_BindEvents_Status

  obj_VFPCOM     = CREATEOBJECT ( 'vfpcom.comutil'   )
  obj_Word       = CREATEOBJECT ( 'word.application' )
  obj_WordEvents = CREATEOBJECT ( 'WordEvents'       )

  obj_WordEvents.ow = obj_Word
  int_BindEvents_Status = obj_VFPCOM.BindEvents(obj_Word , obj_WordEvents)

  THISFORM.current_ole_rtf_control = THIS
  
  obj_Word.VISIBLE = .T.
  obj_Word.ACTIVATE
  obj_Word.DOCUMENTS.ADD
The above code works just fine in starting up Word97. And when i exit Word, the QUIT event in WordEvents fires and runs the following code:
CLEAR CLASS vfpcom.comutil
CLEAR CLASS word.application
CLEAR CLASS WordEvents

RELEASE obj_VFPCOM
RELEASE obj_Word
RELEASE obj_WordEvents
  
THISFORM.current_ole_RTF_control.BACKCOLOR = RGB(255,0,255)
(The BackColor change just shows me the event has fired, without waiting for a debugging messagebox).

QUESTION:

The CLEAR's and the RELEASE's do _not_ cause the WordEvents "Destroy" event to fire (like i expected). However, when i use the QUIT command in the command window to exit VFP IDE, __THEN__ the WordEvents "Destroy" event fires (I have it display a debugging MESSAGEBOX).

I want to avoid a accumulation of memory usage, and would like to programmatically get rid of whatever is activating the Destroy event.

Could someone explain to me what is happening and how i can accomplish this sort of garbage collection / memory cleanup ?


ADDITIONAL RELATED QUESTION:

When I shut down windows (after running this program), i frequently get a message stating that a DDE process is still running. Is this some remnant of the instance of Word97 still running as an OLE server somewhere in memory ?


many thanks for any help,
patrick
Next
Reply
Map
View

Click here to load this message in the networking platform