I have a program that I want to turn to a screensaver, where can I find some info on how to do it?
I dont want to use the scrnsave library.
My compiler is MSVC 6.0 and the program is attached.
I have a program that I want to turn to a screensaver, where can I find some info on how to do it?
I dont want to use the scrnsave library.
My compiler is MSVC 6.0 and the program is attached.
I decided to do what your doing a while ago and try figure what's happening without using the screensaver library....as soon as I more or less figured it all out, I realised that there was no benefit to doing this without the lib.....the lib does things very effectively and does cut out a lot of the mediocrity......but hell if you want to go down this avenue read on....
There are a few things you need to take care of when not using the scrnsave.lib.....
[list=1][*]Message interaction
Add the following handlers to your win proc
[*] Multiple instancesCode:case WM_SYSCOMMAND: if(wParam == SC_SCREENSAVE || wParam == SC_CLOSE) return FALSE; break; case WM_ACTIVATE: if(wParam == TRUE) break; case WM_MOUSEMOVE: case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: case WM_KEYDOWN: case WM_KEYUP: DestroyWindow(hwnd); break;
Use FindWindow to find other instances of your screensaver, and if the return is not NULL then terminate the app (The system spawns screensavers whenever a certain time elapses with no activity....over time it may spawn loads of screensavers!!)[*] Dialog Interaction
The dialog on the Desktop->properties allows users to chose screensaver, configure them and preview them....
When a screensaver is activated, it has a commandline that controls whether the config dialog should be shown, whether the screensaver should preview as a child of the preview box or whether it should run normally...you need to parse the commandline and act accordingly.....
For example with MyScreensaver.scr...
Show the dialog box with whatever toplevel window thats there as its parent.Code:MyScreensaver /c
Run the screensaver as normalCode:MyScreensaver /s
Run the screensaver in preview mode...the number at the end is the handle to the window that will preview your screensaver.....Parse this string....turn it to a DWORD (and then a HWND)...Get the size of the rect....draw a preview.....Code:MyScreensaver /p 2546
[/list=1]
At this point you might agree with me that this is starting to get to be a pain in the butt.........personally......I will go with the scrnsave.lib from now on !
The reason I want to work it from scratch is I have a library that handles all my window creation, keyboard, mouse, etc.. And I want to add support for makeing screensavers.
You can see the lib here.
Fair enough....if you are building a lib like that......Originally posted by Eber Kain
The reason I want to work it from scratch is I have a library that handles all my window creation, keyboard, mouse, etc.. And I want to add support for makeing screensavers.
You can see the lib here.
Its not too over the top to do this stuff I suppose....maybe I was in a moaning mood this morning
Hope the info helped anyway....good luck!
I am thinking of making a quick screen saver with OpenGL, does the "scrnsave" library work with that? Where can i access it, and does it have documentation for how to use it? Thanks.
Language: C++
Compiler: Visual C++ 6.0
Currently Working On: Simple OpenGL aspects