Assuming that you want this for a particular application you can use
Spy++[
^] to determine the class of the main window. Generally determining exactly which window is the main window for an application isn't possible - even if it usually is the first window created by the apllication.
Best regards
Espen Harlinn