471,348 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 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 2187
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

66 posts views Thread by Darren Dale | last post: by
9 posts views Thread by timothy.williams | last post: by
41 posts views Thread by Berk Birand | last post: by
38 posts views Thread by Radde | last post: by
1 post views Thread by Clinton Pierce | last post: by
9 posts views Thread by Csaba Gabor | last post: by
3 posts views Thread by Ronald S. Cook | last post: by

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.