This is one the most useful post I have ever written, and I am sure you will find it useful.
In Windows Application some times we may need to check whether our application is running in IDE or is running as EXE.
A typical example would be, developer may need to provide user name and password every time he runs the windows application from IDE. As a developer I always use developer/administrator account while developing any windows application.