You can do this through an API call on Windows 9x (95, 98, ME, etc). I don't recall the name, but if you were to google for this subject you'd probably find something.
You cannot do this API call on NT, 2000, or XP. It requires you to write a GINA.DLL (see MSDN library), which is a Win32 DLL, which you can't write in C#. You'll need C or C++ to do it.