Jump to content

C++ Screensaver


weaponx
 Share

Recommended Posts

So I have been using this screensaver for quite a long time:

http://elouai.com/the_matrix_screensaver.php

On some Windows installs it will start briefly and close within a few seconds (XP 32 bit).

I contacted the creator and he says its because it doesn't use the Windows builtin functions to monitor for mouse/keyboard activity, but instead looks for this activity directly. The source code compiles in Dev C++ just fine but works randomly due to this non-native user activity detection.

Any help converting this code to a more standard screensaver?

Edited by weaponx
Link to comment
Share on other sites

So I have been using this screensaver for quite a long time:

http://elouai.com/the_matrix_screensaver.php

On some Windows installs it will start briefly and close within a few seconds (XP 32 bit).

I contacted the creator and he says its because it doesn't use the Windows builtin functions to monitor for mouse/keyboard activity, but instead looks for this activity directly. The source code compiles in Dev C++ just fine but works randomly due to this non-native user activity detection.

Any help converting this code to a more standard screensaver?

Edit: typos, added keypress detect

increase the mouse delay value

LRESULT CALLBACK WindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
    static int mousecounter = 0;
    static int mouseDelay = 2;          // how many clicks/keypresses to wait before killing app

change default value of 2 to 30 or higher for mouseDelay

here's another matrix screensaver with better graphics

http://www.uselesscreations.com/matrix/

to add keypress support

static int keycounter = 0;
static int keyDelay = 1;

case WM_KEYDOWN:
    keycounter++;
    if (keycounter = keyDelay) SendMessage(hwnd,WM_CLOSE,7777,0);
    break;
Edited by rover

I see fascists...

Link to comment
Share on other sites

@weaponx

Edit: I noticed the author wanted an updated version. As you've already contacted the author, go ahead

and email it if you want to after having a look at my attempt (and anyone else who can critique).

only tested on Win XP SP2+ EN X86

the mousedelay isn't enough because of system generated mouse moves that eventually trigger the delay

and close the screensaver.

so I added a reset counter to the timer so every second the count was reset to zero.

a quick movement of the mouse was enough to close the screensaver and I dropped the mousedelay to 10.

then I noticed the main form was generated using the macro of CreateWindow (no extended styles)

so I modified it for Topmost style to eliminate my top of Z-order apps (DUmeter and DiskFree) from overlaying the screensaver.

I took a look at the scrnsave.lib and the Dev-C++ libscrnsave.a library

and before I knew it I ended up re-writing the screensaver code for the libscrnsave.a library.

Mouse and keyboard events are now handled by windows.

support for the password logon and preview screen is also enabled.

one thing I don't know how to add back in is the Findwindow 'Singleton' code to prevent multiple instances of the config dialog or screensaver

from explorer or command line.

I think the lib handles the fChildPreview flag so 2 instances don't run when launching the config dialog

or launching the fullscreen preview from display properties.

at any rate I could PM you the Dev-C++ project, header, resource and script files in a zip

or post it here like a 'tethered goat' to await the 'wolves'....

hey, it's my first attempt with C++

Edited by rover

I see fascists...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...