Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Creating a screensaver

mac_doggiemac_doggie Member Posts: 488
Hi,

I've created a form that should function as a screensaver. I changed the extention to scr, and that worked, but I've got another problem. When the screensaver starts the windows taskbar must be hidden too, but ths doesn't happen. I have set the form's align propertie to alClient and so it will be maximized, but I also want the taskbar to be hidden.

I also noticed that when I start my screensaver on a win98 machine it gets started every 10 seconds or so.... Result: After a few minutes the whole taskbar is full of screensaver forms and it even starts to run slower(because of the number of copies in memory) On my win 2000 machine I do not have this problem. Could it be because Delphi is installed on the win98 machine ???

Last question:Most screensavers have an extra screen where you can set several options, You can click the options button in the screen preverence/screensaveer tab. If I do so my own screensaver will start. Is there a certain way I can use this button to show my own options form ?


;-)
-mac-
mailto:[email protected]
the Netherlands...

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi,
    :
    : I've created a form that should function as a screensaver. I changed the extention to scr, and that worked, but I've got another problem. When the screensaver starts the windows taskbar must be hidden too, but ths doesn't happen. I have set the form's align propertie to alClient and so it will be maximized, but I also want the taskbar to be hidden.
    :
    : I also noticed that when I start my screensaver on a win98 machine it gets started every 10 seconds or so.... Result: After a few minutes the whole taskbar is full of screensaver forms and it even starts to run slower(because of the number of copies in memory) On my win 2000 machine I do not have this problem. Could it be because Delphi is installed on the win98 machine ???
    :
    : Last question:Most screensavers have an extra screen where you can set several options, You can click the options button in the screen preverence/screensaveer tab. If I do so my own screensaver will start. Is there a certain way I can use this button to show my own options form ?
    :
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    There is a windows API call, which logs your program as a screensaver:
    [code]
    var
    OldSysParam : longint;
    begin
    SystemParametersInfo(SPI_SCREENSAVERRUNNING, Word(true), @OldSysParam, 0);
    end;
    [/code]
    Make sure you call this function again in your OnDestroy event, and have the word TRUE changed to FALSE.
    There is also quite advanced ways to make sure windows can only start 1 instance of your program.
    [code]
    unit Unit1;

    interface

    type
    TForm1 = class(TForm)
    // Complete form declaration
    end;

    implementation

    // Implement all methods of the form and declare support routines

    { From this point is code to ensure just 1 instance starts }

    const
    UniqueScreenSaver: PChar = 'This must be an unique string, unless the program might fail.';
    var
    MutHandle: THandle;

    initialization
    MutHandle := OpenMutex(MUTEX_ALL_ACCESS, false, UniqueScreenSaver);
    if MutHandle <> 0 then // if Mutex has been created,
    Application.Terminate // a previous screen saver runs and terminate new one
    else
    MutHandle := CreateMutex(nil, false, UniqueScreenSaver);
    // Make sure the mutex does exist.
    finalization
    end.
    [/code]
    If you already have an initialization and/or finalization section, then feel free to just copy-paste this code into your initialization section.

    I've found something about a ScreenSaverConfigurationDialog(), but couldn't make much of it. My advice to you is, create a separate project, which allows the user to set the configuration and save that to a file. Then load that file at the start of the screensaver.
  • PerranPerran Member Posts: 241
    : Hi,
    :
    : I've created a form that should function as a screensaver. I changed the extention to scr, and that worked, but I've got another problem. When the screensaver starts the windows taskbar must be hidden too, but ths doesn't happen. I have set the form's align propertie to alClient and so it will be maximized, but I also want the taskbar to be hidden.
    :
    : I also noticed that when I start my screensaver on a win98 machine it gets started every 10 seconds or so.... Result: After a few minutes the whole taskbar is full of screensaver forms and it even starts to run slower(because of the number of copies in memory) On my win 2000 machine I do not have this problem. Could it be because Delphi is installed on the win98 machine ???
    :
    : Last question:Most screensavers have an extra screen where you can set several options, You can click the options button in the screen preverence/screensaveer tab. If I do so my own screensaver will start. Is there a certain way I can use this button to show my own options form ?
    :
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    I know that as programmers a lot of what we do is to have fun and learn new tricks, but I downloaded pretty cool screensaver from somewhere. Unfortunately, I've since deleted it. I would suggest code central at Borland or possible Steve Trefethen's web site. You can then look at their code and see how to implement yours.
  • Shawn CarterShawn Carter Member Posts: 0

    / http://forcoder.org / free ebooks and video tutorials about | Delphi R PHP C Java C# Go Objective-C Swift MATLAB Visual Basic PL/SQL C++ Assembly Perl JavaScript Python Ruby Scratch Visual Basic .NET FoxPro LabVIEW SAS Scala Lua Hack D F# Fortran Julia Kotlin Crystal Clojure Awk Dart Erlang Lisp ABAP Transact-SQL Apex Scheme Rust Logo VBScript COBOL Ada Bash Alice ML Prolog | ________

Sign In or Register to comment.