I changed the code slightly so it'll call, say, "saver.bat" and run any command you want when screensaver is activated. One great program to run is the wizmo which allows almost all power management such as turning off monitor. Download wizmo on http://grc.com/wizmo/wizmo.htm.
Here is the part I changed in CSaverApp::InitInstance()
// Run the screen saver
// CSaverWnd *pWnd = new CSaverWnd;
// m_pMainWnd = pWnd;
This is a very nice piece of work and saved me a ton of
I think I've got a fix for multiple monitor support. You do
need to set WINVER = 0x500 to compile this but the if test
should keep it working on 95 and NT4.
//Win95 and NT 4 should return 0 because they do
//not support SM_CMONITORS
//just create a window to fill the primary (and only)
//SM_CMONITORS is not defined if WINVER < 0x0500
if ( ::GetSystemMetrics(SM_CMONITORS) == 0 )
//on 98/ME/2000/and XP create a window to fill the
//entire virtual desktop
Your workframe is fine. By the way don't forget to implement a String in the String-Table with ID = 1 and insert a text, so this text will appear in the Screensaver Properties Name. E.g. "Mobbing Screensaver".
Your idea is good. Someone has really a bit to modify/add to the 'saver' project to get particular fitness. But in some aspects the things are not transparent. For instance why do You use two-step derivation from CWnd? (I expect because it's a part of some larger project from Your accumulations remaining unchanged.) The better is to implement primary screensaver functions as virtual methods with simple implementation in a single base class. If You intend the user should change something in Your code it's not good to modify the intermediate class (may affect the derivative). So the skeletal functions should be placed in the leaf class of the hierarchy.
I found strange that every call to a method of the currect object within its class scope is preceded with 'this->'. It does not affect the semantics but what is it for?
Thank You for the idea with placing an executable within a resource. It is the easier than I could mean.