• Increase font size
  • Default font size
  • Decrease font size
joomla templates, wordpress themes, drupal, datalife engine, graphics, seo,

Simple Visual C++ 2010 Screensaver Example with Solution \ Project Download

E-mail Print PDF

I was trying to make a screensaver today and wanted a barebones template to start with. I was surprised that I couldn't find one quickly so I'm posting the one I came up with. This example was made in Visual Studio Professional 2010 on a Window 7 64bit system. All this screensaver shows is a black screen.

To make this run as a screensaver you need to run it with the command line argument -s. To add that argument to your debugging session, right click on your project and click Properties. On the left choose Configuration Properties -> Debugging. I recommend changing the Configuration drop-down in the top left to All Configurations. In the Command Arguments space on the right, type a -s. You'll need to change the -s to a -c to debug your configuration window later. To test it outside of Visual Studio, change the extension to a .scr and place it in your Windows\System32 directory.

There are three functions that need implemented as you can see below. I've added comments to let you know where to put your code. I highly recommend you read this article when you're ready to do more. It gives a good description of what is going on and shows you how to incorporate OpenGL for rendering in your screensaver. Here is a zip of the Visual Studio Solution for convenience.

#pragma comment (lib, "scrnsavw.lib")
#pragma comment (lib, "comctl32.lib")
#define TIMER 1
//Required Function
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message,
                             WPARAM wParam, LPARAM lParam)
        case WM_CREATE:
            //Put your initialization code here.
            //This will be called on start up.
            SetTimer( hWnd, TIMER, 10, NULL );
        case WM_DESTROY:
            //Put you cleanup code here.
            //This will be called on close.
            KillTimer( hWnd, TIMER );
        case WM_TIMER:
            //Put your drawing code here
            //This is called every 10 ms
    return DefScreenSaverProc(hWnd, message, wParam, lParam);
//Required Function
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message,
                                     WPARAM wParam, LPARAM lParam)
    //Put your configuration interface code here
//Required Function
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
Last Updated on Thursday, 14 July 2011 14:51  


0 #17 dormir insonia 2017-09-12 21:28
Ler sobre este assunto na verdade foi ótimo pra mim.
Poder adquirir este conhecimento me ajudará em muito.
E estou grato por você ter deixado esta informação.

Muito Obrigado.
0 #16 Anemonalove 2017-07-06 20:16
Hi fellas! Who wants to chat with me? I'm live at, we can chat, you can watch me
live for free, my nickname is Anemonalove , here is my pic:
0 #15 Roseanne 2017-05-15 02:37
Hi, Neat post. There's a problem together with your web site in internet explorer, would test this?
IE still is the marketplace leader and a large portion of folks
will miss your excellent writing because of this problem.
0 #14 2017-05-04 05:12
Wow, fantastic weblog layout! How lengthy have you been blogging for?

you make blogging look easy. The whole glance of your web site
is excellent, let alone the content material![X-N-E-W-L-I-N-S-P-I-N-X]I just could not leave
your site prior to suggesting that I actually loved the usual info an individual provide in your visitors?

Is gonna be back continuously to investigate cross-check new posts.
0 #13 url 2017-04-29 18:01
? Uno de los magnificos video-juego a los que
he jugado no obstante a veces es repetitivo

Chekea y ademas navega por mi web... url:
0 #12 Trucos 2017-04-13 01:10
?Alucinante! Ciertamente me siento cautivado
con el ideario deel blog. Es facil y aun asi de utilidad.
En cantidad de veces es muy dificultoso alcanzar un contrapeso entre
usabilidad y apariencia visual. Tengo que decir que has
creado un curro buenisimo con esto. Ademas,
laa pagina carga muy velozmente en mi Internet explorer.
Un blog excepcional!

Revisa y visita mi page... Trucos:
0 #11 2017-02-23 04:05
My husband is Hispanic and I've been teaching
him about the correct which means of Saint Patrick's Day.
0 #10 seo vps tools 2017-01-12 04:30
Please let me know if you're looking for a article author for
your site. You have some really great posts and I think
I would be a good asset. If you ever want to take
some of the load off, I'd love to write some articles for your blog in exchange for a link back to mine.
Please send me an e-mail if interested. Regards!
-1 #9 serwis komputerowy 2016-02-07 16:03
Obecnie jeste?my w stanie zapewni? Pa?stwu wsparcie, pomoc i serwis w zakresie problemów ze sprz?tem
i oprogramowaniem , instalacji systemów operacyjnych,
usuwaniem wirusów, trojanów, szkodliwego oprogramowania, czyszczeniem komputerów,
pomoc w modernizacji, rozbudowie i zakupie nowych komputerów czy zak?adanie sieci komputerowych kablowych jak i bezprzewodowych .

Feel free to visit my website - serwis komputerowy:
0 #8 horny women 2015-11-14 23:04
Does your site have a contact page? I'm having problems locating it but, I'd like to
shoot you an e-mail. I've got some ideas for your blog you might be interested in hearing.
Either way, great website and I look forward to seeing it improve over time.

Add comment

Security code

Main Menu