Leser: 3
9 Einträge, 1 Seite |
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
#!perl
use Win32::Daemon;
use Win32::GUI;
my $id = "1";
$main = Win32::GUI::Window->new(-title => 'Backupi',
-left => 100,
-top => 100,
-width => 150,
-height => 100,
-name => 'Main',
-visible => 0
);
$icon = new Win32::GUI::Icon('server.ICO');
$ni = $main->AddNotifyIcon(-name => "systray",
-id => $id,
-icon => $icon,
-tip => "Backupi");
Win32::Daemon::StartService();
while (SERVICE_START_PENDING != Win32::Daemon::State())
{
sleep(1);
}
Win32::Daemon::State(SERVICE_RUNNING);
while (1)
{
open FOUT, ">>c:\\win32testserv.log";
print FOUT localtime() . "\n";
close FOUT;
sleep 3;
if (Win32::Daemon::State() == SERVICE_STOP_PENDING)
{
open FOUT, ">>c:\\win32testserv.log";
print FOUT "Jetzt ist aber Schluss\n";
close FOUT;
exit 0;
}
}
Win32::Daemon::StopService();
Win32::Daemon::State(SERVICE_STOPPED);
sub systray_RightClick
{
$systray_menu = new Win32::GUI::Menu( "SystrayMenu Functions" => "SystrayMenu",
"> Starte den Dienst" => "AmphetaDesk::OS::Windows::_OpenBrowser",
"> Stope den Dienst" => "AmphetaDesk::OS::Windows::_RefreshChannels",
"> Exit" => "SystrayExit"
);
my($x, $y) = Win32::GUI::GetCursorPos();
$main->TrackPopupMenu($systray_menu->{SystrayMenu}, $x, $y-50);
}
sub Main_Terminate { &exit_program; }
sub SystrayExit_Click { &exit_program; }
sub exit_program
{
Win32::GUI::NotifyIcon::Delete( $ni, -id => $id );
exit;
}
QuoteHier mein "TEST" Code:
9 Einträge, 1 Seite |