RE: [perl-win32-gui-users] Win32::GUI help
I think I did kind of the same thing you are looking at. What I had to do was create a child process to handle all my requests. Take a look at Win32::ProcFarm to create and talk with your children processes while having your parent process deal with the interface. Give that a shot =-) I will try to find some of my code and send it on. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of #SHUCHI MITTAL# Sent: Wednesday, January 07, 2004 7:30 AM To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] Win32::GUI help Hi once again everyone I just started working with Win32::GUI yesterday and was wondering if anyone could tell me how I can do the following: 1/ Make a basic GUI with certain buttons-- I have successfully managed to make this!!:) 2/ Every button click should invoke another perl script -- I think I can do this by including the system command in the button click method. If anyone knows any other sophisticated method then pelase tell me 3/ I need to display the output while execution of each of the scripts, that runs on a button click, on some sort of box/window. This box or window can appear on the original window or pop up a new one which would close once execution finishes. that is : I have a basic window with buttons. on click of button I should see a text box or a pop up window which shows me the result of the script execution. If its a pop up window it should close when script finishes execution and if its a text box then it can just stay as it is once the execution finishes. I I have NO idea how to do this so any sort of help would be great. I tried reading some tutorials on Win32::GUI but Im still lost. Any advice/script snippets to start me off would be much appreciated. Thanx in advance Cheers Shuchi --- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78alloc_id371op=click ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
RE: [perl-win32-gui-users] Win32::GUI help
Here ya go: All the use's were done to allow for perl2exe to compile it into an application. The code is really really sloppy. =( Also I used guiloft to create the win32::Gui stuff... Way easier.. I would highly recommend it! =-) ---CODE--- #!e:\perl\bin\perl #this is the parent script use Win32::GUI; use Win32; use Win32::GUI::Loft; use Win32::GUI::Resizer; use Win32::GUI::ToolbarWindow; use Win32::GUI::BorderlessWindow; use Win32::GUI::Loft::Cluster; use Win32::GUI::Loft::ControlProperty; use Win32::GUI::Loft::ControlProperty::Readonly; use Win32::GUI::Loft::ControlInspector; use Win32::GUI::Loft::Control; use Win32::GUI::Loft::Control::ForegroundBackground; use Win32::GUI::Loft::Control::Intangible; use Win32::GUI::Loft::Control::Window; use Win32::GUI::Loft::Control::Button; use Win32::GUI::Loft::Control::Textfield; use Win32::GUI::Loft::Control::RichEdit; use Win32::GUI::Loft::Control::Label; use Win32::GUI::Loft::Control::Checkbox; use Win32::GUI::Loft::Control::Radiobutton; use Win32::GUI::Loft::Control::Listbox; use Win32::GUI::Loft::Control::Combobox; use Win32::GUI::Loft::Control::TreeView; use Win32::GUI::Loft::Control::ListView; use Win32::GUI::Loft::Control::Groupbox; use Win32::GUI::Loft::Control::Toolbar; use Win32::GUI::Loft::Control::StatusBar; use Win32::GUI::Loft::Control::ProgressBar; use Win32::GUI::Loft::Control::TabStrip; use Win32::GUI::Loft::Control::Splitter; use Win32::GUI::Loft::Control::ImageList; use Win32::GUI::Loft::Control::Timer; use Win32::GUI::Loft::Control::Custom; use Win32::GUI::Loft::Control::Graphic; use Win32::GUI::Resizer; use Data::Dumper; use IO::Socket; use Cwd; use Data::Dumper; use Win32::Process; use Win32::ProcFarm::Port; use Win32::ProcFarm::TickCount; use Win32::ProcFarm::Parent; use Win32::ProcFarm::Port; #this hides the dos window =-) yeah! my ($DOS) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS); my $port_obj = Win32::ProcFarm::Port-new(9000, 1); my $interface = Win32::ProcFarm::Parent-new_async($port_obj, perl_script.pl, Win32::GetCwd); $interface-connect; sub main { # this code from here to the other here (lol) is all I need to create the window. Ergo why GUILOFT ROCKS! my $fileWindow = Hotfix.gld; my $objDesign = Win32::GUI::Loft::Design-newLoad($fileWindow) or die(Could not open window file ($fileWindow)); #Create a menu and assign it to the design object before #building the window. $objDesign-mnuMenu( Win32::GUI::MakeMenu( File=mnuFile, Save= mnuFileSave, Save All= mnuFileSaveAll, Exit= mnuFileExit, Help= mnuHelp, About= mnuHelpAbout ) ); my $win = $objDesign-buildWindow() or die(Could not build window ($fileWindow)); $win-Show(); # the other HERE! =-) } sub ::btnOpen_Click { $jobServerToProcess = localhost; $interface-execute('check_server', $jobServerToProcess); } ---END CODE--- ---CODE--- #!e:\perl\bin\perl #this is the child process use Data::Dumper; use IO::Socket; use Win32::GUI; my ($DOS) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS); sub init { my($port_num, $unique) = @ARGV[0,1]; $socket = new IO::Socket::INET (localhost:$port_num) or die Child unable to open socket.\n; print $socket pack(V, $unique); } sub main_loop { my $len, $cmd; my $temp = read($socket, $len, 4); $temp or exit; $temp == 4 or die Unable to completely read command length.\n; $len = unpack(V, $len); (read($socket, $cmd, $len) == $len) or die Unable to completely read command.\n; my($command, $ptr2params); eval($cmd); my(@retval) = $command(@{$ptr2params}); my $retstr = Data::Dumper-Dump([EMAIL PROTECTED], [ptr2retval]); print $socket (pack(V, length($retstr)).$retstr); } init; while(1) { main_loop; } sub check_server { my($server) = shift; # do your stuff here! =-) }
RE: [perl-win32-gui-users] Win32::GUI help
I build it with perl2exe as well but that will require a small mod to the parent.pm in procfarm. The change has been submitted to the creator of procfarm but he has not released it. I tested it on XP and NT4 and 2K so as far as I can tell once it is compiled as long as you are calling the lowest common denominator for the OS's it should work =-) Open parent.pm and look for the following code: sub _new_async { my $self = shift; my $process; my $unique = $Win32::ProcFarm::Parent::unique++; my $port_num = $self-{port_obj}-get_port_num; (my $perl_exe = $^X) =~ s/\\[^\\]+$/\\Perl.exe/; Win32::Process::Create($process, $perl_exe, perl $self-{script} $port_num $unique, 0, 0, $self-{curdir}) or die Unable to start child process.\n; $Win32::ProcFarm::Parent::processes-{$unique} = $process; $self-{state} = 'init'; return $self; } Replace it with this code: sub _new_async { my $self = shift; my $process; my $unique = $Win32::ProcFarm::Parent::unique++; my $port_num = $self-{port_obj}-get_port_num; if($self-{script}=~ /\.exe/ig){ Win32::Process::Create($process, .\/$self-{script}, $self-{script} $port_num $unique, 0, 0, $self-{curdir}) or die Unable to start child process. .\/$self-{script} $port_num $unique\n; } else { (my $perl_exe = $^X) =~ s/\\[^\\]+$/\\Perl.exe/; Win32::Process::Create($process, $perl_exe, perl $self-{script} $port_num $unique, 0, 0, $self-{curdir}) or die Unable to start child process. perl $self-{script} $port_num $unique\n; } $Win32::ProcFarm::Parent::processes-{$unique} = $process; $self-{state} = 'init'; return $self; } -Original Message- From: Jeremy White [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 9:16 AM To: [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Subject: RE: [perl-win32-gui-users] Win32::GUI help Looks good - I'll have to have a play. Have you had any issues rolling out your exe across different versions of windows? Do you build the child with perl2exe before shipping it out? Thanks, jez. From: Farrington, Ryan [EMAIL PROTECTED] CC: 'perl-win32-gui-users@lists.sourceforge.net' perl-win32-gui-users@lists.sourceforge.net Subject: RE: [perl-win32-gui-users] Win32::GUI help Date: Wed, 7 Jan 2004 08:17:12 -0600 Here ya go: All the use's were done to allow for perl2exe to compile it into an application. The code is really really sloppy. =( Also I used guiloft to create the win32::Gui stuff... Way easier.. I would highly recommend it! =-) ---CODE--- #!e:\perl\bin\perl #this is the parent script use Win32::GUI; use Win32; use Win32::GUI::Loft; use Win32::GUI::Resizer; use Win32::GUI::ToolbarWindow; use Win32::GUI::BorderlessWindow; use Win32::GUI::Loft::Cluster; use Win32::GUI::Loft::ControlProperty; use Win32::GUI::Loft::ControlProperty::Readonly; use Win32::GUI::Loft::ControlInspector; use Win32::GUI::Loft::Control; use Win32::GUI::Loft::Control::ForegroundBackground; use Win32::GUI::Loft::Control::Intangible; use Win32::GUI::Loft::Control::Window; use Win32::GUI::Loft::Control::Button; use Win32::GUI::Loft::Control::Textfield; use Win32::GUI::Loft::Control::RichEdit; use Win32::GUI::Loft::Control::Label; use Win32::GUI::Loft::Control::Checkbox; use Win32::GUI::Loft::Control::Radiobutton; use Win32::GUI::Loft::Control::Listbox; use Win32::GUI::Loft::Control::Combobox; use Win32::GUI::Loft::Control::TreeView; use Win32::GUI::Loft::Control::ListView; use Win32::GUI::Loft::Control::Groupbox; use Win32::GUI::Loft::Control::Toolbar; use Win32::GUI::Loft::Control::StatusBar; use Win32::GUI::Loft::Control::ProgressBar; use Win32::GUI::Loft::Control::TabStrip; use Win32::GUI::Loft::Control::Splitter; use Win32::GUI::Loft::Control::ImageList; use Win32::GUI::Loft::Control::Timer; use Win32::GUI::Loft::Control::Custom; use Win32::GUI::Loft::Control::Graphic; use Win32::GUI::Resizer; use Data::Dumper; use IO::Socket; use Cwd; use Data::Dumper; use Win32::Process; use Win32::ProcFarm::Port; use Win32::ProcFarm::TickCount; use Win32::ProcFarm::Parent; use Win32::ProcFarm::Port; #this hides the dos window =-) yeah! my ($DOS) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS); my $port_obj = Win32::ProcFarm::Port-new(9000, 1); my $interface = Win32::ProcFarm::Parent-new_async($port_obj, perl_script.pl, Win32::GetCwd); $interface-connect; sub main { # this code from here to the other here (lol) is all I need to create the window. Ergo why GUILOFT ROCKS! my $fileWindow = Hotfix.gld; my $objDesign = Win32::GUI::Loft::Design-newLoad($fileWindow) or die(Could not open window file ($fileWindow)); #Create a menu and assign it to the design object before #building the window. $objDesign-mnuMenu( Win32::GUI::MakeMenu( File=mnuFile, Save= mnuFileSave, Save All= mnuFileSaveAll, Exit= mnuFileExit
RE: [perl-win32-gui-users] System Administrator
Here is your solution Win32::PerfLib I've used it in the past and it works great for the applications I'm using it in -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, June 09, 2002 11:32 AM To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] System Administrator I am a novice in Perl. pardon me if this is too basic.. i am trying to get the PerfMon statistics such as CPU utilization, Memory Utilization. how can i do this? ravi
[perl-win32-gui-users] Everyone's work
I'm extremely interested to see what everyone has come up with... Does anyone know a site that would be suitable for uploading our working Win32::Gui applications for everyone to see... I have something simple but I think people supporting a Win32 environment would think it useful as a tool =)
[perl-win32-gui-users] eek! =)
Using Win32::GUI and I'm having a problem with the program reporting to windows that it is not responding. I know that it is because of the loop I have the program in but I still want the user to work while I'm processing in the background. I found a reference to $win-DoEvents() but as far as I can see that works but it errors out with Use of uninitialized value in subroutine entry at hotfix.pl line 172 Gah =( I'm starting to hate this... I've looked at the archives but no search sucks =) Anyone have any ideas?
RE: [perl-win32-gui-users] eek! =)
here is a sample break from the code starts on line 162 ends on line 185. sub ::btnOpen_Click { defined(my $win = $Win32::GUI::Loft::window{winFileDisplay}) or return(1); my %file1 = $win-tvwTreeView()-ItemInfo( $win-tvwTreeView-SelectedItem() ) or return(1); my $file = $file1{'-text'}; $interface-execute('check_server', $file); until($interface-get_state eq 'fin') { my $void = $win-DoEvents(); $win-pbProgressBar()-StepIt(); sleep(1); } $win-pbProgressBar()-SetPos(0); my @return_value = $interface-get_retval; my $msg = ; foreach my $line (@return_value){ $msg = $msg . $line; } $win-reFileSelected()-Text($msg); return(1); } -Original Message- From: FARRINGTON, RYAN [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 28, 2002 8:48 AM To: 'perl-win32-gui-users@lists.sourceforge.net' Subject: [perl-win32-gui-users] eek! =) Using Win32::GUI and I'm having a problem with the program reporting to windows that it is not responding. I know that it is because of the loop I have the program in but I still want the user to work while I'm processing in the background. I found a reference to $win-DoEvents() but as far as I can see that works but it errors out with Use of uninitialized value in subroutine entry at hotfix.pl line 172 Gah =( I'm starting to hate this... I've looked at the archives but no search sucks =) Anyone have any ideas?