If I make a new file type for my program, how do I use “Open With” properly?

纵饮孤独 提交于 2020-01-24 19:23:07

问题


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?


回答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.



来源:https://stackoverflow.com/questions/433474/if-i-make-a-new-file-type-for-my-program-how-do-i-use-open-with-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!