diff options
author | Jan Dubois <jand@activestate.com> | 2002-02-11 16:56:31 -0800 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-12 13:44:34 +0000 |
commit | 02637f4cf632ad1b1402d154f783a4db5a81d968 (patch) | |
tree | e8004e540de5c015134857f05516c533a87ab9c5 /win32 | |
parent | 42873cecf73e7c7f00d9d5756fe5e667c4512654 (diff) | |
download | perl-02637f4cf632ad1b1402d154f783a4db5a81d968.tar.gz |
Re: [PATCH 5.6.1] Win32: Give user control over window creation behavior of system() function
Message-ID: <4llh6uc4gnqtk3csmfoqed3t6q85436bb1@4ax.com>
p4raw-id: //depot/perl@14657
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 31 | ||||
-rw-r--r-- | win32/win32.h | 6 |
2 files changed, 37 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 52d0924a9c..e0cdfc0532 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3667,6 +3667,10 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv) else { create |= CREATE_NEW_CONSOLE; } + if (w32_use_showwindow) { + StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; + StartupInfo.wShowWindow = w32_showwindow; + } DEBUG_p(PerlIO_printf(Perl_debug_log, "Spawning [%s] with [%s]\n", cname,cmd)); @@ -4003,6 +4007,32 @@ win32_dynaload(const char* filename) */ static +XS(w32_SetChildShowWindow) +{ + dXSARGS; + BOOL use_showwindow = w32_use_showwindow; + /* use "unsigned short" because Perl has redefined "WORD" */ + unsigned short showwindow = w32_showwindow; + + if (items > 1) + Perl_croak(aTHX_ "usage: Win32::SetChildShowWindow($showwindow)"); + + if (items == 0 || !SvOK(ST(0))) + w32_use_showwindow = FALSE; + else { + w32_use_showwindow = TRUE; + w32_showwindow = (unsigned short)SvIV(ST(0)); + } + + EXTEND(SP, 1); + if (use_showwindow) + ST(0) = sv_2mortal(newSViv(showwindow)); + else + ST(0) = &PL_sv_undef; + XSRETURN(1); +} + +static XS(w32_GetCwd) { dXSARGS; @@ -4488,6 +4518,7 @@ Perl_init_os_extras(void) newXS("Win32::GetLongPathName", w32_GetLongPathName, file); newXS("Win32::CopyFile", w32_CopyFile, file); newXS("Win32::Sleep", w32_Sleep, file); + newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file); /* XXX Bloat Alert! The following Activeware preloads really * ought to be part of Win32::Sys::*, so they're not included diff --git a/win32/win32.h b/win32/win32.h index f5c04b68da..299d8f1ed5 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -353,6 +353,8 @@ struct thread_intern { # ifdef USE_RTL_THREAD_API void * retv; /* slot for thread return value */ # endif + BOOL Wuse_showwindow; + WORD Wshowwindow; }; #ifdef USE_5005THREADS @@ -421,12 +423,16 @@ DllExport int win32_async_check(pTHX); # define w32_crypt_buffer (thr->i.Wcrypt_buffer) # define w32_servent (thr->i.Wservent) # define w32_init_socktype (thr->i.Winit_socktype) +# define w32_use_showwindow (thr->i.Wuse_showwindow) +# define w32_showwindow (thr->i.Wshowwindow) #else # define w32_strerror_buffer (PL_sys_intern.thr_intern.Wstrerror_buffer) # define w32_getlogin_buffer (PL_sys_intern.thr_intern.Wgetlogin_buffer) # define w32_crypt_buffer (PL_sys_intern.thr_intern.Wcrypt_buffer) # define w32_servent (PL_sys_intern.thr_intern.Wservent) # define w32_init_socktype (PL_sys_intern.thr_intern.Winit_socktype) +# define w32_use_showwindow (PL_sys_intern.thr_intern.Wuse_showwindow) +# define w32_showwindow (PL_sys_intern.thr_intern.Wshowwindow) #endif /* USE_5005THREADS */ /* UNICODE<>ANSI translation helpers */ |