views:

1362

answers:

4

I have recently(today) began meddeling with my registry from within Delphi. :) all is working well and my custom file type now opens with my program, but there are 2 issues i can't solve.

1) I wanted the option to "open with" from all file types so i added

  reg := TRegistry.Create;
  reg.RootKey := HKEY_CLASSES_ROOT;
  reg.LazyWrite := false;
  reg.OpenKey('*\OpenWithList\EncryptionSystem', true);
  reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"');
  reg.CloseKey;
  reg.free;

If I look in the registry using regedit it's sure there as it should seem to be but when I right click on a file and select Open With it's not there...

So I then added this

  reg.OpenKey('*\shell\Encrypt\command', true);
  reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"');
  reg.CloseKey;

This does work for every file but the option is right at the top with "open" and "edit". I kinda want it to appear in a menu subsection like most programs do... I realised that i needed to play with shellext but i did not understand the structure of how these worked withing the context menu handlers... I'd learnt all I had from reading the registry anyway... I know the name for the shellext appears later after the ".*" but as for the meaning of the big jibberish keys I have no idea.

+1  A: 

Looking at the registry it looks like it your line should be changed to.

From

reg.OpenKey('*\OpenWithList\EncryptionSystem', true);
reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"')

to

reg.OpenKey('*\OpenWithList\EncryptionSystem.exe', true); //note exe
reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"')

Check this first.

Toby Allen
+5  A: 

It looks like the "Open with" menu is not populated by that registry key alone. It's trumped by an extension-specific list stored by Explorer at the following location:

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

I'd venture a guess that the list you're adding your application to is only used if Explorer doesn't have anything better to use — so only for files that don't already have their own "Open with" lists defined.

Also, it looks like an "Open with" registry entry is supposed to have a different form from the one you're using. The key should be the name of the EXE file, such as ExcryptionSystem.exe. The default value for that key, if present, should be an empty string. I'm basing this just on what I see in the registry on my own system.

You should take a look at the File Types MSDN article, part of the Introduction to File Associations.

Rob Kennedy
yea the addition of the .exe extention and the removal of the data link within the regestry entry seems to have fixed it,,lol i dont know how as the data link was telling it where ti was. meh....
Arthur
A: 

Read MSDN where it's clearly explained

And search in Google Groups before posting a newbie question , where it has, of course, been answered millions of times for 20 years..

You might want to read the StackOverflow FAQs where it is clearly stated that neither "GIYF" nor "JFGI" (or variations of that theme) are welcome as answers here.
mghie
A: 

On my W7P they're not as referenced. Instead they're at...

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

wguru