I've coded a simple dll in delphi in order to deactivate the screensaver when my game is running.
I can use the function _enableSSaver to activate it back when I am done, but in case of a ctrl+alt+del or a crash the screensaver won't go back to normal.
I've seen there are some tags initialization/finalization but I don't know how to use them. Is there a way to make it that the screensaver is always enabled when the dll is unloaded (freed)?

Here is my code:

[pascal]library screenhndl;

uses
Windows,
Messages,
SysUtils;

function _disableSSaver : pchar; stdcall;
begin
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,0,0,0 );
SystemParametersInfo(SPI_SETPOWEROFFACTIVE,0,0,0);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE,0,0,0);
end;

function _enableSSaver : pchar; stdcall;
begin
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,1,0,0 );
SystemParametersInfo(SPI_SETPOWEROFFACTIVE,1,0,0);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE,1,0,0);
end;


exports _disableSSaver;
exports _enableSSaver;
begin end.[/pascal]