-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnit3.pas
174 lines (147 loc) · 6.21 KB
/
Unit3.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
unit Unit3;
interface
uses
Vcl.Forms,
SysUtils,
Vcl.Controls,
Vcl.Graphics,
Vcl.ExtCtrls,
Vcl.Dialogs,
Winapi.messages,
System.Classes,
unit1,
Winapi.windows;
type
TMyControl = class(TControl)
procedure DDetect();
procedure CheckOk();
function GetLocaleSS():string;
end;
var
MyControl1: TMyControl;
MForms: array[0..30] of TForm1;
previewmode:boolean = false;
const cfgfile:string = '\unswfscr.cfg';
implementation
procedure TMyControl.CheckOk;
var configsl:TStringList; cconf:TextFile; usrpath:string; I:integer; TargetHandle:hwnd; //colorst:string;
begin
configsl:=TStringList.Create;
//ShowMessage(GetEnvironmentVariable('USERPROFILE'));
usrpath:=GetEnvironmentVariable('USERPROFILE');
if FileExists(usrpath+cfgfile) then
begin
configsl.LoadFromFile(usrpath+cfgfile);
//ShowMessage(configsl.Strings[1]);
if configsl.Strings[0]='1' then form1.ShockwaveFlash1.BGColor:=configsl.Strings[1];
if FileExists(configsl.Strings[2])
then
begin
if previewmode then
begin
Application.CreateForm(TForm1, Form1);
TargetHandle:=StrToInt(ParamStr(2));
Application.MainFormOnTaskbar := False;
Form1.ParentWindow:=TargetHandle;
Form1.ShockwaveFlash1.Movie:=configsl.Strings[2];
Form1.ShockwaveFlash1.Play;
Form1.Show;
Form1.WindowState:=wsMaximized;
Form1.ShockwaveFlash1.Align:=alCustom;
Form1.ShockwaveFlash1.Left:= -(strtoint(configsl.Strings[4]) div 2);
Form1.ShockwaveFlash1.Top:= -(strtoint(configsl.Strings[5]) div 2);
Form1.ShockwaveFlash1.Width:=Form1.Width+strtoint(configsl.Strings[4]);
Form1.ShockwaveFlash1.Height:= Form1.Height+strtoint(configsl.Strings[5]);
end else begin
if configsl.Strings[6]='0' then
begin
Application.CreateForm(TForm1, Form1);
Form1.ShockwaveFlash1.Movie:=configsl.Strings[2];
Form1.ShockwaveFlash1.Play;
Form1.Show;
Form1.MakeFullyVisible(Screen.Monitors[0]);
Form1.WindowState:=wsMaximized;
Form1.ShockwaveFlash1.Align:=alCustom;
Form1.ShockwaveFlash1.Left:= -(strtoint(configsl.Strings[4]) div 2);
Form1.ShockwaveFlash1.Top:= -(strtoint(configsl.Strings[5]) div 2);
Form1.ShockwaveFlash1.Width:=Form1.Width+strtoint(configsl.Strings[4]);
Form1.ShockwaveFlash1.Height:=Form1.Height+strtoint(configsl.Strings[5]);
//Form1.Color:=StringToColor();
end else begin
for I := 1 to Screen.MonitorCount do
begin
Application.CreateForm(TForm1, MForms[i]);
MForms[i].ShockwaveFlash1.Movie:=configsl.Strings[2];
MForms[i].ShockwaveFlash1.Play;
MForms[i].Show;
MForms[i].MakeFullyVisible(Screen.Monitors[i-1]);
MForms[i].WindowState:=wsMaximized;
MForms[i].ShockwaveFlash1.Align:=alCustom;
MForms[i].ShockwaveFlash1.Left:= -(strtoint(configsl.Strings[4]) div 2);
MForms[i].ShockwaveFlash1.Top:= -(strtoint(configsl.Strings[5]) div 2);
MForms[i].ShockwaveFlash1.Width:=MForms[i].Width+strtoint(configsl.Strings[4]);
MForms[i].ShockwaveFlash1.Height:= MForms[i].Height+strtoint(configsl.Strings[5]);
end;
end;
{
Application.CreateForm(TForm1, Form1);
Application.MainFormOnTaskbar := False;
form1.Show;
form1.ShockwaveFlash1.Movie:=configsl.Strings[2];
form1.ShockwaveFlash1.Play;
form1.ShockwaveFlash1.Align:=alCustom;
form1.ShockwaveFlash1.Left:= -(strtoint(configsl.Strings[4]) div 2);
form1.ShockwaveFlash1.Top:= -(strtoint(configsl.Strings[5]) div 2);
form1.ShockwaveFlash1.Width:=Screen.Width+strtoint(configsl.Strings[4]);
form1.ShockwaveFlash1.Height:=Screen.Height+strtoint(configsl.Strings[5]);}
end;
end
else
begin{
if GetLocaleSS='Russian' then MessageDlg('Âûáðàííûé SWF-ôàéë íå ñóùåñòâóåò!'+#13+'Ïîæàëóéñòà, îòêðîéòå íàñòðîéêè çàñòàâêè, è ïðîâåðüòå ïóòü ê íåìó!',mtError,[mbOK],0,mbOK)
else MessageDlg('Selected SWF doesn''t exists!'+#13+'Pease, go to ScreenSaver config and check its path!',mtError,[mbOK],0,mbOK);
Application.Terminate;}
MessageDlg('Selected SWF doesn''t exists!'+#13+'Pease, go to ScreenSaver config and check its path!!'+#13+
'---------------------------------------------------------------------------'+#13+
'Âûáðàííûé SWF-ôàéë íå ñóùåñòâóåò!'+#13+'Ïîæàëóéñòà, îòêðîéòå íàñòðîéêè çàñòàâêè, è ïðîâåðüòå ïóòü ê íåìó!'
,mtError,[mbOK],0,mbOK);
Application.Terminate;
end;
end else begin
AssignFile(cconf,usrpath+cfgfile);
Rewrite(cconf);
CloseFile(cconf);
configsl.Add('0');
configsl.Add('C1C1C1');
configsl.Add('<your_swf_ssaver.swf>');
configsl.Add('ENGMUI');
configsl.Add('0');
configsl.Add('0');
configsl.Add('0');
configsl.SaveToFile(usrpath+cfgfile);
MessageDlg('Ïîõîæå, ÷òî âûçàïóñòèëè çàñòàâêó â ïåðâûé ðàç...'+#13+'Ïðîãðàììà ñîçäàëà ïóñòîé ôàéë íàñòðîåê,'+#13+
'íî Âàì ñëåäóåò îòêðûòü Íàòðîéêè çàñòàâêè, è óêàçàòü ïóòü, ê âàøåìó SWF-ôàéëó'+#13+'Ïðîãðàììà áóäåò çàêðûòà!'+#13+
'-------------------------------------------------------------------------------------------'+#13+
'It seemed, like you started ScreenSaver first time...'+#13+'The app created default config file,'+#13+
'But you shoud open Screensaver Configuratrion, and set path to your SWF'+#13+'Application Closed!'
,mtWarning,[mbOK],0,mbOK);
Application.Terminate;
end;
//SystemParametersInfo(SPI_SCREENSAVERRUNNING,1,@Dummy,0);
//SetCapture(Self.Handle);
//Application.OnException:=CException;
end;
function TMyControl.GetLocaleSS():string;
var lbuf:pchar; bufmem:integer;
begin
bufmem:=GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SENGLANGUAGE, nil, 0);
GetMem(lbuf, bufmem);
GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SENGLANGUAGE, lbuf, bufmem);
Result:=lbuf;
end;
procedure TMyControl.DDetect();
begin
previewmode:=true;
CheckOk;
end;
end.