Robert,

thank you for your efforts and email, I'll try my best to clarify...

The idea is to create and manage many windows. The clue is that I do not know how many of them can be created. To open new window we use Right key, to close Left and to switch between windows Enter.

I was working on it and - when I had changed destroying window to hiding them everything was OK. However I hope to destroy them because of the fact I don't know how many of them I have to create.


The point is that in WindowsXP it works fine but in Widows 98 SP2 it does not.
Windows' error screen points to USER32.DLL error.
What is the error that you get?
It apears small window with the following information (in my translation):

PERL couse an error: incorrect page in the module
USER32.DLL at 0167:bff558c6.
Registry:
EAX=00000001 CS=0167 EIP=bff558c6 EFLGS=00010202
EBX=00000100 SS=016f ESP=0153f998 EBP=0153fa10
ECX=00000d1c DS=016f ESI=02c761ec FS=0d2f
EDX=01554280 ES=016f EDI=0155424c GS=0000
Bytes in CS:EIP:
66 81 39 90 68 75 25 66 81 79 06 90 68 75 1d 81
Stos:
02ba4a51 00000d1c 000006a0 00000100 00000025 014b0001 0155424c 02c761ec 00000000 04427695 16d717c7 000089f4 61ec0038 000002c7 89e60e17 17c71248


If you can post a smaller, complete example showing your problem, and removing all the stuff that is not necessary, then I will help you try to identify the problem.
I enclose new refreshed code at the end

Waldemar

############################################################
#! perl -w

use strict;
use Win32::GUI qw();

my $last  = -1;

my @Window;
my @start = (0);
my @rows  = (5);
my $which = 0;
my $help;

makewindow();

Win32::GUI::Dialog();
exit(1);

sub Window_Terminate { return -1 }

sub makewindow {
   return 1 if $last > 3;
   $last++;

   $start[$last] = 0;
   $rows[$last]  = 5+$last;

   $Window[$last]->{SCREEN} = new Win32::GUI::Window (
       -title    => "Item: $last",
       -pos     => [10+$last*202, 20],
       -size    => [200, 200],
       -name     => "Window_$last",
       -onKeyDown   => \&keydown,
   );

   if ( $last == 0 ) {
       $Window[$last]->{HELP} = $Window[$last]->{SCREEN}->AddLabel(
           -parent  => $Window[$last]->{SCREEN},
           -pos=>[4,20],
           -size=>[150,150],
-text=>"HELP:\n\n Right=add window\n Left=close (only top) window\n Enter=switch between windows\n",
           -multiline=>1,
       )
   }

   $Window[$last]->{SCREEN}->Show(1);

   print "item $last created\n";

   $which = $last;
}

sub keydown {
   my ( $self, undef, $key ) = @_;

   my $hash_EVENT    = Win32::GUI::GetKeyboardState;

   if ( $hash_EVENT->[39] ) {

               makewindow();

   } elsif ( $hash_EVENT->[13] ) {

               if ( $which == $last ) { $which = 0 } else { $which++ }

               $Window[$which]->{SCREEN}->SetFocus();

   } elsif ( $hash_EVENT->[37] ) {

       if (( $which == $last )&&( $last>0)) {

               print "item $last deleted\n";

$Window[$which]->{SCREEN}->DESTROY if $Window[$which]->{SCREEN};

               $last--;
               $which--;
               $Window[$which]->{SCREEN}->SetFocus();
       } elsif ( $last == 0 ) {
               print "item $last deleted\n";
               return -1;
       }

  }
   return 1;
}
############################################################


Reply via email to