使用我的应用程序打开窗口
我编写了一个应用程序,它将能够打开特定扩展名的文件并将其显示给用户。现在我希望用户只需双击该文件即可使用我的应用程序将其打开。我尝试在Windows“打开方式”对话框中设置“始终使用所选程序...”选项,但不知道如何接收Windows发送到我的应用程序的文件名。如何做到这一点?
谢谢...
I wrote an application which will be able to open files of particular extension and show it to users. Now I want the users to be able to just double click the file and have it open with my application. I tried to set the "Always use the selected program..." option in the windows "Open With" dialog box, but do not know how to receive the file name that Windows sends to my application. How to do this?
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
文件名将作为参数传递给您的应用程序。
例如,在 c# 中,您将得到这样的结果:
The file name will be passed to your application as an argument.
For example, in c#, you will get it like this:
如果我理解得很好,你需要这样的东西:
所以,你需要在你的应用程序中做出一个可选的参数。如果存在,则打开该文件。如果没有,请打开一个新文件。
If I understood well, you need something like:
So, you need to make an optional argument in your application. If it exists open the file. If not, open a new file.
您应该在应用程序的启动参数中收到文件名
You should receive the filename in your application's startup parameters
Windows 将文件名作为启动参数传递给您的应用程序。您需要在 WinMain 或应用程序入口点中处理此问题。
Windows passes the filename as a startup parameter to your application. You will need to handle this in your WinMain or application entry point.