RE: Win32::Process::Create
Not sure why you use Win32Process (I' am sure you have your reasons), but I have scripts that launch child processes and wait for them to terminate. I just use the backticks(``) rather than a "system" command. The script will just hang until the child is done. For the other thing about minimizing/hiding the console window, Win32::GUI can do this: use Win32::GUI; my $perlwin = Win32::GUI::GetPerlWindow(); Win32::GUI::Show( $perlwin, 0 ); # SW_HIDE Win32::GUI::Show( $perlwin, 1 ); # SW_SHOWNORMAL Win32::GUI::Show( $perlwin, 5 ); # SW_SHOW Win32::GUI::Show( $perlwin, 6 ); # SW_MINIMIZE -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Ellery Sent: Monday, April 28, 2008 3:24 PM To: 'perl-win32-users' Subject: Win32::Process::Create ..I use this function pretty regularly to spawn procs on windows, but I've often wanted to minimize the console or main window that was launched. Does anyone know how to do this? In the corresponding WIN32 API, there is a STARTUPINFO structure that allows this, but looks like it's not part of the Win32::Process API. Advice appreciated. -Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::Process::Create
On Mon, 28 Apr 2008, Michael Ellery wrote: > > ..I use this function pretty regularly to spawn procs on windows, but > I've often wanted to minimize the console or main window that was > launched. Does anyone know how to do this? In the corresponding WIN32 > API, there is a STARTUPINFO structure that allows this, but looks like > it's not part of the Win32::Process API. Advice appreciated. You cannot do this currently with Win32::Process, so you may want to file an enhancement request at http://rt.cpan.org/Public/Dist/Display.html?Name=Win32-Process You could achieve the functionality with the standard system() function though. Just call e.g. Win32::SetChildShowWindow(Win32::SW_SHOWMINIMIZED); or Win32::SetChildShowWindow(Win32::SW_HIDE); to run processes minimized, or even without a window at all. See `perldoc Win32` for the Win32""SetChildShowWindow() docs. If you need to wait for your subprocesses, then you may want to use this somewhat obscure form: my $pid = system(1, $cmdline); # ... waitpid $pid, 0; (This is documented in `perldoc perlport` as a Win32 specific extension to system(), but not mentioned in `perldoc -f system`). Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::Process::Create
Sisyphus wrote: > > What happens if you launch the script using the wperl executable instead > of the perl executable ? > I don't even know what wperl is, although it does look like it's part of my current perl install (I have never heard of it before now). In any event, it's not an option for us since most of our stuff runs in the context of the perlSE.dll (ActiveScript engine). > Have you checked the various flags constants ? From the docs: > > -- > EXPORTS >The following constants are exported by default: > >CREATE_DEFAULT_ERROR_MODE > -- > > I was thinking specifically of CREATE_NO_WINDOW constant (but perhaps > that does something else). > I believe this corresponds to this process creation flag (from MSDN docs): CREATE_NO_WINDOW 0x0800 The process is a console application that is being run without a console window. Therefore, the console handle for the application is not set. This flag is ignored if the application is not a console application, or if it is used with either CREATE_NEW_CONSOLE or DETACHED_PROCESS. I'm really looking for something that works more generally (for console and non-console apps alike). In older versions of the win32 API, I'm pretty sure there was a field in the STARTUPINFO that allowed the caller to request the app be started mimimized, but the current docs don't show such an option. Perhaps my best bet it to try to call ShowWindow directly ?? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::Process::Create
- Original Message - From: "Michael Ellery" <[EMAIL PROTECTED]> To: "'perl-win32-users'" Sent: Tuesday, April 29, 2008 5:24 AM Subject: Win32::Process::Create > ..I use this function pretty regularly to spawn procs on windows, but > I've often wanted to minimize the console or main window that was > launched. Does anyone know how to do this? In the corresponding WIN32 > API, there is a STARTUPINFO structure that allows this, but looks like > it's not part of the Win32::Process API. Advice appreciated. Jst a couple of thoughts - I don't have time to test any of this out at the moment. What happens if you launch the script using the wperl executable instead of the perl executable ? Have you checked the various flags constants ? From the docs: -- EXPORTS The following constants are exported by default: CREATE_DEFAULT_ERROR_MODE CREATE_NEW_CONSOLE CREATE_NEW_PROCESS_GROUP CREATE_NO_WINDOW CREATE_SEPARATE_WOW_VDM CREATE_SUSPENDED CREATE_UNICODE_ENVIRONMENT DEBUG_ONLY_THIS_PROCESS DEBUG_PROCESS DETACHED_PROCESS HIGH_PRIORITY_CLASS IDLE_PRIORITY_CLASS INFINITE NORMAL_PRIORITY_CLASS REALTIME_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL THREAD_PRIORITY_BELOW_NORMAL THREAD_PRIORITY_ERROR_RETURN THREAD_PRIORITY_HIGHEST THREAD_PRIORITY_IDLE THREAD_PRIORITY_LOWEST THREAD_PRIORITY_NORMAL THREAD_PRIORITY_TIME_CRITICAL The following additional constants are exported by request only: STILL_ACTIVE -- I was thinking specifically of CREATE_NO_WINDOW constant (but perhaps that does something else). Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::Process::Create
..I use this function pretty regularly to spawn procs on windows, but I've often wanted to minimize the console or main window that was launched. Does anyone know how to do this? In the corresponding WIN32 API, there is a STARTUPINFO structure that allows this, but looks like it's not part of the Win32::Process API. Advice appreciated. -Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs