473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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);
  2.  
  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;
  11.  
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:

perlservice.pl:
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. }
  5.  
  6. sub startProcess {
  7.     JavaCall->callJavaClass(...);
  8. }
  9.  
JavaCall.pm:

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;
  10.  
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.

Jerome
May 15 '07 #1
0 2412

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

Similar topics

2
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...
1
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......
1
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)...
2
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 "....
0
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...
17
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...
3
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, ...
2
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...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.