Connecting teamviewer in code via browser link

2019-04-10 00:19发布

I have an issue that's driving me mad. I have successfully been able to connect my teamviewer session from a browser uri to my required remote resource. I achieve this by using the following uri command in the browser address bar (in reality, it's a button click in html):

  • teamviewer8://remotecontrol?connectcc=123456789

Although this connects perfectly as required, it presents an issue that I need to address.

The problem

If the connection isn't yet open, the teamviewer session is initiated and the window pops up in my second monitor as required. All good. However, if the session is already running and I initiate a subsequent request to the same uri, a new session is spawned and I'm left with multiple, duplicate session windows. This is both resource hungry in the long run and undesirable in practice.

My ideal solution

Ideally, I'd like the process to function such that a new session is called if it does not have the given id already running. If an earlier session with that Id is running, than I'd like to find a way to bring that into focus, rather than having teamviewer new up a new session.

What I already know

I know that this is possible as the teamviewer console does just this if you attempt to initiate a second session against an already running id. Using the teamviewer console is not an option as I've developed a web based desktop solution that requires the sessions to be kicked off via button clicks inside the UI (the id's are stored in my own db).

The app that I have created has the potential to literally open hundreds of duplicate windows as I'm looking at many processes across a small range of id's over a concentrated period of time, thus a solution is urgently required.

The bottom line

Is it possible to add a parameter to the uri to tell teamviewer not to create a new session. Is there a simple switch that I'm missing that will address the issue??

Thanks for reading...

[edit] - although unlikely to have any bearing on things, I'm using asp.net mvc for the application. I add this info as it could well be that the http pipeline is adding/cacheing something that teamviewer interprets as being a uniq identifier.

[Update]

After careful consideration and fruitless searching, I decided to create my own proxy application and register it with a protocol of my own choosing. This proxy app is called with the same parameters as the teamviewer protocol, i,e, arb://remotecontrol?connectcc=123456789. My little app has an internal dictionary and does a search against window titles into the dictionary. if it finds a match, it brings the window into focus, if it doesn't, it does a Process.Start() using the teamviewer protocol and then adds the data to the dictionary. there are some other checks too, but this works fine so far.

I used these links for initial inspiration:

Hope this helps anyone else out there that needs to workaround this kind of scenario in whatever situation demands it.

0条回答
登录 后发表回答