weaponx Posted March 24, 2008 Share Posted March 24, 2008 (edited) So I have been using this screensaver for quite a long time:http://elouai.com/the_matrix_screensaver.phpOn 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 March 24, 2008 by weaponx Link to comment Share on other sites More sharing options...
rover Posted March 25, 2008 Share Posted March 25, 2008 (edited) 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 March 25, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
weaponx Posted March 27, 2008 Author Share Posted March 27, 2008 i finally got around to testing this today, the mousedelay seems to do the trick. I will have to test it on my home computer just for good measure.How does this differ from using the screensaver library?http://www.osix.net/modules/article/?id=538 Link to comment Share on other sites More sharing options...
rover Posted March 29, 2008 Share Posted March 29, 2008 (edited) @weaponxEdit: I noticed the author wanted an updated version. As you've already contacted the author, go aheadand 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 X86the mousedelay isn't enough because of system generated mouse moves that eventually trigger the delayand 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 libraryand 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 screensaverfrom explorer or command line.I think the lib handles the fChildPreview flag so 2 instances don't run when launching the config dialogor 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 zipor post it here like a 'tethered goat' to await the 'wolves'....hey, it's my first attempt with C++ Edited March 29, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now