Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

launch process in new window

Status
Not open for further replies.

mridangagarwal

Programmer
Jul 25, 2007
5
0
0
FI
Hey Everyone,

i use Perl to do some system work. I want to launch a new process. i do this by

Win32::process::Create($ProcessObj,
Win32::process::Create($ProcessObj,
"$perlpath",
"perl rsapiresume.pl $threadnumber prem $username $password",
0,
DETACHED_PROCESS,
".")|| die ErrorReport();

However, this launches the process in the same window. How do i launch this process in a new window. It outputs all the text into the screen of my calling script.

 
replace DETACHED_PROCESS with CREATE_NEW_CONSOLE
 
chazoid's suggestion works.

Code:
[url=http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/url] [green]Win32::Process[/green][red];[/red]
[black][b]use[/b][/black] [green]Win32[/green][red];[/red]

[black][b]use[/b][/black] [green]strict[/green][red];[/red]

[url=http://perldoc.perl.org/functions/sub.html][black][b]sub[/b][/black][/url] [maroon]ErrorReport[/maroon][red]{[/red]
	[url=http://perldoc.perl.org/functions/print.html][black][b]print[/b][/black][/url] [maroon]Win32::FormatMessage[/maroon][red]([/red] [maroon]Win32::GetLastError[/maroon][red]([/red][red])[/red] [red])[/red][red];[/red]
[red]}[/red]

[url=http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/url] [blue]$ProcessObj[/blue][red];[/red]
[maroon]Win32::Process::Create[/maroon][red]([/red][blue]$ProcessObj[/blue],
	[red]'[/red][purple]C:\bin\Perl\bin\perl.exe[/purple][red]'[/red],
	[red]"[/red][purple]perl.exe yourscript.pl[/purple][red]"[/red],
	[fuchsia]0[/fuchsia],
	CREATE_NEW_CONSOLE,
	[red]"[/red][purple].[/purple][red]"[/red],
[red])[/red] or [url=http://perldoc.perl.org/functions/die.html][black][b]die[/b][/black][/url] [maroon]ErrorReport[/maroon][red]([/red][red])[/red][red];[/red]
[tt]------------------------------------------------------------
Pragmas (perl 5.8.8) used :
[ul]
[li]strict - Perl pragma to restrict unsafe constructs[/li]
[/ul]
Other Modules used :
[ul]
[li]Win32[/li]
[li]Win32::process[/li]
[/ul]
[/tt]

- Miller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top