Having the CLEAR EVENTS in the form is the key here. You didn't mention having that before. Was it there all along?
IAC, you shouldn't need to CLEAR CLASS after READ EVENTS. If anything, you can just RELEASE OApp, which should release the class. This should also happen as soon as your main program terminates anyway, because OApp should be release at that point.
>Thanks Barbara and Erik,
>
>I found a way to release the .EXE, but I'm still not sure that what I'm doing is right... Simplifying, here is what I do:
>
>Let’s consider the inventory application (project compiled to inventory.exe). The main program of the project creates an object oApp of class SkyApplication defined in a .VCX library:
>
> oApp = CreateObject(‘SkyApplication’,’InvControl’)
> READ EVENTS
>
>The Init of oApp runs a menu, and the Exit bar of the menu does:
>
> oApp.Release
>
>In the Destroy method of SkyApplication issues:
>
> CLEAR EVENTS
>
>If I run inventory.exe as above (from the command window or under run time), inventory.exe is not released from memory.
>
>The way I found to release the inventory.exe is to add CLEAR CLASS ClassName after read events in the main program.
>
> oApp = CreateObject(‘SkyApplication’,’InvControl’)
> READ EVENTS
> <b>CLEAR CLASS SkyApplication
>
> (CLEAR CLASS ALL will not help - it probably looks for class ALL….)
>
>Anything wrong with what I do?
>If not, then do I need to specifically issue CLEAR CLASS ClassName for all objects created using CreateObject()?
>Why are things different when compiling to an .APP?
>
>Thanks,
>dz