*activex must be register before using this code with regasm *run cmd as administrator and issue: (correct the path of cbUtilities) *C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe C:\Users\yousfi\Downloads\cbUtilities_activeX_cetin\cbUtilities.dll /codebase *behavior: when the notepad fires on desktop closing it manually causes the vfp9 crashing (on many diffrent tests) ! *OS=windows 10 pro. clea all set defa to "C:\Users\yousfi\Downloads\cbUtilities_activeX_cetin" &&correct your path here Local o As "cbNetCOM.Utilities", eh As 'cbUtilityEvents' o = Createobject("cbNetCOM.Utilities") Local lcFileName m.lcFileName = 'seTest.txt' Strtofile('',m.lcFileName) eh=Createobject("cbUtilityEvents",m.o) Eventhandler(m.o, m.eh) o.ShellExecProcess("notepad.exe", m.lcFileName, .F., .F.) * Shellexecuted the process * Lets do some work while it is running * Just to demonstrate it is async and we get the event * when it exists Public oTimer as Timer oTimer = CreateObject('myTimer') m.oTimer.Enabled = .t. Define Class myTimer as Timer Interval = 5000 && every 5 seconds Procedure Timer wait window 'I am doing nothing useful, just hanging around. '+ttoc( Datetime()) nowait endproc enddefine Define Class cbUtilityEvents As Session OlePublic Implements IcbEvents In "CBUTILITIES.TLB" &&in the source zip folder oHook = Null Procedure Init(toHook) This.oHook = m.toHook Endproc Procedure IcbEvents_OnProcessExit(ExitCode As Number, exitTime As Date, exceptionMessage As String) As VOID If Empty(m.exceptionMessage) wait window 'Process has exited on '+trans( m.exitTime)+ ' with exit code '+trans(m.ExitCode) MessageBox(FileToStr('seTest.txt')) Else wait window 'Process had and exception. Message:'+trans( m.exceptionMessage) Endif Eventhandler(This.oHook,This,.T.) This.oHook = Null Endproc Enddefine