需要有关文件关联的帮助 [英] Need help with file associations

查看:123
本文介绍了需要有关文件关联的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以..我有一个文件关联".snippt",双击该关联将实例化我的应用程序的新窗口,并将参数加载到应用程序中.但是,如果单击另一个文件,我希望它将参数传递给已经运行的应用程序并将这些参数加载到应用程序中.然后终止新窗口.

就像您有媒体播放器,然后双击.mp3一样,它将把该mp3加载到播放列表中,而不会打开新窗口.

谢谢:)

So .. I have I file association ".snippt" which when double clicked will instantiate a new window of my application, and load the arguments into the app. However if click another file I want it to pass the arguments to the already running application and load these arguments into the app. Then terminate the new window.

It is just like if you have a media player and you double click a .mp3 it will load that mp3 to your playlist and NOT open up a new window.

Thanks :)

推荐答案

Windows始终启动一个程序的新实例来处理此问题,因此您必须检查您的应用程序实例是否已准备就绪. br/> 如果是的话,那么您需要与它交谈并将参数传递过去.

您可以很容易地找到控制并将其切换到现有实例: .NET中的进程间通信使用命名管道,第1部分 [
Windows allways starts a new instance of a program to handle this, so you have to check if an instance of your app is all ready running.
If it is, then you need to talk to it and pass the arguments over.

You can find and switch control to an existing instance quite easily: A simple way to ensure only one instance is running.[^] will show you how.

Passing your parameters over is a bit harder...
Pipes are probably the easiest way: Inter-Process Communication in .NET Using Named Pipes, Part 1[^] It may seem a litle overkill, but the sample is pretty simple.


这篇关于需要有关文件关联的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆