File Association and other

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pek

    #1

    File Association and other

    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_RO OT\.avi\shell\a ddToMyApp\Comma nd
    Value: "pathToMyAp p" "%1"

    and this is the code at load:

    Private Sub main_Load(ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    If (Environment.Ge tCommandLineArg s.Length 1) Then
    MsgBox(Environm ent.GetCommandL ineArgs.GetValu e(1))
    For i As Integer = 1 To
    Environment.Get CommandLineArgs ().Length - 1

    lstFiles.Items. Add(Environment .GetCommandLine Args.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_RO OT\.foo
    Value: barfile

    Key: HKEY_CLASSES_RO OT\barfile\shel l
    Value: open

    Key: HKEY_CLASSES_RO OT\barfile\shel l\open\command
    Value: "PathToApp" "%1"

    Now, because HKEY_CLASSES_RO OT\.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..?

Working...