• Publicidad

Reconocer shift en Windows

¿Apenas comienzas con Perl? En este foro podrás encontrar y hacer preguntas básicas de Perl con respuestas aptas a tu nivel.

Reconocer shift en Windows

Notapor BigBear » 2012-07-21 19:02 @835

Tengo el siguiente código.

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. use Win32::API;
  2.  
  3. my $come = new Win32::API("user32", "GetAsyncKeyState","N", "I");
  4.  
  5. while(1) {
  6.  
  7. if (dame(0x10)) {
  8. print "shift\n";
  9. $shift = 1;
  10. } else {
  11. $shift = 0;
  12. }
  13.  
  14. if(dame(0x31)) {
  15. if($shift eq "1") {
  16. print "!\n";
  17. } else {
  18. print "1\n";
  19. }
  20. }
  21.  
  22. }#
  23.  
  24. sub dame {
  25. return($come->Call(@_) & 1);
  26. }
  27.  
  28. sub savefile {
  29. print $_[1]."\n";
  30. }
  31.  
Coloreado en 0.004 segundos, usando GeSHi 1.0.8.4


La idea es reconocer cuando alguien quiere hacer "!" pero el problema es que tengo que reconocer shift y el código siempre me da problemas porque no reconoce cuando hago "shift+1" para hacer "!" devolviéndome siempre el "1".

¿ Alguien me podría ayudar ?
BigBear
Perlero frecuente
Perlero frecuente
 
Mensajes: 981
Registrado: 2009-03-01 18:39 @818

Publicidad

Volver a Básico

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados