My program opens an application using the ShellExecute command, e.g.
irtn = ShellExecute (hwnd=null, lpOperation = 'open'C, lpFile = 'edit_this.txt', ...)
In my case, txt files are associated with the app TextPad, so this line causes the system to open TextPad with the file edit_this. This much works fine.
Then, my program should wait until the user closes TextPad to continue. How can my program determine when TextPad has been closed?