I am writing an application for (of all things) a character generator for an RPG that I am intimately familiar with. I can handle almost anything that is being thrown at me with this application, except this one tiny thing: reloading the application.

I have an MDI form (frmMain), and several MDI child windows. Any or all of the child windows can be open at one time. frmMain has a menu, and one of the options is File->New. When this is clicked, the application needs to reload, or reset itself to the state it was in upon initial open. No big deal, right? Well, for me it is.

Any or all of the child windows can be open at any given point, and when New is clicked all child windows need to be closed. Resetting of local and global variables within frmMain isn't an issue. The issue is closing the child windows that are open.

I've seen 2 API functions out on the net that might hold the solution to this: GetActiveWindow and GetParent. However, I'm not that versed in API functions, so I'm a little stuck on this. So my questions are:

1. Which of these API functions will work better for pulling this off?
2. Does someone know of a tutorial regarding these API functions that they can point me to? (Note - I looked at allapi.mentalis.org, and I can't figure out what they are doing there with either of these.)
3. Is there an easier way to reload the entire application?