3

I want my program to be associated with a custom file type so that clicking on a file of that type will open it with my program.

I've seen I can do that by: Properties->Publish->Options->File associations. But I don't know what I should enter as ProgID.

From Wikipedia it seems it's some long number (is there a specific way of choosing it?). From an answer here it seems it's just anything I want.

Community
  • 1
  • 1
ispiro
  • 26,556
  • 38
  • 136
  • 291
  • this question on SO should help you: http://stackoverflow.com/questions/69761/how-to-associate-a-file-extension-to-the-current-executable-in-c-sharp – Kamil Lach Apr 22 '12 at 17:57
  • @KamilLach Thanks. But I saw that question before posting mine. It doesn't refer to the ProgID. – ispiro Apr 22 '12 at 18:12

1 Answers1

8

Just fire up regedit.exe and see how other programs do it. The progids are listed in the HKEY_CLASSES_ROOT. The (Default) value of a filename extension key in the list you see there is the progid associated with the extension. Some common samples:

  • .dll = "dllfile"
  • .exe = "exefile"
  • .ico = "icofile"
  • .txt = "txtfile"

You see the pattern. It isn't required that it looks like this, just a convention. "YourCompany.YourFileType" is fine as well with the advantages of it being more descriptive and avoiding name collisions.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536