the-generalist.com

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

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.

#include
#include
#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)
{
    switch(message)
    {
        case WM_CREATE:
            //Put your initialization code here.
            //This will be called on start up.
            SetTimer( hWnd, TIMER, 10, NULL );
            return(0);
 
        case WM_DESTROY:
            //Put you cleanup code here.
            //This will be called on close.
            KillTimer( hWnd, TIMER );
            return(0);
 
        case WM_TIMER:
            //Put your drawing code here
            //This is called every 10 ms
            return(0);
    }
 
    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
    return(FALSE);
}
 
//Required Function
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
{
    return(TRUE);
}
Last Updated on Thursday, 14 July 2011 14:51  

Comments  

 
0 #19 Forum.Sacimicin.Com 2017-11-08 20:38
(Org.) Libertinagem: acarar das ciências sociais.
Quote
 
 
0 #18 FirstOren 2017-10-07 10:01
I see you don't monetize your blog, don't waste your traffic, you can earn additional cash every month because
you've got high quality content. If you want to know how to make extra
$$$, search for: Mrdalekjd methods for $$$
Quote
 
 
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.
Quote
 
 
0 #16 Anemonalove 2017-07-06 20:16
Hi fellas! Who wants to chat with me? I'm live at HotBabesCams.com, we can chat, you can watch me
live for free, my nickname is Anemonalove , here is my pic:


https://3.bp.blogspot.com/-u5pGYuGNsSo/WVixiO8RBUI/AAAAAAAAAFA/JWa2LHHFI2AkHParQa3fwwHhVijolmq8QCLcBGAs/s1600/hottest%2Bwebcam%2Bgirl%2B-%2BAnemonalove.jpg
Quote
 
 
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.
Quote
 
 
0 #14 g5g.info 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.
Quote
 
 
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: http://alanaboud.com/__media__/js/netsoltrademark.php?d=trucoteca.com
Quote
 
 
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: http://www.highspeedcspan.net/__media__/js/netsoltrademark.php?d=trucoteca.com
Quote
 
 
0 #11 ow.ly 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.
Quote
 
 
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!
Quote
 

Add comment


Security code
Refresh

Main Menu