Announcement

Collapse
No announcement yet.

Problem adding registry keys

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

  • Problem adding registry keys

    I am having a problem adding registry keys. The following code is not doing the job...

    Code:
    Registry.CreateKey(HKEY_CLASSES_ROOT, "MyApp", "NoName", "MyApp", REG_SZ);
    Registry.CreateKey(HKEY_CLASSES_ROOT, "MyApp", "DefaultIcon", SessionVar.Expand("%AppFolder%\\MyApp.exe,1"), REG_SZ);
    Registry.CreateKey(HKEY_CLASSES_ROOT, "MyApp", "URL Protocol", "", REG_SZ);
    Registry.CreateKey(HKEY_CLASSES_ROOT, "MyApp\\CurVer", "NoName", "34.3.0", REG_SZ);
    Registry.CreateKey(HKEY_CLASSES_ROOT, "MyApp\\shell\\open\\command", "", SessionVar.Expand("%AppFolder%\\MyApp.exe \"%1\""), REG_SZ);​
    ​
    Problem is that CurVer is blank, DefaultIcon is blank and the "command" value is blank. It needs to read like...
    "C:\Program Files (x86)\MyApp\MyApp.exe" "%1"
    ArtistScope - Copy Protection & DRM Software

  • #2
    Double-click one of the Registry.CreateKey() commands in the editor, and you will see that the action takes only two arguments. You should use Registry.SetValue() for most of the lines.

    Click image for larger version

Name:	image.png
Views:	47
Size:	11.8 KB
ID:	310475 Click image for larger version

Name:	image.png
Views:	41
Size:	14.8 KB
ID:	310476​​

    Ulrich

    Comment


    • #3
      I need to write them in manually... the value needs to appear as "C:\Program Files (x86)\MyApp\MyApp.exe" "%1"

      How to do that?
      ArtistScope - Copy Protection & DRM Software

      Comment


      • #4
        I noticed that I should be using SetValue instead of CreateKey but was getting an error when trying to input what I could do manaually..."unexpected symbol near \ "

        Then I found that the key does work and runs ok when the data is... C:\Program Files (x86)\MyApp\MyApp.exe "%1" by using...
        Code:
        Registry.SetValue(HKEY_CLASSES_ROOT, "ASPS\\shell\\open\\command", "", SessionVar.Expand("%AppFolder%\\MyApp.exe \"%1\""), REG_SZ);
        Last edited by artistscope; 07-02-2023, 05:29 PM.
        ArtistScope - Copy Protection & DRM Software

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎