I am using ShellExecute to open a text file in notepad. I need to wait until notepad is close to continue with the execution of my program.

What do you think is the best way to do that?