Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found