我是C#的新手。以下是我的问题。 我创建了一个运行并驻留在系统托盘中的应用程序。当用户点击链接时,它会使用参数调用应用程序.. [exp:] c:\ ... \ TrayApp.exe%1。 问题是我们点击的次数是多少次,我们创建了n个实例。要求是第一次点击它应该创建实例,后来点击应该使用相同的实例,即使我们调用.exe 这是否可以在c#中实现。? 请帮忙。 我尝试过的事情: 我在CodeProject中尝试过互斥锁和其他示例,但它们都限制创建实例但不调用现有实例中的方法。 我们可以使用Process获取实例吗?不确定。
I'm pretty novice to C#. Below is my problem. I have created an application that runs and resides in systray. When user clicks a link it invokes the application with parameters.. [exp:] c:\...\TrayApp.exe %1. The problem is the n number of times we click, we have n instances created. Requirement is on the first click it should create the instance, later clicks should use the same instance even though we call the .exe Is this achievable in c#.? Kindly help. What I have tried: I've tried mutex and other examples in CodeProject, but they all restrict creating instances but do not call a method in the existing instance. Can we get the instance using Process ? Not sure.
推荐答案Codeproject上有一两篇关于它的文章! C#中的单实例应用程序 [ ^ ] WPF单实例应用程序 [ ^ ] 具有从系统托盘还原能力的C#单实例应用程序(使用互斥锁) [ ^ ] 单一实例应用程序 [ ^ ] There is an article or two about that here on Codeproject! Single Instance Application in C#[^] WPF Single Instance Application[^] C# Single Instance App With the Ability To Restore From System Tray (Using Mutex)[^] Single Instance Application[^]
更多推荐
如何在C#中传递应用程序的单例/单个实例的参数?
发布评论