• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
Saturn Software MillsVisit for more technical article http://www.saturnsoftmills.com
 
How to write your own Screensaver using Visual C++
Screensaver is a program that is used primarily to safeguard your computermonitor from phosphorus burn. If you keep your computer idle for few minutes, the staticpicture on your monitor may be harmful for the health of your monitor. The fixed patternof pixels will induce the electron gun to hit the same area on your monitor with the sameintensity. This can permanently damage your monitor. To avoid such situation, peoplekeep screensavers in to their computers. The duty of these screensavers is to save yourcomputer screen from this situation. After a certain predefined idle time, the screensaveractivates itself and envelop the complete screen. The characteristic of good screensaver isthat it should cover the entire screen and colors, picture, geometry etc. should have somemotion in to it. You might have seen that most of the time the background of thescreensavers is kept black. This is a good practice to relax the computer monitor.In this article, I will tell you how to write your own screensaver program using VisualC++. The prerequisite to learn this is that you must have programming knowledge inVisual C++. The very first thing you must know that screensavers are also executablefiles with extension “.scr”. If you can write a program to create some animation in awindow, you can easily build a screensaver too. A screensaver also draw the animation inside a window only. But this window is little different from the conventional one. In ascreensaver, we create a window without any caption bar, menu bar, toolbar, status bar.The size of the window is equal to the display size of your monitor. Once you havecreated this window, keep the background color black (or any other color of your choice).Now draw some picture, geometry inside the window and animate it. That’s it. Yourscreensaver is ready. But still few things are missing. You know that on some user inputaction like button press or mouse move etc. the screensaver must disappear. You mustcatch these user input signals and destroy the screensaver window to finish it. This wayyou can create a screensaver of your own design. Once you have created the screensaver,change its extension from .exe to .scr and copy it to C:/Windows/system32 directory. Itwill automatically be listed in the screensaver list.Now, let me tell you how you can do all this using Visual C++ programs.
1. You must register a new class of window with no cursor.
m_lpszClassName = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW,::LoadCursor(AfxGetResourceHandle(),MAKEINTRESOURCE(IDC_NULLCURSOR)));
2. Get the extent of your computer monitor 
CRect rect(0, 0, ::GetSystemMetrics(SM_CXSCREEN),::GetSystemMetrics(SM_CYSCREEN));
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...