views:

15

answers:

2

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.

A: 

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?

Factor Mystic
Like i said im not doing anything with the arguments yet. I already tested to get them with string[] = Environment.GetCommandLineArgs(); The result is like expected when i start from same folder (shows filenames) , but cant get anything when starting from different folder. Cant debug this either.
SubZero
A: 

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)

SubZero