I write a Windows application that needs to have some "secret" functionality. For example, the application disables certain parts of the UI if the user is running in a certain environment. But because of corporate security measures, actually testing in that environment is inconvenient. (We have to request that it be set up, and then wait for the helpdesk to do so, and this can take a while. And then if there's a bug that I fix, we have to do it all again to retest. Yes, this is very frustrating.)
So I have a mode that simulates running in that environment. We test in the simulation, get out all the bugs, and only deploy to the special environment at the end, just to confirm that it still works in the real environment.
The question is how to get into that special mode. It can't be something that you invoke in the app, because by then the app has loaded, and it's too late.
For now, I have a secret key that you hold down and then invoke the app. This works, but is confusing because people seem to have trouble knowing how to operate it; they'll press an let go, and then the key isn't down when the relevant code checks for the key.
I could require the presence of a special file, but that's more effort and if they leave the file behind, it'll stay in that mode unintentionally. Or I could make it a command line argument, but then again you would have to invoke the app in a somewhat careful way (like via the command line or a special shortcut).
Is there a better way to provide this kind of startup signal to an app, without external dependencies?