资源管理器上下文菜单输入问题
我在我的应用程序中使用 MVVM Light Toolkit。虽然我不知道我的问题是否与此有关。 我为 Win7 32 位上的 Windows 资源管理器添加了一个上下文菜单条目。
它看起来像这样:
[HKEY_CLASSES_ROOT\*\shell\MyEntry]
[HKEY_CLASSES_ROOT\*\shell\MyEntry\command] "MyPath+MyExe" "%1"
现在,如果我从 myExe 所在的文件夹中打开一个文件,一切都会正常工作,但是如果我尝试从另一个文件夹中打开一个文件,我的应用程序会立即崩溃。
我希望有人能在那里帮助我。
编辑:我还没有对我的应用程序中的启动参数执行任何操作。
I'm using the MVVM Light Toolkit in my App. Though I don't know if my problem is related to it.
I have added a ContextMenu Entry for the Windows Explorer on Win7 32bit.
It looks like this:
[HKEY_CLASSES_ROOT\*\shell\MyEntry]
[HKEY_CLASSES_ROOT\*\shell\MyEntry\command] "MyPath+MyExe" "%1"
Now if I open a file from the Folder where myExe is all works like it should, but if I try to open a file from a different Folder my App crashes instantly.
I hope someone can help me there.
Edit: I'm not doing anything with the start arguments in my app yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的应用程序在您从任何地方单击上下文菜单项时启动,那么这不是您的注册表项的问题,而是您的应用程序的问题。
检查你的假设。您是否假设该文件与应用程序位于同一目录中?
If your application is being lauched when you click the context menu item from anywhere, then it's not an issue with the your registry key, it's an issue with your application.
Check your assumptions. Are you assuming the file is in the same directory as the application?
嗯,你是对的:)
我正在 VM 构造函数中从 xml 加载数据。
XML 文件位于应用程序文件夹的子文件夹中。
我在程序开始时使用了Environment.CurrentDirectory来获取ApplicationFolder,尽管当我将CommandLineArguments从其他文件夹传递到我的应用程序时,当前目录发生了变化,因此我的应用程序崩溃了,因为缺乏正确的错误处理(我没有传递异常)任何地方)我没有注意到这是问题所在。
再次感谢您将我推向正确的方向。
(顺便说一句,我从 MSDN 论坛得到了错误的代码,下次我也应该考虑签入该库)
Well you were right :)
I was loading my data from xml in the VM Constructor.
The XML file is located in a subfolder of the application folder.
I used Environment.CurrentDirectory to get the ApplicationFolder at the start of my prog, though when i passed CommandLineArguments from an other folder to my app the current directory changed so my app chrashed, due to the lack of correct errorhandling (i didnt passed the exception anywhere) i didn't notice that this was the problem.
Thx again that you pushed me in the right direction.
(btw. i got the wrong code from the MSDN forum, i should think about checkin the library too next time)