First Question:
OK, I know how to make a simple file association with the registry.
What I can't figure out is how do I fetch multiple files. So far I
managed to add to the context menu an "Add to my app" menu item and
associated it with some video formats. Now, if I select 1 video format
and click the "Add to my app" my app opens correctly and adds the name
in the list. What I can't do is select more than 1 .avi files and do
the same thing. When I attempt to, a "Windows Move file to folder"
dialog appears twice (?!) for each file I choose.
This is what I add to the registry:
Key: HKEY_CLASSES_ROOT\.avi\shell\addToMyApp\Command
Value: "pathToMyApp" "%1"
and this is the code at load:
Private Sub main_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If (Environment.GetCommandLineArgs.Length 1) Then
MsgBox(Environment.GetCommandLineArgs.GetValue(1))
For i As Integer = 1 To
Environment.GetCommandLineArgs().Length - 1
lstFiles.Items.Add(Environment.GetCommandLineArgs. GetValue(i), True)
Next
End If
End Sub
Second Question
I'm looking all over the internet to find out what the hell is the %1
placeholder. I learned some things about %1 %2 etc. but didn't find a
good explanation and example. I once also found an %L placeholder.
What is the difference..? How many % are there..?
Third Question
This is more like a registry hack question. If windows doesn't
recognize a filetype and you double-click it, it will pop up a window
asking you what program to associate to. If you choose to always open
it with that program windows adds the following to the registry:
(assuming associating .foo extension with bar app)
Key: HKEY_CLASSES_ROOT\.foo
Value: barfile
Key: HKEY_CLASSES_ROOT\barfile\shell
Value: open
Key: HKEY_CLASSES_ROOT\barfile\shell\open\command
Value: "PathToApp" "%1"
Now, because HKEY_CLASSES_ROOT\.foo default value is barfile anything
you create under shell for additional context menu items renders them
useless. If you simply remove the default value everything works
normal but the file association is gone.
So my question is, how can you make both work..?