home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip Hitware 10
/
Chip_Hitware_Vol_10.iso
/
chiphit
/
multmedi
/
95licht
/
install.dll
/
1001
/
1
/
BLANKER.DPR
< prev
next >
Wrap
Text File
|
1997-04-04
|
7KB
|
254 lines
{$A+,B-,C-,D+,E-,F-,G+,H-,I-,J+,K-,L+,M-,N+,O+,P-,Q-,R-,S-,T-,U-,V+,W-,X+,Y-,Z1}
{ $MINSTACKSIZE $00004000}
{ $MAXSTACKSIZE $00100000}
{$APPTYPE GUI}
{ $define INTERNAL}
{ $define DEBUG}
{ $define COL256}
{$ifdef INTERNAL}
unit Blanker;
interface
uses WinTypes, LgdApi;
Function ScrInfo (var lisInfo: TLgdInfoStruct): bool; stdcall;
Function ScrAbout (hwndParent: HWND): bool; stdcall;
Function ScrInit (var mdModuleData: TModuleData): bool; stdcall;
Procedure ScrDone (var mdModuleData: TModuleData); stdcall;
Procedure ScrIdle (var mdModuleData: TModuleData); stdcall;
Procedure ScrTimer (var mdModuleData: TModuleData); stdcall;
Function ScrConfig (var mdModuleData: TModuleData; hwndParent: HWND): integer; stdcall;
implementation
{$else}
{$ifdef DEBUG}
{$IMAGEBASE $00400000}
Program Blanker;
{$else}
{$IMAGEBASE $02000000}
library Blanker;
{$endif}
{$endif}
uses
{ SysUtils,
Classes;}
{$ifndef INTERNAL}
WinTypes,
LGDAPI,
{$endif}
{ SysUtils,}
{$ifdef DEBUG}
LGDDEBUG,
{$endif}
LGDUTI;
const HELPFILE = 'LGD95.HLP';
HELPKEY:array[0..31]of char = 'Blackness';
{ requests information about screen saver }
{$ifdef INTERNAL}
Function ScrInfo (var lisInfo: TLgdInfoStruct): bool; stdcall;
{$else}
Function ScrInfo (var lisInfo: TLgdInfoStruct): bool; stdcall; export;
{$endif}
begin
ScrInfo := FALSE;
with lisInfo do
begin
if cBytes < sizeof (lisInfo) then
exit;
if cMagic <> lMagic then
exit;
afSaverFlags := SCR_LEAVESBLANK {+ SCR_MUSTHAVENONBLANK} +
{SCR_CONFIGDIALOG +} SCR_HELPAVAILABLE;
{$ifdef ENGLISH}
StrCopy (@strTitle[1], 'zBlackness');
StrCopy (@strInfo[1], 'Blackness Screen Saver'#10#10+
'Screen Saver module for'#10#10+
'95 Lights Go Down');
{$else}
StrCopy (@strTitle[1], 'zBlackness');
StrCopy (@strInfo[1], 'Blackness Bildschirmschoner'#10#10+
'Bildschirmschonermodul fⁿr'#10#10+
'95 Lichter gehen aus');
{$endif}
StrCopy (@strHelpFile[1], HELPFILE);
StrCopy (@strHelpKey[1], HELPKEY);
end;
ScrInfo := TRUE;
end;
{ display information about screen saver }
{$ifdef INTERNAL}
Function ScrAbout (hwndParent: HWND): bool; stdcall;
{$else}
Function ScrAbout (hwndParent: HWND): bool; stdcall; export;
{$endif}
begin
ScrAbout := TRUE;
LgdAboutBox (hwndParent, 0,
'Blackness',
'⌐ 1992-97 Thomas H÷vel Software'#10+
'Saturnstr. 45, 53842 Troisdorf, Germany'#10+
'All Rights reserved!',
{$ifdef SHARE}
FALSE,
{$else}
TRUE,
{$endif}
3);
{ MessageBox (hwndParent, 'Hello, World!', 'About', mb_ok);}
end;
{ these functions are called to execute the screen saver }
{ init screen saver - should save pointer to structure }
{$ifdef INTERNAL}
Function ScrInit (var mdModuleData: TModuleData): bool; stdcall;
{$else}
Function ScrInit (var mdModuleData: TModuleData): bool; stdcall; export;
{$endif}
{var dc: hdc;}
begin
Randomize;
with mdModuleData.pms^ do
begin
fSupportsIdleFunction := TRUE;
lCallDelay := 1;
lTimerDelay := 100; { max. speed }
{pss^.iBPP}
{ dc := GetDC (hwndSaver);
ReleaseDC (hwndSaver, dc);}
end;
ScrInit := TRUE;
end;
{$ifdef INTERNAL}
Procedure ScrDone (var mdModuleData: TModuleData); stdcall;
{$else}
Procedure ScrDone (var mdModuleData: TModuleData); stdcall; export;
{$endif}
begin
end;
{$ifdef INTERNAL}
Procedure ScrIdle (var mdModuleData: TModuleData); stdcall;
{$else}
Procedure ScrIdle (var mdModuleData: TModuleData); stdcall; export;
{$endif}
{ called at maximum rate if requested by saver }
var dc: hdc;
{$ifdef COL256}
hpalOld: HPalette;
{$endif}
x, y: integer;
begin
with mdModuleData.pms^ do
begin
dc := GetDC (hwndSaver);
{$ifdef COL256}
if pss^.iBPP >= 8 then
begin
hpalOld := SelectPalette (dc, pss^.hpalModule, FALSE);
RealizePalette (dc);
end;
{$endif}
x := random (cxScreen);
y := random (cyScreen);
(* SetPixel (dc, x-1, y, RGB (192, 0, 0));
SetPixel (dc, x+1, y, RGB (192, 0, 0));
SetPixel (dc, x, y-1, RGB (192, 0, 0));
SetPixel (dc, x, y+1, RGB (192, 0, 0));
SetPixel (dc, x, y, RGB (255, 0, 0));*)
SetPixel (dc, x-1, y, RGB (0, 0, 0));
SetPixel (dc, x+1, y, RGB (0, 0, 0));
SetPixel (dc, x, y-1, RGB (0, 0, 0));
SetPixel (dc, x, y+1, RGB (0, 0, 0));
SetPixel (dc, x, y, RGB (0, 0, 0));
{$ifdef COL256}
if pss^.iBPP >= 8 then
begin
SelectPalette (dc, hpalOld, FALSE);
end;
{$endif}
ReleaseDC (hwndSaver, dc);
end;
end;
{$ifdef INTERNAL}
Procedure ScrTimer (var mdModuleData: TModuleData); stdcall;
{$else}
Procedure ScrTimer (var mdModuleData: TModuleData); stdcall; export;
{$endif}
{ called by timer with selected interval }
var dc: hdc;
{$ifdef COL256}
hpalOld: HPalette;
{$endif}
x, y: integer;
begin
with mdModuleData.pms^ do
begin
dc := GetDC (hwndSaver);
{$ifdef COL256}
if pss^.iBPP >= 8 then
begin
hpalOld := SelectPalette (dc, pss^.hpalModule, FALSE);
RealizePalette (dc);
end;
{$endif}
x := random (cxScreen);
y := random (cyScreen);
SetPixel (dc, x-1, y, RGB (192, 192, 192));
SetPixel (dc, x+1, y, RGB (192, 192, 192));
SetPixel (dc, x, y-1, RGB (192, 192, 192));
SetPixel (dc, x, y+1, RGB (192, 192, 192));
SetPixel (dc, x, y, RGB (255, 255, 255));
{$ifdef COL256}
if pss^.iBPP >= 8 then
begin
SelectPalette (dc, hpalOld, FALSE);
end;
{$endif}
ReleaseDC (hwndSaver, dc);
end;
end;
{ display configuration dialog }
{$ifdef INTERNAL}
Function ScrConfig (var mdModuleData: TModuleData; hwndParent: HWND): integer; stdcall;
{$else}
Function ScrConfig (var mdModuleData: TModuleData; hwndParent: HWND): integer; stdcall; export;
{$endif}
begin
ScrConfig := 0;
{$ifdef ENGLISH}
MessageBox (hwndParent, 'No options available!', 'Blackness', mb_ok);
{$else}
MessageBox (hwndParent, 'Keine Optionen verfⁿgbar!', 'Blackness', mb_ok);
{$endif}
end;
{$ifndef DEBUG}
{$ifndef INTERNAL}
exports
ScrInfo index 11,
ScrAbout index 12,
ScrInit index 13,
ScrDone index 14,
ScrIdle index 15,
ScrTimer index 16,
ScrConfig index 17;
{$endif}
{$endif}
begin { library }
{$ifdef DEBUG}
DebugMain (@ScrInfo, @ScrAbout, @ScrInit, @ScrDone, @ScrIdle, @ScrTimer, @ScrConfig);
{$endif}
end.