You'd get better responses if your code showed some semblence of effort. A few questions:

  1. Why are you initialising @alerts with an anonymous array containing the characters 'a'..'z'?
  2. Why do you have two subroutines embedded within a subroutine?
  3. What it sub T1_Timer() meant to achieve?
  4. Why aren't you using strict?
  5. How is sub Loop() ever meant to be run?
  6. Why are you closing the file twice?
  7. Why do you then reopen it for output and never close it?

Anyway, try this:

#! perl -slw use strict; use Win32::GUI(); use Win32::Sound; my $filename="yourfile.dat"; open(TXT, $filename)||die("Could not open file!"); my @filedata = <TXT>; close(TXT); my( $running, @alerts ) = 0; my $p = 100; for my $element ( @filedata ) { if( $element =~ /(\s+)(\d{1,4})(\.\d{1,4}){3}(\s+)/) { push @alerts, Build_Window( $element, $p += 10 ); ++$running; } } sub Alert_Terminate { return --$running ? 1 : -1; } sub Build_Window { my( $element, $pos ) = @_; my $win = new Win32::GUI::Window( -name => "Alert", -width => 500, -height => 150, -pos => [ $pos, $pos ] ); my $font = Win32::GUI::Font->new( -name => "Arial", size => 46, -bold => 1 ); $win->AddLabel(-text => localtime(), -font => $font); $win->AddLabel( -text => "SNORT ALERT: MALICIOUS BEHAVIOR DETECTED!", -font => $font, -top => 50 ); $win->AddLabel(-text => $element, -font => $font, -top => 75); Win32::Sound::Play("SystemExclamation"); $win->Show(); return $win; } Win32::GUI::Dialog();

But be aware, your apparent lack of understanding, and of effort to understand, means that you are going to have to start reading some documentation, and try to develop your understanding by writing a few simple (non-GUI) programs, before you will get further help from me.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^5: Win32 GUI Window Problem by BrowserUk
in thread Win32 GUI Window Problem by Acid Amygdala

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.