var
TNA_Icon: TIcon;
//Icon für den TNA
G_IP:
string;
//globale Variable für die IP
...
procedure TForm1.SetIcon(Loading, Ignoring, Stopped, Plugin:
boolean);
var
RS: TResourceStream;
sI:
string;
begin
if IsClosing = False
then
begin
IconReady := False;
try
if G_IP = '
0.0.0.0'#0
then
sI := '
IN'
else if G_IP = '
0.0.0.0'
then
sI := '
OF'
else
sI := '
ON';
{ Ladeanzeige }
if Loading
then
sI := sI + '
_LO';
{ Ignorieren/Stopped }
if Ignoring
then
sI := sI + '
_IG'
else if Stopped
then
sI := sI + '
_ST';
{ Plugin }
if Plugin
then
sI := sI + '
_PL';
{ Farbtiefe }
sI := sI + GetIconSufix;
{ TNA-Icon }
try
RS := TResourceStream.Create(0, sI, RT_RCDATA);
RS.Position := 0;
DestroyIcon(TNA_Icon.Handle);
TNA_Icon.LoadFromStream(RS);
DestroyIcon(IconData.hIcon);
IconData.hIcon := TNA_Icon.Handle;
finally
RS.Free;
end;
{ Statusanzeige }
try
RS := TResourceStream.Create(0, sI, RT_RCDATA);
RS.Position := 0;
DestroyIcon(Image1.Picture.Icon.Handle);
Image1.Picture.Icon.LoadFromStream(RS);
Image1.Repaint;
Edit3.Text := G_IP;
Label7.Caption := G_IT;
if G_IP = '
0.0.0.0'#0
then
begin
ToolButton11.Enabled := False;
Label2.Caption := '
undefined';
end
else if G_IP = '
0.0.0.0'
then
begin
ToolButton11.Enabled := False;
Label2.Caption := '
Offline';
end
else
begin
ToolButton11.Enabled := True;
Label2.Caption := '
Online';
end;
finally
RS.Free;
end;
{//Image1.Picture.Icon.ReleaseHandle;
DestroyIcon(Image1.Picture.Icon.Handle);
Image1.Picture.Icon.Assign(TNA_Icon);}
{ TNA-Text }
StrPLCopy(IconData.szTip, '
[' + Label2.Caption + '
]' + TNAbr + '
WAN-IP: '
+ Edit3.Text + TNAbr + '
LAN-IP: ' + Edit4.Text, 63);
if IsMinimized = True
then
Shell_NotifyIcon(NIM_MODIFY, @IconData);
finally
IconReady := True;
end;
end;
end;