I'm not convinced it's the best way to achieve your goal (I think Corion's is more useful), but there is a way to ask the Windows API if the screen saver is running: using the
SystemParametersInfo API call, with the proper function selected using the constant
SPI_GETSCREENSAVEACTIVE. I seem to recall that some of these functions (in particular,
SPI_SETSCREENSAVEACTIVE) doesn't work, or work that well on XP. So I'm not sure that this function will still work.