Yes, there is - I do know that older UPSs used this (on a 9/24 pin serial com port) to indicate to the computer/system they were powering that they had switched to battery backup when power failed (I think the old serial port palm pilots also used this scheme to indicate when you pressed the button on the dock to sync); I can't remember off hand which pins they used (likely DTR or CTR to ground?); for a parallel port, something similar can be done - use one of the control port pins and tie it high or low (both ground and 5V are available on that port). Then you just need to write the software to detect that.
Off the top of my head: No, I do not - but the idea seems simple enough, and if pressed (if I really needed to do it), I could probably hack something up. But there really isn't any need to; solutions already exist (well, on Linux at least!) - see the following links:
**broken link removed** **broken link removed**
You might also want to check other pages in that HOWTO file as well - the main meat of the monitoring of the port is in the powerd.c source code (look that up on google). You could probably write something similar in nearly any language.
For Windows, I am sure there are ways of monitoring the ports as well to cause a similar action (although it might need some custom DLLs or whatnot to get around Windows weird DONOTTOUCH port issues); some googlefu will go a long way here. Ultimately, though, you are likely going to need to do some coding (although, like I posted above, this has already been done in Linux - so not much is needed there).