How can I write a screen saver for Windows in C++?

天涯浪子 提交于 2019-11-30 14:15:38

问题


I want to write a screen saver for Windows using the Windows API. How can I start to write it?


回答1:


Basically a screensaver is just a normal application that accepts a few command line options, provided by windows, to determine if it should start fullscreen or in a preview window.

So, write a normal exe-application that takes the following command line arguments (from http://msdn.microsoft.com/en-us/library/ms686421(v=vs.85).aspx):

  • /s – Start the screensaver in full-screen mode.
  • /c – Show the configuration settings dialog box.
  • /p #### – Display a preview of the screensaver using the specified window handle.

Next check out some DirectX / OpenGL / SDL tutorials and write some eye candy.

Obviously you should check for mouse movements and key presses and exit your application if the user wakes up.




回答2:


Good luck on your search.

Its better if you can find real screensaver code instead of hacking up something. This way you can work on the screensaver faster.

There is more to screensavers than just modified exes. Do you want dual monitor support? How would you do it? Both screens as one big screen or both screens as separate screens?

Opengl does things a bit differently and there are other issues.

Microsoft had demo code for opengl and directx screensavers, if you want I can find the names because I might have the code on my computer somewhere. Could make your search easier with some project names.



来源:https://stackoverflow.com/questions/5165133/how-can-i-write-a-screen-saver-for-windows-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!