I've always wondered the best way to automate use of a GUI in windows. When I was about 15, I wrote a little application that used some simple Windows API functions to automatically click on certain locations on the screen based on a script. This could be used to automate GUI applications, but surely it's not the best way.
So, my question is: What's the best way to automate use of a GUI in windows? Are there certain windows API functions that would be beneficial? If the program were to crash, how could you detect that?