From: Frazier, J. J. <Joe...@Pe...> - 2001-05-11 14:11:49
|
>perldoc -f exec exec LIST exec PROGRAM LIST The `exec()' function executes a system command *AND NEVER RETURNS* - use `system()' instead of `exec()' if you want it to return. It fails and returns FALSE only if the command does not exist *and* it is executed directly instead of via your system's command shell (see below). =20 note the AND NEVER RETURNS part. =20 =20 You may want system, but that locks the toolbar until the application returns. You probably want to use fork if you are running Perl 5.6. Win32::Process may might also be an alternative, but using both are outside of my expertise as far as returning messages from the CALLED back to the CALLEE( your program).=20 =20 Also, I would probably set a return 1 statement at the end of each event. Not sure it this is needed or not, perhaps someone else could verify. =20 =20 -----Original Message----- From: Chris Etzel [mailto:ce...@mi...] Sent: Thursday, May 10, 2001 9:38 PM To: per...@li... Subject: Re: [perl-win32-gui-users] keeping a window open yes.=20 =20 Here is the code. It's messy, but commented ... =20 use Win32::GUI; #($DOS) =3D Win32::GUI::GetPerlWindow(); # Win32::GUI::Hide($DOS); =20 # this is basically a test to learn Win32::GUI my $Toolbar=3DWin32::GUI::Window->new( -name=3D>'Toolbar', -size=3D>[600,75], -title=3D>"PERL ToolBar", ); =20 # launcher button on main bar my $launcher=3D$Toolbar->AddButton( -name=3D>'launcher', -pos=3D>[10,10], -text=3D>"Launcher", ); $Toolbar->launcher->Show(); =20 #launch the launcher panel and create panel as separate window #this is where I can type a command in and run it directly from <STDIN> sub launcher_Click{ my $Launcher=3DWin32::GUI::Window->new(=20 -name=3D>'CommandLauncher', -size=3D>[200,75], -title=3D>"Launcher", ); $Launcher->Show(); =20 my $textfield=3D$Launcher->AddTextfield( -name=3D>'CommandBox', -background=3D>[255,255,0], -pos=3D>[10,10], -size=3D>[150,22], ); =20 #run button on launcher window my $runButton-$Launcher->AddButton( -name=3D>'runbutton', -pos=3D>[160,10], -text=3D>'Run', -size=3D>[30,22], ); $Launcher->runbutton->Show(); =20 # this executes the user input of $textfield=20 sub runbutton_Click{ exec($textfield->Text); } } my $NotePadButton=3D$Toolbar->AddButton( -name=3D>'notepad', -pos=3D>[75,10], -text=3D>'notepad', ); =20 =20 $Toolbar->notepad->Show(); sub notepad_Click{ exec("notepad.exe"); } =20 #exit the program. This is a test to figure out how to keep the=20 #toolbar floating without exiting on button_Click.=20 =20 my $ExitButton=3D$Toolbar->AddButton( -name=3D>'Exit', -pos=3D>[150,10], -text=3D>'Exit Toolbar', ); =20 sub Exit_Click { exit; } =20 =20 $Toolbar->Show(); Win32::GUI::Dialog(); =20 # commented this out trying to troubleshoot=20 # sub Toolbar_Terminate{ # -1; # } =20 =20 =20 =20 =20 =20 ----- Original Message -----=20 From: Peter Eisengrein <mailto:Pet...@at...> =20 To: 'per...@li...' <mailto:'per...@li...'> =20 Sent: Friday, May 11, 2001 7:31 AM Subject: RE: [perl-win32-gui-users] keeping a window open Do you have the Win::GUI::Dialog(); statement in there? =20 =20 -----Original Message----- From: Chris Etzel [ mailto:ce...@mi... <mailto:ce...@mi...> ] Sent: Thursday, May 10, 2001 8:03 PM To: per...@li... <mailto:per...@li...>=20 Subject: [perl-win32-gui-users] keeping a window open Ok, it may be that I have hacking at my script so long I am cross-eyed, but it is too much fun to stop now. I figured the best way to learn the Win32::GUI was to write a cool little toolbar with a couple of my most used apps on it. It floats and brings up my apps like it should, but it closes after I click the button for the app. How do I keep the script open until I exit it manually?=20 =20 I have an exit button but for the life of me I can't figure out how to tell it=20 unless I click EXIT, stay open. =20 I will kick myself in advance in case this is a basic perl coding issue and not a Win32gui issue. =20 Thanks,=20 Chris |