Leser: 1
![]() |
|< 1 2 3 >| | ![]() |
21 Einträge, 3 Seiten |
QuoteNot implemented on MSWin32: Das Handle ist ungültig at C:/Perl/site/lib/Term/InKey.pm line 32.
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;
use Term::InKey;
while(my $key = ReadKey) {
Clear;
print "You typed: ".$key;
}
1 2 3 4 5 6 7 8
use Term::ReadKey; if (defined ($char = ReadKey(-1)) ) { if(ord($char) == 27) { ... } }
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl
use strict;
use warnings;
use Win32::KeyState qw(:get);
while(1) {
print 'CapsNum is ', GetNumLock() ? 'On' : 'Off', "\n";
}
1
2
3
4
5
if (GetKeyState(0x10) & 1) {
print "Shift key is depressed\n"
} else {
print "Shift key is pressed\n"
}
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
#!/usr/local/bin/perl -w use Tk; use Win32::KeyState qw(:get); my $main = new Tk::MainWindow; $main->geometry('1030x740'); my $vis = 1; sub read_stuff { &switch_vis if ((GetKeyState(0x1b) & 1) == 1); } $handler = $main->repeat(500, \&read_stuff); sub switch_vis { if($vis == 0) { $vis = 1; $main->deiconify; } else { $vis = 0; $main->iconify; } } MainLoop;
QuoteCan't locate object method "SetWindowsHookEx" via package "MyModule" at test.pl line 11, <DATA> line 164.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl use strict; package MyModule; use base qw/Win32::API::Interface/; __PACKAGE__->generate( "kernel32", "SetWindowsHookEx", "WH_MOUSE", \&test, "NULL", 0 ); 1; my $obj = MyModule->new(); $obj->SetWindowsHookEx(); sub test { print "Mouse Event\n"; }
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;
![]() |
|< 1 2 3 >| | ![]() |
21 Einträge, 3 Seiten |