Announcement

Collapse
No announcement yet.

File association (custom file types)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • File association (custom file types)

    Hello!

    I am running into a problem when using the code provided from this discussion.
    I see there in the function a parameter missing when calling Registry.SetValue:

    Code:
    function File.SetAssocation64(cExt, cExe, cIcon, cShort,cLong)
        -- Set the file association for the given file.
        Registry.SetValue(HKEY_CLASSES_ROOT, cExt, "", cKey);
        Registry.SetValue(HKEY_CLASSES_ROOT, cKey, "",cLong);
        Registry.SetValue(HKEY_CLASSES_ROOT, cKey.."\\DefaultIcon","",File.GetShortName(cIcon)..",0");
        Registry.SetValue(HKEY_CLASSES_ROOT, cKey.."\\shell\\open\\command", "", "\""..cExe.."\" \"%1\"");
    end

    Registry.SetValue takes 5 parameters, but the provided code from the discussion uses only 4. How can this code work with the missing parameter??

    Shouldn't be the TYPE given?


    My problem is, that I need to change the code for the WOW64 alternative for 64 bit OS.

    In this case I only have to add Wow64.KEY64 as 6th parameter. But in the original code above, a whole parameter is missing.... I don't know which one and I don't know how this code should even work.

    Thank you in advance!

  • #2
    Get Ulrich's wow64/registry plugin (off mindquake.com.br) and adjust the code as needed.

    Comment


    • #3
      Hi,

      yes, that is the Plug in I am using.
      But it does not work. And I think it is because the example is not correct.

      Ulrich's plug in takes 6 parameters. The standard SetValue needs 5 parameters.
      But the code example above sets only 4. So one parameter is missing in the example.
      My question is: How can this work?


      I think there is a mistake.

      Comment


      • #4
        Adapt it to your needs. His plugin does work.

        Comment


        • #5
          You don't get me.

          Have a look at this function:
          Code:
          Registry.SetValue(HKEY_CLASSES_ROOT, cExt, "", cKey);

          There, the type is missing as 5th parameter.
          I am asking, how the code should work when it is obviously not complete?

          Shouldn't it be:
          Code:
          Registry.SetValue(HKEY_CLASSES_ROOT, cExt, "", cKey, [B]REG_SZ[/B]);
          ??
          Last edited by AutoPlayUser; 10-01-2013, 06:47 AM.

          Comment


          • #6
            Oh, I get you -- you should rtfm...

            Code:
            Registry.SetValue ( 
             number MainKey,
            
            string SubKey,
            
            string Value,
            
            string Data,
            
            number Type = REG_SZ )
            I only see 4 required parameters.

            Comment


            • #7
              As you can see in my first post, I linked that reference to that function. So you can assume that I read it!
              The description is not clear. I see 5 parameters with no "optional" hint. Sth. like "default = REG_SZ when missing" should be the correct form!

              Comment


              • #8
                t'is pretty standard documentation to indicate an optional value. Did you try the code? So far it seems that you are wanting there to be a problem ... telling me there's a problem with my code, but then referencing something unrelated (your need for wow redirection or not); but not telling me what, exactly, is the problem you have with my code, isn't a smooth path to finding you a resolution...
                The code works, the documentation is correct. If you need wow redirection, you can adapt the code easily to use Ulrich's registry functions.

                Comment


                • #9
                  Your code works, thank you.

                  Comment


                  • #10
                    Originally posted by AutoPlayUser View Post
                    Your code works, thank you.
                    So is was the problem, if not the code...

                    Comment

                    Working...
                    X