如何将文件从资源管理器打开到不同的选项卡
如何将文件从资源管理器打开到不同的选项卡中。 我可以将打开菜单与文件类型相关联,现在当我已经让程序运行时,如何将新文件打开到另一个选项卡,而不是新程序。 如何准确找到已经运行的进程,而不是使用名称并将文件名发送给它。
让我说清楚:我希望我的应用程序是单实例,这样当用户选择 10 个文本文件并按 Enter 键时,我的应用程序会将所有 10 个文本文件打开到 10 个选项卡中,而不是创建 10 个进程。 怎么做? 如何在同一进程的各个实例之间进行通信。
编辑已解决:使用 C# 中的 WM_COPYDATA 和 codeproject 中的 SingleApplication 类实现了功能。
How to open files from explorer into different tabs. I can associate an open with menu with the file type, now when I already have the program working, how to open the new file into another tab, instead of new program.
How to find the already running process exactly, not with the name and send the filename to it.
Let me make myself clear: I want my app to be single instance, so that when user select 10 text files and press enter key, my application will open all the 10 text files into 10 tabs, instead of creating 10 processes. How to do that? How to communicate between various instances of the same process.
EDIT SOLVED: Implemented the functionality using WM_COPYDATA in C# and the SingleApplication class from codeproject.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太清楚你这个问题的意思。 您是否正在尝试将 Windows 资源管理器窗口打开为一个带有选项卡的窗口? 如果是这种情况,那么我建议您查看 QT TabBar,它扩展了 Windows 资源管理器以允许此类操作行为。
或者您可能正在尝试在网络浏览器中打开指向新选项卡的链接。 如果是这种情况,则此行为由 Web 浏览器本身定义。 对于 Internet Explorer 7,您可以在工具 > 下设置此行为。 互联网选项。
在“常规”选项卡中,单击“选项卡”部分旁边的“设置”按钮。 您需要设置“打开来自其他程序的链接:”选项以打开新选项卡。
请记住,此行为是由每个用户定义的,您无法保证他们将具有与您相同的浏览器设置。
看完你的评论,我想我明白了一些。 听起来您希望您的应用程序一次只允许一个实例。 由于您将这篇文章标记为 C#,我将假设您正在编写程序。Codeproject.com
有一个很棒的 教程,介绍如何使您的程序仅允许单个实例。
以下是他们网站上的一段代码:
您可能需要在 return 语句之前编写代码,以使现有实例在新选项卡中打开文件。
如果您能够提供有关您的程序正在执行的操作的详细信息,我们也许可以帮助您解决一些具体问题。
I am not quite sure what you mean in this question. Are you trying to open Windows Explorer windows into one window with tabs? If that is the case, then I recommend you look into QT TabBar, which extends Windows Explorer to allow for such behavior.
Or perhaps you are trying to have a link open to a new tab in a web browser. If that is the case, this behavior is defined by the web browser itself. For Internet Explorer 7, you can set this behavior under Tools > Internet Options.
In the General tab, click the Settings button next to the "Tabs" section. You will want to set the "Open links from other programs in:" option to open a new tab.
Keep in mind that this behavior is defined by each user, and you can't ever make any guarantees that they will have the same browser settings as you do.
After reading your comments, I think I understand a bit better. It sounds like you want your application to only allow one instance at a time. Since you tagged this post C#, I will assume that is what you are writing your program in.
Codeproject.com has a great tutorial on how to make your program only allow a single instance.
Here is a snippet of code from their site:
You would want to write code just before the return statement to have the existing instance open the file in a new tab.
If you are able to provide detailed information about what your program is doing, we might be able to help you with some of the specifics.