If you want failover, then you probably need to look at an external program to manage that.
Heartbeat is one such program.
This handles one server freezing, crashing, etc.
Unfortunately this isn't much help for you, as I don't think it runs on Windows yet.
MS has
a clustering solution, but it's only on Win2k Advanced Server.
Unless you're already running advanced server, and can write a COM+ perl script, then your best solution may be to take the ideas of heartbeat and adapt them to your script.
Open up a TCP socket, and have the programs ping each other back and forth. Typically the secondary will ping the primary. If the primary doesn't respond, then the secondary should take over.
A few issues to watch out for:
Primary Stops (crashes or freezes or program dies)
Primary Stops, but comes back up after secondary takes over (secondary needs to stop, or primary needs to realize that they have switched roles)
Depending on the application, you will have to make sure that the switch from primary to secondary is invisible to the user, this usually involves ip address changes or dns tricks.