470,811 Members | 1,327 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

Win32::Process, console & threads

Hi all ,

I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform some action.

The java call looks like this:

Expand|Select|Wrap|Line Numbers
  1. Win32::SetChildShowWindow(0);
  3. Win32::Process::Create(
  4.     $ProcessObj,
  5.     $javaExe,
  6.     $commandArgs,
  7.     0,
  8.     Win32::Process::NORMAL_PRIORITY_CLASS|Win32::Process::CREATE_NO_WINDOW,
  9.     $installPath
  10. ) or $retCode = -9;
The point of SetChildShowWindow(0) and CREATE_NO_WINDOW is to hide the console window that perl usually displays when creating new process.

This worked fine until I tried to run the same code inside a thread.

I now have a perl module JavaCall.pm with "static" subs calling the java classes.
My perl service starts a thread each time it needs to call java (if the java process is not started inside a thread, the perl service does not get the shutdown event until the java process finishes).

So I have something like this:

Expand|Select|Wrap|Line Numbers
  1. sub Callback_Running {
  2.     $runningThread = threads->new(\&startProcess, $installPath, $executePath, $configFile, $parser, $logger, $configref, $Context);
  3.     $runningThread->detach();
  4. }
  6. sub startProcess {
  7.     JavaCall->callJavaClass(...);
  8. }

Expand|Select|Wrap|Line Numbers
  1. Win32::SetChildShowWindow(0);
  2. Win32::Process::Create(
  3.     $ProcessObj,
  4.     $javaExe,
  5.     $commandArgs,
  6.     0,
  7.     Win32::Process::NORMAL_PRIORITY_CLASS|Win32::Process::CREATE_NO_WINDOW,
  8.     $installPath
  9. ) or $retCode = -9;
And here is the mistery: This works perfect under my Windows XP SP2 Profesional Edition, English. But the console "cmd.exe" shows up on a Windows XP SP2 Home Edition, French.
I do not know yet if this problem is specific to Home or French edition.

This app is distributed on users PC and I cannot have that window showing up.
Any help greatly appreciated.

May 15 '07 #1
0 2224

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Richard Shea | last post: by
1 post views Thread by RL | last post: by
1 post views Thread by rob | last post: by
2 posts views Thread by Paolo | last post: by
3 posts views Thread by =?Utf-8?B?cm9iaW50dw==?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.