在c#中从第二个实例向第一个实例添加项

编程入门 行业动态 更新时间:2024-10-20 07:38:42
本文介绍了在c#中从第二个实例向第一个实例添加项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的所有人! 我有一个带有列表框的Windows表单应用程序。此列表框中的第一项是参数(例如:application.exe c:\test.pdf)。现在我想添加更多项目,当我用Argument打开我的应用程序的下一个实例时。如果项目已添加到列表框中,则第二个实例必须为关闭。你能发帖,我怎样才能在c#中实现它?任何人都可以帮助解决一个片段吗? 非常感谢! Greetz HHubi2

Dear All! I have a Windows form application with a listbox. The first item in this listbox comes in an Argument (Example: "application.exe c:\test.pdf"). Now i would like to add further items, when i open up next instance of my application with Argument. And the second instance have to be Close, if the item was added to the listbox. Can you post, how i can realize it in c#? Can anybody help with a snippet? Thanks so much! Greetz HHubi2

推荐答案

请参阅我过去关于流程实例与单个实例检测之间通信的答案: 仅向一个流程实例输入多个命令 [ ^ ], 自定义Windows右键单击命令启动多个实例 [ ^ ]。 作为发送文件名的最合适的机制s到第一个实例只是命令行,另请参阅我关于此主题的文章:枚举基于命令行实用程序 [ ^ ]。 我的实用程序是最容易使用的,但我也建议在文章中使用更复杂和更全面的实用程序。
-SA
Please see my past answer on communications between process instances and detection of single instance: Enter multiple commands to only one process instance[^], Custom Windows right-click command launching multiple instances[^]. As the most adequate mechanism for sending the file names to the first instance is just the command line, see also my article on this topic: Enumeration-based Command Line Utility[^]. My utility is the easiest to use, but I also recommend more complex and comprehensive one in the article.
—SA

更多推荐

在c#中从第二个实例向第一个实例添加项

本文发布于:2023-11-16 14:30:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605132.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实例   第一个   第二个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!