Screen Saver Base Class | CodeGuru

Screen Saver Base Class

–> In Window95 a screen saver can be previewed in display property dialog . How can the application knows whether it runs in full screen mode or in the preview mode . If the the first parameter is ‘c’ you need to run config . if it is ‘p’ you need to create a preview […]

Written By
CodeGuru Staff
CodeGuru Staff
Dec 15, 1998
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

–>

In Window95 a screen saver can be previewed in display property dialog . How can the
application knows whether it runs in full screen mode or in the preview mode . If the the
first parameter is ‘c’ you need to run
config . if it is ‘p’ you need to create a
preview window . If it is ‘s’ you need to
create full screen window .

I write the three base class which are for the common usage .

  1. One is derived from CWinApp , it(CSSApp) will judge whether runs in
    full screen mode or in preview mode and call the proper member function to start task .
  2. The other two are derived from CWnd , one(CFullWnd) is full screen
    window the other(CSmallWnd) is preview window.

There are some virtual member function in the CSSApp .

  1. InitInstance(…) It will judge the running mode and call the proper
    function (DoConfig, DoSmall or DoFull) .Your class derived from CSSApp must call it in
    InitInstance .
  2. DoConfig(…) You must override it to display your configuration dialog
    .
  3. DoSmall(…) You must override it to create your preview mode window .
    You need create a child whose parent window is CWnd* pParent =
    CWnd::FromHandle((HWND)atol(__argv[2]))
    .
  4. DoFull(…) You must override it to display the full screen window .

The class CFullWnd and CSmallWnd can be the base
class of your full screen window class and preview window class . When the window is
created it will generate a timer . The thing you need to do is overriding the OnTimer(…)
function .

Download demo project – 177 KB

Download source – 27 KB

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.