It started pretty simply, I just wanted to have a screensaver on the big screen outside of our development lab to cycle though some webpages on our hudson server. I thought that there must be an open source tool somewhere that does what I need but alas couldn’t find anything out there. I am in general quite reluctant to download any free screensaver software from the web after the time I’ve spent fixing the computers of relatives after they downloaded a “screensaver”. After a few false starts (windows scripting of IE is not option for a screensaver (think what happens when you send a keypress to a screensaver!)) I finally came across a quite simple solution using C# and Windows Forms, based on the tutorial at Geekpedia. I put the source up on github so hopefully no one else will have to learn the hard way :-)
Things to watch out for:
- There is a difference between the WPF WebBrowser control and the Windows Forms WebBrowser control.
- The WPF WebBrowser doesn’t expose the full functionality of the control so this is a bad otion for the screensaver (in particular you want to suppress the scripting errors dialogs).
- You have to add the mouse and keyboard event listeners not to the WebBrowser control but to each document as it’s loaded.