views:

281

answers:

2

Hi,

When we save a level in our editor, we create a log file of any errors it contains. These consist basically of an error message and a path that allows the user to find the erronous item in a tree view.

What I want is to make that path a link, something like < a href="editor://path/to/gameobject" > Click to see object in editor< /a >

The SO questions I've seen regarding this seems to point to this msdn page: http://msdn.microsoft.com/en-us/library/aa767914.aspx

But from what I can tell, it will spawn a new instance of the application. What I want to do is to simply "call" our editor somehow. One way to do it, I guess, is to spawn it, and in the beginning check if there's already an instance running, and if so, send the commandline to it.

Is that the best way to do it? If so, any ideas on how to do it best? What are otherwise some ways that this could be done?

Also: does the msdn solution work across browsers? Our editor runs in Windows only, but people use IE, Fx, GC and Opera.

--Update--
I posted some more information on how I did it on my blog:
http://anderselfgren.blogspot.com/2009/05/communicating-with-c-application-from.html

+1  A: 

Sounds like you solved it already, by checking for a previous instance.

I would be surprised if the OS takes upon it to somehow "stamp" the association with data telling it to separate programs that should run multiple times from programs that should not.

unwind
Make you application check for a previous instance if available and pass on the command line.
Stevo3000
+2  A: 

If you need the link to work in any viewer, yes, registering a protocol handler is the best way.

As for launching the editor, you could implement it as an out-of-process COM server, but if you've already got command line parsing sorted, you might as well use a window message or named pipe to pass that to the editor. If you're sending a window message, you could use FindWindow (with a unique class name) to check for a running instance.

Mark