You can also build a ApplicationLoader which contains the login mechanism. If the login is successful finished it loads the real application in a new AppDomain and after the real application is started the application loader finish. If the user try to start the application you can prevent it by several ways. For instance the real application could awaiting a secret from the loader. If the secret will not be passed the application do not start. I think this is more possible then trying to control threads which is impossible because like boudino said the OS is the one and only thing which can doing this.