473,729 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Win32::Process, console & threads

3 New Member
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 SetChildShowWin dow(0) and CREATE_NO_WINDO W 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 2441

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

Similar topics

2
2126
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 interested. I would do this using Python. I'm having difficulty finding anything about Console based programming via MSDN - I just wondered if anyone had done anything like this or alternatively knew where the part of the Win32 API which deals...
1
4972
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... ------------------------------------------------------- use Win32::Process;
1
3846
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) Win32::FormatMessage TIA
2
6774
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 ". $SourceFilePath." > ".$rootPath.$DestinationPath.".txt"); This works fine. since I would like to make it parallel and run 4 processes at a time I wrote this code:
0
975
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 nothing for me to click on and clicking the Finish or the Help buttons produces nothing. Anyone have any ideas? Thanks.
17
6350
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 function will be able to do what I require: A: Start a windows application B: While that application is running regularly monitor a log file C: If the windows application falls over or locks up, then the monitor process will kill the job and close the...
3
10368
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, shift(@args), join(" ", @args), 0, Win32::Process::NORMAL_PRIORITY_CLASS|Win32::Process::CREATE_NO_WINDOW|Win32::Process::DETACHED_PROCESS, $installPath) or $retCode = 99;
2
3671
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 this in a VC++.NET Win32 console application. I am very new to using VC++. Can anyone please help? Thanks in anticipation,
3
1725
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 found that, according to the threads window, there were four Win32 threads in my program! I had no idea where these had come from, and was rather worried about what they were doing. I found that the threads were only there in programs that used...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.