473,395 Members | 1,574 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,395 software developers and data experts.

Passing command-line arguments to another instance

I have made my app single-instance using a Mutex but now need to pass on the
command line parameters too. I tried using remoting but wasn't happy with
this approach as the windows firewall asks if I want to permit it to open
the socket.

I was thinking maybe there was a simple WinApi way of sending a string to
the existing instance? Any help appreciated, it's quite a vital part of my
app's functionality :-)
Thanks
Pete

Jul 8 '08 #1
5 1752
If you had remoting code that was "nearly there", try changing it to use
IPC:

http://weblogs.asp.net/israelio/arch...04/346180.aspx

Marc
Jul 8 '08 #2
I saw something similar and tried ICP but used the tcp:// prefix, I will try
this, thanks!
Jul 8 '08 #3
Peter Morris wrote:
I have made my app single-instance using a Mutex but now need to pass
on the command line parameters too. I tried using remoting but
wasn't happy with this approach as the windows firewall asks if I
want to permit it to open the socket.

I was thinking maybe there was a simple WinApi way of sending a
string to the existing instance? Any help appreciated, it's quite a
vital part of my app's functionality :-)
You could use a mailslot or pipe instead of a mutex, then you can pass data
through it (i.e. TransactNamedPipe).
>

Thanks
Pete

Jul 8 '08 #4
It seems that I was originally just using the IpcChannel incorrectly, the
URL helped me to realise this, thanks!

http://mrpmorris.blogspot.com/2008/0...plication.html
Pete

Jul 8 '08 #5
Not sure if you still care, but I just saw this:

http://www.hanselman.com/blog/TheWee...lBasicdll.aspx

It may not be exactly what you want, though. It is almost certainly
way easier than using a Mutex and such, though.

Kyle

On Jul 8, 8:01*am, "Peter Morris" <mrpmorri...@SPAMgmail.comwrote:
I have made my appsingle-instanceusing a Mutex but now need to pass on the
command line parameters too. *I tried using remoting but wasn't happy with
this approach as the windows firewall asks if I want to permit it to open
the socket.

I was thinking maybe there was a simple WinApi way of sending a string to
the existinginstance? *Any help appreciated, it's quite a vital part ofmy
app's functionality :-)

Thanks

Pete
Aug 5 '08 #6

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

Similar topics

2
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures...
3
by: whatduck | last post by:
I'm having trouble passing a variable that contains spaces. If the variable contains a space I get the following error: "Application uses a value of the wrong type for the current operation." ...
2
by: Bob | last post by:
I'm new to Access projects and SQL server and am not a veteran VB programmer. There's a cry for help! I'm attempting to print the current form on screen by using a command button which the user...
11
by: Arsen Vladimirskiy | last post by:
Hello, If I have a few simple classes to represent Entities such as Customers and Orders. What is the proper way to pass information to the Data Access Layer? 1) Pass the actual ENTITY to...
1
by: Mike | last post by:
Hello, How do I pass variables to a command text.(C#)Because of the quotes,it seems that the values are not passed. Thanks, Mike
3
by: Andrew Banks | last post by:
I'm using guid to generate primary keys for my SQL server DB I'm now trying to query the DB but keep getting errors. It seems to be erroring when passing the ID and it's always around a hyphen in...
4
by: shade73 | last post by:
Hey all. I currently have two seperate namespaces and I'm trying to pass a connection around to them. I want to use the same connection & leave it open for 6 methods & then close it. However, all...
2
by: | last post by:
I want to know how to make a clickable button or Command field on a GridView, and have the user's action a) fire a function and b) pass a data value from one of the GridView's columns to that...
9
by: orenr | last post by:
Hi We have a web site for 100 users using SQL Server. In our DAL all the selections when we need to pass parameters are using the SqlCommand and they are something like: SqlCommand com = new...
2
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
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...

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.