472,952 Members | 2,231 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

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 2384

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

Similar topics

by: Richard Shea | last post by:
Hi - I wondered if anyone had done this before and could provide some suggestions ? I'm interested in supplying extra functionality to a Win32 Console (cmd.exe) - full description below for those...
by: RL | last post by:
Hi all, I am new and am lost with Win32::Process stuff. I want on perl script to start a process, then another perl script to terminate the same process. I can start a process using......
by: rob | last post by:
I created some Perl scripts on Win32 platform, and now I want to support the same for Linux. What are the equivalents for: 1) use Win32::Process; 2) use Win32::Process::Info; 3)...
by: Paolo | last post by:
There is something I can't understand which is the following. I have a system command which runs a commandline to unzip a file: my $Out = system ( $rootPath."bin/bin/gunzip -dfc "....
by: smanzel | last post by:
When I attempt to open a new project in Visual studio and I select the Win32 Console Project icon the Win32 Console Application window pops up. However there is nothing in the window. There is...
by: asearle | last post by:
Hallo everyone, After playing around with 'fork' in order to try to get a one process to monitor another, I have changed my tack and switched to Win32::Process. Indeed, it looks like this...
by: jbenezech | last post by:
Hi All, I have a perl script which starts a java process using Win32::Process. Here is the code to start the java proces: Win32::Process::Create($ProcessObj, ...
by: SheetalGandhi24 | last post by:
Hi I need to use the System.IO namespace in the Win32 console application. Any clues for doing the same? Basically, I need to load the files of a particular folder in an array. I need to do...
by: =?Utf-8?B?cm9iaW50dw==?= | last post by:
Hi, While debugging my application I have noticed that occasionally a message saying "Win32 Thread xxxx exited with code 0 (0x0)" appearing in the debug window. I investigated this some more and...
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.