且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C ++中为Windows编写屏幕保护程序?

更新时间:2023-10-28 07:53:40

基本上,屏幕保护程序只是一个普通的应用程序,接受几个命令行选项,提供

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.

因此,编写一个普通的exe应用程序,它接受以下命令行参数(从 href =http://msdn.microsoft.com/en-us/library/ms686421(v=vs.85).aspx> http://msdn.microsoft.com/en-us/library/ms686421(v = vs85).aspx ):

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 - 以全屏模式启动屏幕保护程序。

  • / c - 显示配置设置对话框。

  • / p #### - 使用指定的窗口句柄显示屏幕保护程序的预览。

下一步检查一些DirectX / OpenGL / SDL教程,并写一些眼睛糖果。

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.