|  | 
 Introduction Screensavers are nice. You all know them so I need not to describe what they are doing. But you may have asked yourself: “Can I make one with Blitz?” The answer is: “Yes” – But there are some issues you have to live with. This tutorial will give you a brief guideline on how to create your own (simple) Screensaver. Tutorial Version: 1.05 The Basics In order to make your program being able to run as Screensaver run under Windows, it must be capable to handle certain program parameters. Windows uses these to instruct the Screensaver what to do. The two most important parameters we need to recognise in our program are: 
 If here is no parameter present, the program must be terminated or else you will get a nasty memory leak. 
 Furthermore if you are using external data with your Screensaver, you have to set the current working directory to where your program is located each time the Screensaver is executed. If you don’t do so, you’ll get a memory access violation error!!! 
 At last we need to add a minimal delay to the main loop of our Screensaver. In Blitz2D/3D it makes sure that other processes running in the background will get enough CPU time. This is Blitz Basic's equivalent of the Visual Basic “DoEvents” command. 
 Hint: You can just hit “ctrl+alt+del” to get to the task manager and check the processe's CPU field to see how much time its taking. While testing your Screensaver you have to leave this line out. Just unmark it with ”;”! Also you have to give the program the parameters “/S” or “/C” depending on what do you test. Do so by adding the parameters via setting “Program” -> “Program Command Line” inside the Blitz IDE. Else the program will be just finished! 
Known Issues: 
 
For B+:
 
Eikon managed to access the preview window. You can download his example & source here.  
 
B3D:
 
(new) Maniak Dobril’s solution. Grab it here.
 
(old) Eddie Blitzmaniac’s Solution: Grab it here.
 I have prepared a source code. It shows how your program structure should look like. 
 You can also download it here. You may easily modify it according to your needs. Just add your code to the main functions named “Start()” and “Configure()”. Example Screensaver It’s time to check if our little screensaver works. I have added a bit of code, so that it will do something. :) 
 Grab it here. You may also use your own code! When you are ready do the following steps: 
 When you press “Configure” a tiny options window pops up. When you press “Test” you can run the Screensaver. Post Scriptum That's it! Hope it's been useful. If you'd like to discuss a point out, have anything to add or have found a bug inside, drop me a line via email: Flame Grisu here. Thanks for reading! Special thanks to Krylar, Eikon, Maniak, Eddie Blitzmaniac, Genexi2 & SDF! For a printable copy of this article, please click HERE. 
 This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.   |