6 |
kaklik |
1 |
// ******************************************************************************
|
|
|
2 |
// This source has been created by Roman Schulz, 2002.
|
|
|
3 |
// Visit my web-site at http://gds.oceany.cz for more info
|
|
|
4 |
// ******************************************************************************
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
unit Downloader;
|
|
|
8 |
|
|
|
9 |
interface
|
|
|
10 |
|
|
|
11 |
uses
|
|
|
12 |
Windows, ShellAPI, Messages, SysUtils, Graphics, Forms, Dialogs, Classes,
|
|
|
13 |
StdCtrls, isp3, Menus, INIFiles, OleCtrls, Controls, FileCtrl, Registry,
|
|
|
14 |
ComObj, ActiveX, ShlObj, ComCtrls, ExtCtrls, Gauges;
|
|
|
15 |
|
|
|
16 |
const
|
|
|
17 |
WM_TRAYAPPNOTIFY = WM_USER; // vlastní identifikátor zprávy
|
|
|
18 |
|
|
|
19 |
type
|
|
|
20 |
TForm1 = class(TForm)
|
|
|
21 |
Edit1: TEdit;
|
|
|
22 |
ListBox1: TListBox;
|
|
|
23 |
Button1: TButton;
|
|
|
24 |
Button2: TButton;
|
|
|
25 |
Label1: TLabel;
|
|
|
26 |
MainMenu1: TMainMenu;
|
|
|
27 |
File1: TMenuItem;
|
|
|
28 |
Exit1: TMenuItem;
|
|
|
29 |
Help1: TMenuItem;
|
|
|
30 |
About1: TMenuItem;
|
|
|
31 |
SearchforHelpOn1: TMenuItem;
|
|
|
32 |
Reset1: TMenuItem;
|
|
|
33 |
AutoSave1: TMenuItem;
|
|
|
34 |
Zobrazen1: TMenuItem;
|
|
|
35 |
dn1: TMenuItem;
|
|
|
36 |
PopupMenu1: TPopupMenu;
|
|
|
37 |
Konec1: TMenuItem;
|
|
|
38 |
Zobrazit1: TMenuItem;
|
|
|
39 |
Trayicon1: TMenuItem;
|
|
|
40 |
Skrtformul1: TMenuItem;
|
|
|
41 |
Skrtformul2: TMenuItem;
|
|
|
42 |
Download1: TMenuItem;
|
|
|
43 |
Hledatnainternetu1: TMenuItem;
|
|
|
44 |
Button3: TButton;
|
|
|
45 |
PidatdoSTARTmenu1: TMenuItem;
|
|
|
46 |
Pidatnaplochu1: TMenuItem;
|
|
|
47 |
StatusBar1: TStatusBar;
|
|
|
48 |
Timer1: TTimer;
|
|
|
49 |
Gauge1: TGauge;
|
|
|
50 |
Vceoaplikaci1: TMenuItem;
|
|
|
51 |
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
|
|
|
52 |
Shift: TShiftState);
|
|
|
53 |
procedure Button2Click(Sender: TObject);
|
|
|
54 |
procedure HTTP1StateChanged(Sender: TObject; State: Smallint);
|
|
|
55 |
procedure Button1Click(Sender: TObject);
|
|
|
56 |
procedure ListBox1Click(Sender: TObject);
|
|
|
57 |
procedure AutoSave1Click(Sender: TObject);
|
|
|
58 |
procedure Exit1Click(Sender: TObject);
|
|
|
59 |
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
60 |
procedure SearchforHelpOn1Click(Sender: TObject);
|
|
|
61 |
procedure dn1Click(Sender: TObject);
|
|
|
62 |
procedure ZkratkyVypnuty;
|
|
|
63 |
procedure ZkratkyZapnuty;
|
|
|
64 |
procedure FormDestroy(Sender: TObject);
|
|
|
65 |
procedure Trayicon1Click(Sender: TObject);
|
|
|
66 |
procedure Zobrazit1Click(Sender: TObject);
|
|
|
67 |
procedure Skrtformul1Click(Sender: TObject);
|
|
|
68 |
procedure About1Click(Sender: TObject);
|
|
|
69 |
procedure CreateLink(WorkingDirectory,FileName,Arguments: String;TargetLinkFile: WideString;
|
|
|
70 |
Description,IconPath: String;IconIdex: Integer);
|
|
|
71 |
procedure AddToStart(Sender: TObject);
|
|
|
72 |
procedure AddToDesktop(Sender: TObject);
|
|
|
73 |
procedure Timer1Timer(Sender: TObject);
|
|
|
74 |
procedure HTTP1Error(Sender: TObject; Number: Smallint;
|
|
|
75 |
var Description: WideString; Scode: Integer; const Source,
|
|
|
76 |
HelpFile: WideString; HelpContext: Integer;
|
|
|
77 |
var CancelDisplay: WordBool);
|
|
|
78 |
private
|
|
|
79 |
Download_file, Zobrazeni: String;
|
|
|
80 |
Busy: boolean;
|
|
|
81 |
Settings: TINIFile;
|
|
|
82 |
NotifyIconData: TNotifyIconData; // data pro ikonu
|
|
|
83 |
Time: Dword;
|
|
|
84 |
Sekund, BytesTransferredLast: Integer;
|
|
|
85 |
procedure WMTrayAppNotify(var M: TMessage); message WM_TRAYAPPNOTIFY;
|
|
|
86 |
public
|
|
|
87 |
Destination: String;
|
|
|
88 |
protected
|
|
|
89 |
procedure WMHotKey(var Message: TMessage); message WM_HOTKEY;
|
|
|
90 |
end;
|
|
|
91 |
|
|
|
92 |
var
|
|
|
93 |
Form1: TForm1;
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
implementation
|
|
|
97 |
|
|
|
98 |
uses SaveDialog;
|
|
|
99 |
|
|
|
100 |
{$R *.DFM}
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
// ******************************************************************************
|
|
|
106 |
// Rutiny download manageru
|
|
|
107 |
// ******************************************************************************
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
//Reset
|
|
|
111 |
procedure TForm1.Button1Click(Sender: TObject);
|
|
|
112 |
var i, dummy: integer;
|
|
|
113 |
//param: DWord;
|
|
|
114 |
begin
|
|
|
115 |
//Monost vypnutí vekerých klávesových zkratek ve Win9x
|
|
|
116 |
//Param := 0;
|
|
|
117 |
//SystemParametersInfo(SPI_SETFASTTASKSWITCH, UINT(not false), @Param, 0);
|
|
|
118 |
// ALT+TAB, CTRL+ESC
|
|
|
119 |
//SystemParametersInfo(SPI_SCREENSAVERRUNNING, UINT(not false), @Param, 0);
|
|
|
120 |
// CTRL+ALT+DEL
|
|
|
121 |
|
|
|
122 |
//Vlozi zacatek internetove adresy
|
|
|
123 |
Edit1.text := 'http://';
|
|
|
124 |
|
|
|
125 |
//Stornujeme stahování
|
|
|
126 |
if HTTP1.Busy then HTTP1.Cancel;
|
|
|
127 |
Busy := false;
|
|
|
128 |
Label1.caption := 'Pøipraven na stahování';
|
|
|
129 |
|
|
|
130 |
//Skrytí task baru
|
|
|
131 |
ShowWindow(Application.Handle, SW_HIDE); //schová aplikaci z taskbaru
|
|
|
132 |
|
|
|
133 |
//Nacteni hodnot z konfiguracniho souboru
|
|
|
134 |
Settings:=TIniFile.Create((ExtractFilePath(Application.ExeName))+'settings.cfg');
|
|
|
135 |
|
|
|
136 |
//Nacteni cile ukládání
|
|
|
137 |
Destination := Settings.ReadString('Options','Destination',ExtractFilePath(Application.ExeName));
|
|
|
138 |
|
|
|
139 |
//Kde se ma zobrazit ikonka
|
|
|
140 |
Zobrazeni := Settings.ReadString('Options','Zobrazeni','TRAY_ICON');
|
|
|
141 |
if Zobrazeni = 'TRAY_ICON' then Trayicon1Click(Sender)
|
|
|
142 |
else if Zobrazeni = 'NONE' then dn1Click(Sender)
|
|
|
143 |
else Trayicon1Click(Sender);
|
|
|
144 |
|
|
|
145 |
//Vymazani celeho mema
|
|
|
146 |
for i:=1 to ListBox1.Items.Count do ListBox1.Items.Delete(0);
|
|
|
147 |
end;
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
//Stahuj
|
|
|
151 |
procedure TForm1.Button2Click(Sender: TObject);
|
|
|
152 |
var i:integer;
|
|
|
153 |
FileName:string;
|
|
|
154 |
begin
|
|
|
155 |
if (ListBox1.Items.Count <> 0) then
|
|
|
156 |
if (Busy = false) then begin
|
|
|
157 |
Download_file := ListBox1.Items.Strings[0];
|
|
|
158 |
|
|
|
159 |
//Ziskani jmena souboru z internetove adresy
|
|
|
160 |
for i:=0 to Length(Download_file) do
|
|
|
161 |
if (Download_file[i]<>'/') then FileName := FileName + Download_file[i]
|
|
|
162 |
else FileName:='';
|
|
|
163 |
|
|
|
164 |
//Stavový label
|
|
|
165 |
Label1.caption:='Stahování souboru: '+Download_file;
|
|
|
166 |
Time := GetTickCount;
|
|
|
167 |
HTTP1.GetDoc(Download_file, '', Destination + FileName);
|
|
|
168 |
Busy := true;
|
|
|
169 |
end;
|
|
|
170 |
end;
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
//Neco se stalo...
|
|
|
174 |
procedure TForm1.HTTP1StateChanged(Sender: TObject; State: Smallint);
|
|
|
175 |
begin
|
|
|
176 |
if (State=6) then begin
|
|
|
177 |
Label1.Caption:='Stahování souboru '+Download_file+' dokonèeno';
|
|
|
178 |
ListBox1.Items.Delete(0);
|
|
|
179 |
Busy := false;
|
|
|
180 |
|
|
|
181 |
Gauge1.Progress := 0;
|
|
|
182 |
StatusBar1.Panels[0].Text := 'Staeno celkem '+inttostr(round(HTTP1.DocOutput.BytesTransferred/1024))+' kB, '+inttostr(8*round(HTTP1.DocOutput.BytesTransferred/(GetTickCount-Time)))+' kbps';
|
|
|
183 |
|
|
|
184 |
ShowMessage('Poadavek splnìn');
|
|
|
185 |
end;
|
|
|
186 |
end;
|
|
|
187 |
|
|
|
188 |
//Prace s listboxem
|
|
|
189 |
procedure TForm1.ListBox1Click(Sender: TObject);
|
|
|
190 |
var i: integer;
|
|
|
191 |
begin
|
|
|
192 |
for i := 0 to (ListBox1.Items.Count - 1) do begin
|
|
|
193 |
if ListBox1.Selected[i] then
|
|
|
194 |
begin
|
|
|
195 |
Edit1.Text := ListBox1.Items.Strings[i];
|
|
|
196 |
ListBox1.Items.Delete(i);
|
|
|
197 |
end;
|
|
|
198 |
end;
|
|
|
199 |
end;
|
|
|
200 |
|
|
|
201 |
//Po stisknuti enteru se data prenesou do listboxu
|
|
|
202 |
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
|
|
|
203 |
Shift: TShiftState);
|
|
|
204 |
begin
|
|
|
205 |
if (key=13) then begin
|
|
|
206 |
ListBox1.Items.Add(Edit1.Text);
|
|
|
207 |
Edit1.Text:='http://';
|
|
|
208 |
end;
|
|
|
209 |
end;
|
|
|
210 |
|
|
|
211 |
//Zobrazeni formulare s cestou pro ulozeni souboru
|
|
|
212 |
procedure TForm1.AutoSave1Click(Sender: TObject);
|
|
|
213 |
begin
|
|
|
214 |
Form1.enabled:=false;
|
|
|
215 |
Form2.visible:=true;
|
|
|
216 |
end;
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
procedure TForm1.Timer1Timer(Sender: TObject);
|
|
|
221 |
var BytesTransferred: integer;
|
|
|
222 |
begin
|
|
|
223 |
if busy then begin
|
|
|
224 |
|
|
|
225 |
//Updatování pozice ukazatele
|
|
|
226 |
BytesTransferred := HTTP1.DocOutput.BytesTransferred;
|
|
|
227 |
|
|
|
228 |
Gauge1.MaxValue := HTTP1.DocOutput.BytesTotal;
|
|
|
229 |
Gauge1.Progress := BytesTransferred;
|
|
|
230 |
|
|
|
231 |
//Pøenosová rychlost B/s
|
|
|
232 |
StatusBar1.Panels[2].text := inttostr(round(((BytesTransferred - BytesTransferredLast)/(Timer1.interval/1000))))+' B/s';
|
|
|
233 |
BytesTransferredLast := BytesTransferred;
|
|
|
234 |
|
|
|
235 |
//Pocet prenesenych bytu, procento stahování a pøenosová rychlost v kbps
|
|
|
236 |
if (HTTP1.DocOutput.BytesTotal <> 0)then
|
|
|
237 |
StatusBar1.Panels[0].text := inttostr(round(BytesTransferred/1024))+' kB z '
|
|
|
238 |
+inttostr(round(HTTP1.DocOutput.BytesTotal/1024))+' kB = '
|
|
|
239 |
+inttostr(round(100*(BytesTransferred/1024)/(HTTP1.DocOutput.BytesTotal/1024)))+' % ='
|
|
|
240 |
+inttostr(8*round(BytesTransferred/(GetTickCount-Time)))+' kbps';
|
|
|
241 |
|
|
|
242 |
//doba stahování
|
|
|
243 |
Sekund := round((GetTickCount-Time)/1000);
|
|
|
244 |
StatusBar1.Panels[1].text := inttostr(trunc(sekund/3600))+'hodin, '+inttostr(trunc(sekund/60-60*trunc(sekund/3600)))+'minut, '+inttostr(trunc(sekund)-60*(trunc(sekund/60-60*trunc(sekund/3600))))+'sekund';
|
|
|
245 |
end;
|
|
|
246 |
end;
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
procedure TForm1.HTTP1Error(Sender: TObject; Number: Smallint;
|
|
|
251 |
var Description: WideString; Scode: Integer; const Source,
|
|
|
252 |
HelpFile: WideString; HelpContext: Integer; var CancelDisplay: WordBool);
|
|
|
253 |
begin
|
|
|
254 |
ShowMessage('Vyskytla se chyba: '+Description);
|
|
|
255 |
end;
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
// ******************************************************************************
|
|
|
262 |
// Procedury pro zobrazení a skrytí ze system tray
|
|
|
263 |
// ******************************************************************************
|
|
|
264 |
//Zobrazení v tray icon
|
|
|
265 |
procedure TForm1.Trayicon1Click(Sender: TObject);
|
|
|
266 |
begin
|
|
|
267 |
//Deaktivace klavesovych zkratek
|
|
|
268 |
ZkratkyZapnuty;
|
|
|
269 |
// nastavíme jednotlivé poloky
|
|
|
270 |
with NotifyIconData do
|
|
|
271 |
begin
|
|
|
272 |
cbSize := SizeOf(NotifyIconData);
|
|
|
273 |
Wnd := Handle;
|
|
|
274 |
uID := 0;
|
|
|
275 |
uFlags := NIF_ICON + NIF_MESSAGE + NIF_TIP;
|
|
|
276 |
uCallbackMessage := WM_TRAYAPPNOTIFY;
|
|
|
277 |
hIcon := Application.Icon.Handle;
|
|
|
278 |
szTip:='Pokusná tray aplikace';
|
|
|
279 |
end;
|
|
|
280 |
// pøidáme ikonu na litu
|
|
|
281 |
Shell_NotifyIcon(NIM_ADD, @NotifyIconData);
|
|
|
282 |
Zobrazeni := 'TRAY_ICON';
|
|
|
283 |
end;
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
//Nezobrazovat nikde
|
|
|
287 |
procedure TForm1.dn1Click(Sender: TObject);
|
|
|
288 |
begin
|
|
|
289 |
//Oznameni o aktivaci klavesovych zkratek
|
|
|
290 |
ShowMessage('Program lze aktivovat klávesovou zkratkou CTRL+F7');
|
|
|
291 |
ZkratkyZapnuty;
|
|
|
292 |
// odebereme ikonu z lity
|
|
|
293 |
Shell_NotifyIcon(NIM_DELETE, @NotifyIconData);
|
|
|
294 |
Zobrazeni := 'NONE';
|
|
|
295 |
end;
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
//Zobrazit formuláø
|
|
|
299 |
procedure TForm1.Zobrazit1Click(Sender: TObject);
|
|
|
300 |
begin
|
|
|
301 |
Form1.visible := true;
|
|
|
302 |
end;
|
|
|
303 |
|
|
|
304 |
//Skrýt formuláø
|
|
|
305 |
procedure TForm1.Skrtformul1Click(Sender: TObject);
|
|
|
306 |
begin
|
|
|
307 |
Form1.visible := false;
|
|
|
308 |
end;
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
//Události nad System Tray ikonou
|
|
|
313 |
procedure TForm1.WMTrayAppNotify(var M: TMessage);
|
|
|
314 |
var
|
|
|
315 |
P: TPoint;
|
|
|
316 |
begin
|
|
|
317 |
with M do
|
|
|
318 |
case lParam of
|
|
|
319 |
WM_LBUTTONUP: // levé tlaèítko
|
|
|
320 |
Application.MessageBox('Na ikonì bylo kliknuto!', 'Tray', 0);
|
|
|
321 |
WM_RBUTTONUP: // pravé tlaèítko
|
|
|
322 |
begin
|
|
|
323 |
GetCursorPos(P); // získáme souøadnice kurzoru
|
|
|
324 |
PopupMenu1.Popup(P.X, P.Y); // a zobrazíme na nich menu
|
|
|
325 |
end;
|
|
|
326 |
end;
|
|
|
327 |
end;
|
|
|
328 |
|
|
|
329 |
|
|
|
330 |
// ******************************************************************************
|
|
|
331 |
// Nastavení klávesových zkratek
|
|
|
332 |
// ******************************************************************************
|
|
|
333 |
procedure TForm1.WMHotKey(var Message: TMessage);
|
|
|
334 |
begin
|
|
|
335 |
Form1.visible := true;
|
|
|
336 |
end;
|
|
|
337 |
|
|
|
338 |
|
|
|
339 |
procedure TForm1.ZkratkyVypnuty();
|
|
|
340 |
begin
|
|
|
341 |
UnregisterHotKey(Handle,131632);
|
|
|
342 |
end;
|
|
|
343 |
|
|
|
344 |
|
|
|
345 |
procedure TForm1.ZkratkyZapnuty();
|
|
|
346 |
begin
|
|
|
347 |
RegisterHotKey(Handle,131632,MOD_CONTROL{Control,Alt,Shift,Start},VK_F7{èíslo klávesy});
|
|
|
348 |
end;
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
// ******************************************************************************
|
|
|
352 |
// Pøidání programu do START menu a na plochu
|
|
|
353 |
// ******************************************************************************
|
|
|
354 |
procedure TForm1.CreateLink(WorkingDirectory,FileName,Arguments: String;TargetLinkFile: WideString;
|
|
|
355 |
Description,IconPath: String;IconIdex: Integer);
|
|
|
356 |
var
|
|
|
357 |
MyObject : IUnknown;
|
|
|
358 |
MySLink : IShellLink;
|
|
|
359 |
MyPFile : IPersistFile;
|
|
|
360 |
begin
|
|
|
361 |
MyObject := CreateComObject(CLSID_ShellLink);
|
|
|
362 |
MySLink := MyObject as IShellLink;
|
|
|
363 |
MyPFile := MyObject as IPersistFile;
|
|
|
364 |
with MySLink do
|
|
|
365 |
begin
|
|
|
366 |
SetArguments (PChar(Arguments ));
|
|
|
367 |
SetPath (PChar(FileName));
|
|
|
368 |
SetWorkingDirectory(PChar(WorkingDirectory));
|
|
|
369 |
SetDescription (PChar(Description));
|
|
|
370 |
SetIconLocation (PChar(IconPath), IconIdex);
|
|
|
371 |
end;
|
|
|
372 |
|
|
|
373 |
If Not DirectoryExists(ExtractFileDir(TargetLinkFile)) then CreateDir(ExtractFileDir(TargetLinkFile));
|
|
|
374 |
MyPFile.Save(PWChar(TargetLinkFile),False);
|
|
|
375 |
MySLink := Nil;
|
|
|
376 |
MyPFile := Nil;
|
|
|
377 |
MyObject := Nil;
|
|
|
378 |
end;
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
procedure TForm1.AddToStart(Sender: TObject);
|
|
|
382 |
var MyReg: TRegIniFile;
|
|
|
383 |
Directory: WideString;
|
|
|
384 |
begin
|
|
|
385 |
MyReg := TRegIniFile.Create('Software\MicroSoft\Windows\CurrentVersion\Explorer');
|
|
|
386 |
|
|
|
387 |
Directory := MyReg.ReadString('Shell Folders','Start Menu','')+
|
|
|
388 |
'\Programy\Download Manager\';
|
|
|
389 |
|
|
|
390 |
//Zástupce na program
|
|
|
391 |
CreateLink(ExtractFilePath(Application.ExeName),
|
|
|
392 |
Application.ExeName,
|
|
|
393 |
'',
|
|
|
394 |
Directory+'Download Manager v0.0.1.1.lnk',
|
|
|
395 |
'Download Manager v0.0.1.1',
|
|
|
396 |
Application.ExeName,
|
|
|
397 |
0);
|
|
|
398 |
|
|
|
399 |
//Zástupce na homepage GAME Developer Serveru
|
|
|
400 |
CreateLink(ExtractFilePath(Application.ExeName),
|
|
|
401 |
ExtractFilePath(Application.ExeName)+'Homepage.url',
|
|
|
402 |
'',
|
|
|
403 |
Directory+'GAME Developer Server.lnk',
|
|
|
404 |
'Server o programování v DirectX a OpenGL hlavnì v Delphi a C/C++.',
|
|
|
405 |
'',
|
|
|
406 |
0);
|
|
|
407 |
|
|
|
408 |
//Zástupce na clanek o Download Manageru
|
|
|
409 |
CreateLink(ExtractFilePath(Application.ExeName),
|
|
|
410 |
ExtractFilePath(Application.ExeName)+'Clanek.url',
|
|
|
411 |
'',
|
|
|
412 |
Directory+'Zdrojové kódy a popis Download Manageru.lnk',
|
|
|
413 |
'Stáhnìte si zdarma zdrojové kódy a popis Download Manageru',
|
|
|
414 |
'',
|
|
|
415 |
0);
|
|
|
416 |
|
|
|
417 |
//Zástupce na diskusi o Download Manageru
|
|
|
418 |
CreateLink(ExtractFilePath(Application.ExeName),
|
|
|
419 |
ExtractFilePath(Application.ExeName)+'Diskuse.url',
|
|
|
420 |
'',
|
|
|
421 |
Directory+'Diskuse o Download Manageru.lnk',
|
|
|
422 |
'Zajímá vás, co si o tomto programu myslí i jiní uivatelé?',
|
|
|
423 |
'',
|
|
|
424 |
0);
|
|
|
425 |
|
|
|
426 |
MyReg.Free;
|
|
|
427 |
end;
|
|
|
428 |
|
|
|
429 |
procedure TForm1.AddToDesktop(Sender: TObject);
|
|
|
430 |
var MyReg: TRegIniFile;
|
|
|
431 |
Directory: WideString;
|
|
|
432 |
begin
|
|
|
433 |
MyReg := TRegIniFile.Create('Software\MicroSoft\Windows\CurrentVersion\Explorer');
|
|
|
434 |
|
|
|
435 |
Directory := MyReg.ReadString('Shell Folders','Desktop','');
|
|
|
436 |
|
|
|
437 |
CreateLink(ExtractFilePath(Application.ExeName),
|
|
|
438 |
Application.ExeName,
|
|
|
439 |
'',
|
|
|
440 |
Directory+'\Download Manager.lnk',
|
|
|
441 |
'Download Manager',
|
|
|
442 |
Application.ExeName,
|
|
|
443 |
0);
|
|
|
444 |
|
|
|
445 |
MyReg.Free;
|
|
|
446 |
end;
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
// ******************************************************************************
|
|
|
450 |
// Ukonèení programu
|
|
|
451 |
// ******************************************************************************
|
|
|
452 |
procedure TForm1.FormDestroy(Sender: TObject);
|
|
|
453 |
begin
|
|
|
454 |
// odebereme ikonu z lity
|
|
|
455 |
Shell_NotifyIcon(NIM_DELETE, @NotifyIconData);
|
|
|
456 |
end;
|
|
|
457 |
|
|
|
458 |
procedure TForm1.Exit1Click(Sender: TObject);
|
|
|
459 |
begin
|
|
|
460 |
Close;
|
|
|
461 |
end;
|
|
|
462 |
|
|
|
463 |
|
|
|
464 |
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
465 |
begin
|
|
|
466 |
Settings.WriteString('Options','Destination',Destination);
|
|
|
467 |
Settings.WriteString('Options','Zobrazeni',Zobrazeni);
|
|
|
468 |
Settings.Free;
|
|
|
469 |
end;
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
|
474 |
//Odkaz na moje internetove stranky
|
|
|
475 |
procedure TForm1.SearchforHelpOn1Click(Sender: TObject);
|
|
|
476 |
begin
|
|
|
477 |
if (ShellExecute(0,'open',Pchar('http://gds.oceany.cz/index.php'),nil,nil,Sw_ShowNormal)<35)
|
|
|
478 |
then ShowMessage('Dolo k chybì k pøipojení na internetový server');
|
|
|
479 |
end;
|
|
|
480 |
|
|
|
481 |
procedure TForm1.About1Click(Sender: TObject);
|
|
|
482 |
begin
|
|
|
483 |
ShowMessage('Download Manager v. 0.0.1.1'+chr(13)+'Copyright: Roman Schulz'+chr(13)+'Tento program je freeware'+chr(13)+chr(13)+'Popis a zdrojáky: GAME Developer Server'+chr(13)+'http://gds.oceany.cz');
|
|
|
484 |
end;
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
end.
|
|
|
490 |
// ******************************************************************************
|
|
|
491 |
// This source has been created by Roman Schulz, 2002.
|
|
|
492 |
// Visit my web-site at http://gds.oceany.cz for more info
|
|
|
493 |
// ******************************************************************************
|