简体   繁体   English

资源管理器ContextMenu条目问题

[英]Explorer ContextMenu Entry Problems

I'm using the MVVM Light Toolkit in my App. 我在我的应用程序中使用了MVVM Light Toolkit。 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. 我为Win7 32bit上的Windows资源管理器添加了一个ContextMenu条目。

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. 现在,如果我从myExe所在的文件夹中打开文件,则应能正常工作,但是,如果尝试从其他文件夹中打开文件,则我的应用程序立即崩溃。

I hope someone can help me there. 我希望有人可以在那里帮助我。

Edit: I'm not doing anything with the start arguments in my app yet. 编辑:我还没有对我的应用程序中的启动参数做任何事情。

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? 您是否假设文件与应用程序位于同一目录中?

Well you were right :) I was loading my data from xml in the VM Constructor. 好吧,您是对的:)我正在从VM构造函数中的xml加载数据。 The XML file is located in a subfolder of the application folder. XML文件位于应用程序文件夹的子文件夹中。 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. 我在编程开始时使用Environment.CurrentDirectory来获取ApplicationFolder,尽管当我从另一个文件夹将CommandLineArguments传递给我的应用程序时,当前目录已更改,因此由于缺少正确的错误处理,我的应用程序崩溃了(我没有传递异常)任何地方)我没有注意到这是问题所在。

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) (顺便说一句,我从MSDN论坛得到了错误的代码,下次我也应该考虑签入库)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM