[英]Visual Studio - Read specified file on launch
I'm working with a simple program that has to read data from a txt file and than display it. 我正在使用一个简单的程序,该程序必须从txt文件读取数据并显示它。 The thing is that i would like to read a specified extension files (for example .log) automatically.
问题是我想自动读取指定的扩展名文件(例如.log)。
So, i would like to do it as a simple Windows user - double click file and than the program opens. 因此,我想以简单的Windows用户的身份进行操作-双击文件,然后打开程序。 The problem is that this program is working but it's nor loading the file on start and tbh i have no idea if I should program it somehow?
问题是该程序正在运行,但是它也没有在启动和加载时加载文件,我不知道是否应该以某种方式对其进行编程? Any hints?
有什么提示吗?
Thanks! 谢谢!
Sound like you want to associate file type with your application. 听起来好像您想将文件类型与应用程序关联。 This is done via windows registers.
这是通过Windows寄存器完成的。 Try for example this article http://msdn.microsoft.com/en-us/library/windows/desktop/hh127451(v=vs.85).aspx
例如,尝试使用本文http://msdn.microsoft.com/zh-cn/library/windows/desktop/hh127451(v=vs.85).aspx
The easiest way to make it load the file automatically is to allow it accept the file path as a parameter and then do a load operation. 使它自动加载文件的最简单方法是允许它接受文件路径作为参数,然后执行加载操作。 As for having your program open automatically when a user double clicks on that file type I would recommend checking out this CodeProject
至于当用户双击该文件类型时自动打开程序,我建议您检查一下此CodeProject
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.