Thread Globales Tasten-Event abfangen (win) (20 answers)
Opened by GoodFella at 2007-02-28 12:24

GoodFella
 2007-03-01 01:19
#74662 #74662
User since
2007-01-09
192 Artikel
BenutzerIn
[default_avatar]
Ok, hab jetzt durch Win32::KeyState und das Lesen von der GetKeyState-Doku auf msdn genau das gefunden was ich gesucht habe. Code:
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
#!/usr/local/bin/perl -w

use Tk;
use Win32::API;

Win32::API->Import('user32', 'GetAsyncKeyState', 'I', 'I');

my $main =  new Tk::MainWindow;
$main->geometry('1030x740');

my $vis = 1;

sub read_stuff
{
 &switch_vis if ((GetAsyncKeyState(0x04) & 1) == 1);
}
$handler = $main->repeat(50, \&read_stuff);


sub switch_vis
{
  if($vis == 0)
   {
    $vis = 1;
    $main->deiconify;
   }
  else
   {
    $vis = 0;
    $main->withdraw;
   }
}

MainLoop;


Hilfreich war auch http://msdn.microsoft.com/library....des.asp

View full thread Globales Tasten-Event abfangen (win)