Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

When you post code, you need to put it inside <code></code> tags, which makes it much easier for others to read.

I've posted your code reformatted in a more easier to read format below. However, while reformatting your code, I noticed that it looks like there are some issues with curly brackets. There are some areas that are missing the closing curly brackets and then there are extra curly brackets at the end of your code.

use thread; use Parallel::ForkManager; use Data::Dumper; use Net::Telnet; use Win32::API; use Win32::GUI(); $main = Win32::GUI::Window->new( -name => 'Main', -width => 500, -height => 900, -text => 'Perl', -minsize => 500, 900, ); my $loadImage = new Win32::API ('user32', 'LoadImage', 'N','N','I','I' +,'I','I','N') or die 'cannot find LoadImage function'; my $waitCursor = $loadImage->Call(0, 32514, 2, 0, 0, 0x8040); my $font = Win32::GUI::Font->new( -name => "Comic Sans MS", -size => 8 +,); $main->AddLabel(-text => "Welcome ", -pos => 10, 10 , -size => 190, 12 +5 ,); $main->AddLabel(-text => "Enter Host Name / IP : ", -pos => 10, 33 , - +size => 190, 125 , ); my $t= $main->AddTextfield( -name => 'tfResults', -text => "hostname", + -pos => 125, 30 , -size => 100, 25 , ); my $my_but = $main->AddButton(-text => "Submit",-name => 'btQuery', -p +os => 235, 30 ,-size => 50, 25 ,); $main->Show(); Win32::GUI::Dialog(); sub btQuery_Click { $main-> DoEvents(); $txt1=$t->Text; if ($txt1) { my $txt1=$t->Text; if($txt1=~/a-zA-Z0-9+/) { #CHECKING WINDOWS OR UNIX HOST BY CALLING BELOW FUNCTION $oldCursor = Win32::GUI::SetCursor($waitCursor); #show hourglass ... print "\nConnecting to : $txt1"; &host1($txt1); if($hosttype=~/Unix/) { $t->ReadOnly(1); $my_but->Disable(); &unix_host; } elsif($hosttype=~/Windows/) { $t->ReadOnly(1); $my_but->Disable(); &win_host; } elsif($hosttype=~/unknowhost/) { $main->AddLabel(-text => "", -pos => 10, 200 , -size => 500, 5 +00 ,); $main->AddLabel( -text => "Unable to connect host. Please check the host name +/ip.", -pos => 10, 200 , -size => 500, 950, -font => $font, -foreground => 0, 0,250, ); print "\nUnknow host. Please check the host name/ip."; last; } # Connecting to Unix host sub unix_host { my $txt1=$t->Text; $main->AddLabel(-text => "", -pos => 0, 200 , -size => 500, 900 ,); $main->AddLabel(-text => "Please wait.....logining to host. ", -pos +=> 10, 200 , -size => 500, 500 ,); $telnet = new Net::Telnet ( Timeout=>1800, Errmode=>'die', input_log=>'input.log', output_log=>'output.log', Dump_Log=>'dump.log', Option_log=>'option.log' ); $telopt_ttype_ok = ''; $telnet->option_callback(\&opt_callback); $telnet->option_accept(Do=>Net::Telnet->TELOPT_TTYPE); $telnet->suboption_callback(\&subopt_callback); chomp $txt1; $telnet->open($txt1); my $oldCursor = Win32::GUI::SetCursor($waitCursor); #show hourglass ... $telnet->waitfor('/login: $/i'); $telnet->print('root'); $telnet->waitfor('/Password: $/i'); $telnet->print('dangerous'); $telnet->waitfor('/# $/i'); print "\nConnected to Unix host :$txt1 "; print FILE "\n@time1:Connected to Unix host: $txt1"; $main->AddLabel(-text => "Connected to Unix host. ", -pos => 10, 500 + , -size => 500, 500 ,); #print "\nSetting symcli and adios path on host."; #my $PATH = '/usr/symcli/bin:/usr/adios'; #$telnet->print("PATH=$PATH"); #PATH=$PATH:/data/myscripts #$telnet->print("PATH=$PATH:/usr/symcli/bin:/usr/adios"); #$telnet->print("export PATH"); #$telnet->waitfor('/# $/i'); Win32::GUI::SetCursor($oldCursor); #show previous arrow cursor again $check1=$main->AddButton(-name => "Unix_Check",-text => "Check versi +on",-pos => 55, 70 ,); $main->AddLabel(-text => " Enter custom cmd:",-pos => 10, 100 ,-size + => 250, 125 ,); $t1= $main->AddTextfield(-name => 'tfResults2',-text => "",-pos => 1 +30, 100 ,-size => 100, 25 ,); $submit=$main->AddButton(-text => "Submit",-name => 'Unix_submit',-p +os => 250, 100 ,-size => 50, 25 ,); sub Unix_Check_Click { } sub Unix_submit_Click { } } } } }

In reply to Re^3: Win32 GUI freeze by dasgar
in thread Win32 GUI freeze by ckant8

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (6)
    As of 2014-07-12 18:36 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (240 votes), past polls