The time that you want this app to run is referred to as a Windows Service application. The problem is what you describe cannot be done in a Windows Service app.
On Windows Vista and above, you would be writing a custom Credential Provider.
You're going to have a REALLY hard time with this as you can not do this in .NET. Well, it's VASTLY harder to do in .NET than it is in C/C++.
You can get an idea of what you're up against from this