You are invited to Log in or Register a free Frihost Account!

Creating a Screen Saver on Window

-I sure that you knowns many about Screen Saver (SS), i summarize this : SS is a windows application, SS run when meachine is idle after given period is installed.
When SS running, it will run with fullscreen mode.
-You can configure SS through Setting dialog, this dialog is called when user clicked on Setting button on Display windows.
- To build a SS, you must define three function:

   LRESULT __stdcall ScreenSaverProc (HWND,UINT, WPARAM, LPARAM );// process messages have sent to SS, similar Window Procedure
   BOOL __stdcall ScreenSaverConfigureDialog (HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam)// process messages of dialog Setting.
   BOOL RegisterDialogClasses(HANDLE hInst) // this function is only return 1.

- With a Window Procedure of application, if you dont process any message, you must call DefWindowProc to process it, but with SS
- You shouldn't define WinMain function, you will get a error if define it, because this function have defined in scmsave.lib
- ID of dialog Setting must be 2003

   #define IDD_DIALOG1 2003

I will guide you create a ScreenSaver which show a ball and move it on screen. User set speed for this ball in setting dialog.

First, you must create a project Win32 Windows Application(with Visual Studio IDE) or Win32 GUI project with anaother IDE, this guidence i use Visual Studio.And i only discribe my source code, you have to check clearly my attached file.

+ Add a dialog setting for SS,
+ Add a ball bitmap into resource
+ in code, we create a struct MyBitmap for hold information ball bitmap.
+ Init function will call to initialize MyBitmap struct.
+ LoadInfoOfBitmap,SaveToFile function to save and fetch speed of ball.
+ ScreenSaverProc function recive a message sent from queue-system message, and process it. four message we must process are WM_CREATE,WM_TIMER,WM_ERASEBKGND,_WM_DESTROY.
+ ScreenSaverConfigureDialog function recive a message from queue-system message to Setting Dialog.

Second, you complie source code and get a PE file, rename file type from .exe to .scr. copy & paste this file into C:\Windows folder, must remain this filename

Third, at Screen Saver tab (Right-Click on Desktop-> choose Display->Choose tab Screen Saver), looking for a ScreenSaver type at drop-down box which have same with filename above, if you found it, you are successful.
Related topics
751 Useful Windows XP Files
Site Showing Error.
weird problem with computer standby
can anyone help me please?
Untold XP secrets
How to Run a Full Computer Backup or Virus Scan Efficiently
Interesting IE6 Software Bug...
Vicki | Quartz Composer Animated Desktop
HELP! My PC shuts down unexpectedly!
Resize a batch of images
Worst windows experiance
Please visit my new forum Abundance Blessings Grace Reiki.
Recommended FREE/SHAREWARE Software
Slow Screensavers...Sometimes
Reply to topic    Frihost Forum Index -> Scripting -> Others

© 2005-2011 Frihost, forums powered by phpBB.