I am trying to write a test program to detect the activities on another application. Such as user input on the textfield, mouse click on buttons and activation of dialogue box.

Is it possible using the default WIN32 API detecting the messages send from the windows?

How could it be done?