如果我为我的程序创建一个新的文件类型,我该如何使用“打开方式”? 适当地?

发布于 2024-07-11 05:22:17 字数 163 浏览 7 评论 0原文

我做了一个程序。 我还创建了自己的文件类型,程序可以创建、打开和编辑该文件类型。 在资源管理器中,我右键单击这个新文件类型并选择“打开方式”并选择我的程序。 当然,它只是打开程序而不加载文件。

如何让我的程序知道它被请求在启动时打开文件? “打开方式”是否发送一些命令行参数?

I made a program. I also made my own file type, which the program can create, open, and edit. In Explorer, I right clicked on this new file type and selected "Open With" and chose my program. Of course, it just opens the program without loading the file.

How do I let my program know that it's being requested to open a file on startup? Is there some command line argument that "Open With" sends?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

触ぅ动初心 2024-07-18 05:22:17

是的,Windows 资源管理器将文件路径作为命令行参数发送到应用程序的可执行文件。

您可以在 C# 中使用 args[0] 或在 C++ 中使用 argv[1] 来读取它。

Yes, Windows Explorer sends the path of the file as the command line argument to the executable of your application.

You could use args[0] in C# or argv[1] in C++ to read it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文