473,396 Members | 2,010 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,396 software developers and data experts.

pass arguments to existing instance

My app is a single-instance one. When a second instance is executed I need
to pass the startup arguments to the existing instance. Can anyone
recommend a good approach for this? I tried the single-instance application
approach in the VisualBasic DLL but for some reason it was crashing on
another development machine stating that an API was unavailable. So I would
like to try an entirely different approach, one with full source code so
that I can fix it if it breaks :-)
Thanks
Pete
Jun 27 '08 #1
6 2272
On Thu, 05 Jun 2008 01:22:28 -0700, Peter Morris <mrpmorris at gmail dot
<"com>"wrote:
My app is a single-instance one. When a second instance is executed I
need
to pass the startup arguments to the existing instance.
See "inter-process communications" techniques. On .NET, network i/o (e.g.
Socket class, remoting, etc.) and possibly named pipes (I read that the
latest version of .NET has some support for that, but have no first-hand
experience) are the most likely candidates. Shared memory would also work
for unmanaged code.

Without knowing exactly what example you were trying to use before, it's
not really possible to tell you for sure what an _alternative_ might be.

Pete
Jun 27 '08 #2
My brain was stuck in Win32 (creating global atoms etc), thanks for
reminding me about remoting :-)

Without knowing exactly what example you were trying to use before, it's
not really possible to tell you for sure what an _alternative_ might be.
There's some single-instance application stuff in
Microsoft.VisualBasic.dll - I've hunted this URL down...
http://blogs.msdn.com/pedrosilva/arc...09/391381.aspx
Jun 27 '08 #3
On Thu, 05 Jun 2008 13:28:02 -0700, Peter Morris <mrpmorris at gmail dot
<"com>"wrote:
[...]
There's some single-instance application stuff in
Microsoft.VisualBasic.dll - I've hunted this URL down...

http://blogs.msdn.com/pedrosilva/arc...09/391381.aspx
Ahh. Well, yes...that looks to me like it didn't show up until .NET 2.0.
You would have trouble getting it to run on .NET 1.1. :)

But maybe requiring .NET 2.0 or later is okay. 1.1 was a _long_ time
ago. :) The VB support for this looks reasonably convenient, especially
since it provides that StartupNextInstanceEvent for passing the command
line to the running instance. Unless you really really must run on 1.1,
that might be the best way to go (assuming it works otherwise...I have no
experience with it, so I don't know whether it has other problems you
might run into, though I don't know why it would).

Pete
Jun 27 '08 #4
Ahh. Well, yes...that looks to me like it didn't show up until .NET 2.0.
You would have trouble getting it to run on .NET 1.1. :)
I forgot to mention, this is .NET 2 :-)

For some reason there is one machine that crashes with an unsupported API
error when this VB class tries to execute, even though it is WinXP, the same
as my development machine. I intend to look into using remoting instead.

Pete
Jun 27 '08 #5
On Fri, 06 Jun 2008 01:17:28 -0700, Peter Morris <mrpmorris at gmail dot
<"com>"wrote:
For some reason there is one machine that crashes with an unsupported API
error when this VB class tries to execute, even though it is WinXP, the
same
as my development machine. I intend to look into using remoting instead.
Suit yourself. Personally, I'd look into why that one computer is broken,
rather than reworking your entire development strategy around that one
computer's shortcomings.

But I suppose if that's THE one computer you need the program to run one,
either way is fine. :)

Pete
Jun 27 '08 #6
Suit yourself. Personally, I'd look into why that one computer is broken,
rather than reworking your entire development strategy around that one
computer's shortcomings.
It's more about control. If there is something in there that is broken then
I need to fix it and cannot, whereas if I write something myself I have full
control and can do what I like :-)

Besides, I've delegated the job to someone else whist I rewrite the website
in ASP MVC :-)
Pete
-----
I use Enterprise Core Objects (Domain driven design)
http://www.capableobjects.com/
Jun 27 '08 #7

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

Similar topics

66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
9
by: timothy.williams | last post by:
Hi. I trying to write an extension module to call some C libraries so I can use them in Python. Several of the library functions pass pointers to structures as arguments. I was thinking that I...
41
by: Berk Birand | last post by:
Hi, I am just learning about the array/pointer duality in C/C++. I couldn't help wondering, is there a way to pass an array by value? It seems like the only way to do is to pass it by...
38
by: Radde | last post by:
HI all, Whats the difference b/w pass by ref and pass by pointer in C++ when ur passing objects as args.. Cheers..
1
by: Clinton Pierce | last post by:
I've got a class that I want to access remotely. The touble is, I can't figure out how to call the constructor of the class with arguments -- and the arguments are necessary to initialize the...
9
by: Csaba Gabor | last post by:
Inside a function, I'd like to know the call stack. By this I mean that I'd like to know the function that called this one, that one's caller and so on. So I thought to do: <script...
3
by: Ronald S. Cook | last post by:
I want to something as simple as: UserControl uctTemp; But the type will be passed in to the function (which will be an existing user control like "uctMyUserControl1") So, how can I pass in...
2
by: pamela fluente | last post by:
I have an application running. A file type is registered with this application. When the user click on a file of such type a new instance of the application is loaded with command line (file name)....
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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,...
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...
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.