Schrift
[thread]8796[/thread]

Globales Tasten-Event abfangen (win) (Seite 3)

Leser: 1


<< |< 1 2 3 >| >> 21 Einträge, 3 Seiten
GoodFella
 2007-03-05 17:44
#74673 #74673
User since
2007-01-09
192 Artikel
BenutzerIn
[default_avatar]
Danke euch allen, übrigens hat nur $main->FullScreen(1); funktioniert, overrideredirect ging nicht so wie ich es wollte.

Hier jetzt mal die finale Version:

Code (perl): (dl )
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
#!/usr/local/bin/perl -w

use Tk;
use Win32::API;
use Tk::JPEG;
use Tk::StayOnTop;
use Win32::Sound;

my $boss_key = 0x04; #Middle Mousecursor
#my $boss_key = 0x1b; #Escape
my $exit_key =  0x5b; #Windows Key
my $title = 'IDEAL Versicherung';

my $current_vol = Win32::Sound::Volume();

my $main =  new Tk::MainWindow( -title => $title );
$main->geometry('1024x768');
$main->FullScreen(1);
my $image = $main->Photo('-format' => 'jpeg', -file => 'boss.jpg');
$main->Label(-image => $image)->pack(); 
Win32::API->Import('user32', 'GetAsyncKeyState', 'I', 'I');
my $vis = 1;
$main->repeat(50, \&read_stuff);
MainLoop;

sub read_stuff
{
 if ($vis == 1)
  {
   $main->stayOnTop;
   $main->focus;
  } 
 &switch_vis if ((GetAsyncKeyState($boss_key) & 1) == 1);
 exit        if ((GetAsyncKeyState($exit_key) & 1) == 1);
}

sub switch_vis
 {
  if ($vis == 0)
   {
    $main->deiconify;
    $current_vol = Win32::Sound::Volume();
    Win32::Sound::Volume(0);
   }
  else
   {
    $main->withdraw;
    Win32::Sound::Volume($current_vol);
   }
  $vis = !$vis;
 }


..Vollbild + Schaltet Sound aus und in derselben Lautstärke wieder an ^^

Gruss
<< |< 1 2 3 >| >> 21 Einträge, 3 Seiten



View all threads created 2007-02-28 12:24.