Derek,

I think I have several scripts that do the sort of thing your asking about.
You seem to want to use GUI to reflect the status of the program you are
running.  If so using Win32::GUI::Dialog() won't do this, your script loses
control as soon as you make the Dialog call.  Control only returns to the
script if a GUI event occurs (like terminate).

What you can do instead is create your window, use Show() to display
the Window, Update() to display changes, and PostQuitMessage to shut
down the Window when you've finished.  I do find that occasionally I get
black 'DOS' prompt windows flick up on the screen.  My code goes 
something like this:

my $Win = new Win32::GUI::Window(
      -left   => 341,
      -top    => 218,
      -width  => 300,
      -height => 86,
      -name   => "Win",
      -text   => "Message Window"
      );

$Win->AddLabel(           # Text within Win
       -text    => "  ",
       -name    => "Label",
       -left    => 5,
       -top     => 5,
       -width   => 280,
       -height  => 48,
      );


sub display {           #   Update status text
   my $text=shift;
   $Win->Show();
   $Win->BringWindowToTop();
   $Win->Refresh();
   $Win->Label->Text($text);
   $Win->Label->Update();
}

sub errorh {

  my ($text, $ec)=@_;
  $Win->Hide();             # Just in case its visible
  Win32::GUI::SetForegroundWindow($noteswin);

  my $a=Win32::MsgBox($text, 0 | MB_ICONSTOP, "Attachment Error");

  Win32::GUI::Enable($noteswin);    # Enable Notes
  Win32::GUI::SetForegroundWindow($noteswin);

  exit $ec;

}

sub Win_Terminate {
   return -1;
}

display("Starting my script");

#
#   your code goes here
#  with calls to display and errorh
#  as appropriate
#

   $Win->PostQuitMessage();         # Close message window






[EMAIL PROTECTED] on 27/06/2000 14:40:52
To: [EMAIL PROTECTED] @ INTERNET
cc:  

Subject: [perl-win32-gui] Windows updates/default action


I am trying to add a GUI status window to my logon script, and have be
successful so far. The problem I am now running into is that the window is
not being drawn completely. Is there a default action that I can use once I
go into Win32::GUI::Dialog()? Like creating a WindowName_Default, or Onload
or something? Once the script is done I want the window to close itself out.
Right now everything is running before it enters Win32::GUI::Dialog(), and
I'm only getting a window with my status bar (and not the rest of the
controls in the window) until it hits Win32::GUI::Dialog(), and then I have
to close the window manually (click the X). Thanks!!!

Derek J. Lambert
Network Administrator
Columbia ParCar Corp.
608/524-8888
608/524-8380 fax




Reply via email to