473,611 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing arguments to running programs

I am developing a command line program which needs to get information
from command line switches every now and then. So instead of starting
a new instance when the program is executed, it will pass an event or
message to the already running program telling it what it would do.

For example:

First program.exe is executed and the program is started. Then we run
program.exe /cleardatabase and the running process receives this
request and acts accordingly.

I know this is probably basic stuff but I have been unable to find any
tutorials on this matter..
Nov 16 '05 #1
1 2153
Dan,

Hm. I'd probably use a named Mutex to determine whether I'm the first
instance running or not. If I'm the first instance, I become a remoting
server. Subsequent instances will become clients of that server. You could
then expose server methods that can be called to pass in requests.

The devil would be in the details, but it should be doable.

--Bob

"Dan Nilsson" <da*********@ok tv.se> wrote in message
news:80******** *************** ***@posting.goo gle.com...
I am developing a command line program which needs to get information
from command line switches every now and then. So instead of starting
a new instance when the program is executed, it will pass an event or
message to the already running program telling it what it would do.

For example:

First program.exe is executed and the program is started. Then we run
program.exe /cleardatabase and the running process receives this
request and acts accordingly.

I know this is probably basic stuff but I have been unable to find any
tutorials on this matter..

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
14925
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
39
7630
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down indicate: a) That I don't know enough b) Passing arguments by ref is bad
0
981
by: hebetude | last post by:
I use .NET and have found the famed Command Arguments tab, but it does not pass just standard arguments. I'm trying to pass two simple arguments: fcfs filename.txt yet it gives me two errors without even attempting to use the argument variables: c:\Documents and Settings\Drew\My Documents\My Programs\Heap\students.txt error C2059: syntax error : 'constant'
0
758
by: hebetude | last post by:
I've set up my int main function correctly and the three arguments are passed correctly, but every OTHER time I compile the program it gives me the following errors: Heap fatal error C1083: Cannot open source file: 'fcfs': No such file or directory c:\Documents and Settings\Drew\My Documents\My Programs\Heap\students.txt error C2059: syntax error : 'constant' The debugger is setup in such a way as the filename is passed in the
2
2565
by: Colmag | last post by:
I'm running a console application (ghostscript) by starting it as a process with arguments. The problem i'm having is that it's falling over when I pass a file containing spaces in the filename or filepath. Anyone know how to get around this? (i've tried putting the file in quotes, but it doesn't seem to work e.g. -sPDFname#"filename")
26
2814
by: Martin Jørgensen | last post by:
Hi, I'm learning C-programming. I have a program which I would like to modify so it takes arguments from the commandline. Let call the program: program.exe. Could somebody shortly explain how I get this behaviour: C:>program -help or C:>program -h printf("\nBla. bla. Here is some help and arguments\n").... etc.
10
13006
by: Janus | last post by:
Hi, Is there a way to pass arguments to the callback function used inside an addEventListener? I see that I can only list the name of the callback function. For eg, I use this: var boldLink=document.getElementById('cmtbold');
4
13597
by: phoolpreet | last post by:
hi guys i m stuck with the problem of passing arguments to main. we can define argc and argv and put statements in main that use these arguments. but how to set these value while running a programme. how to pass value to main. i m using linux g plus plus compiler.
2
4239
by: william.w.oneill | last post by:
I have an application that takes a few command line parameters. As recommended by others in this group, I'm using a named mutex to ensure that only one instance of the application is running. My question is how to elegantly pass a command line parameter from Instance_B to Instance_A where Instance_A was running prior to Instance_B. For example, the user can launch the program by passing a file name as a command line argument. The program...
0
8097
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
8561
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...
1
8240
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8411
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
7038
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
4042
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
4108
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2546
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.