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",
" > E&xit"=> "mnuFileExit",
"&Help"=> "mnuHelp",
" > A&bout"=> "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! =-)
}