adding custom shell actions for .doc files

N

Neil W

Lets say I am installing my application on a 2K or XP system with Office
2000 or 2003.

In my application setup I'd like to add a custom action for DOC files.
Currently if you right click on a DOC file in Explorer, there are actions
like Open, New, and Print. I'd like to add, say, "Myaction".

I know that it is done by adding various registry entries to
HKEY_CLASSES_ROOT. However, there is the easy but messy way, and there is
the correct way. The easy but messy way potentially messes up the existing
actions.

Can anyone point me in the right direction for the correct way?

Thanks

PS - if responding by email remove REMOVE
 
T

Tony Jollans

In My Computer or Windows Explorer click on Tools > Folder Optiions (or go
via Control Panel > Folder Options)
Select the File Types tab
Scroll down the list to find DOC
Click on the Advanced button and you shouldbe able to do what you want
 
N

Neil W.

Sorry I wasnt clear - I want to do it programatically, not manually.

--------------------------

"Tony Jollans" <My Forename at My Surname dot com> wrote in message
In My Computer or Windows Explorer click on Tools > Folder Optiions (or go
via Control Panel > Folder Options)
Select the File Types tab
Scroll down the list to find DOC
Click on the Advanced button and you shouldbe able to do what you want
 
N

Neil W.

Thanks. That article was exactly what I was looking for. Just a slight
wrinkle. I tried creating a custom action for DOC files:

1) Looked up HKCR/.doc default=Word.Document.8
2) Added key HKCR/Word.Document.8/Shell/MyAction/Command
3) Wrote command string into default value.

It worked great. MyAction shows up when I right click on a DOC file. Then I
tried the exact same thing XLS files:

1) Looked for HKCR/.xls default=Excel.Sheet.8
2) Added key HKCR/Excel.Sheet.8/Shell/MyAction/Command
3) Wrote command string into default value

However, when I right click on an .xls file, MyAction does not appear. In
fact, it doesnt look like Windows is even using this mechanism for xls
files. If I change the command string for Open, the spreadsheet still opens
normally.

Any ideas what might be going on with the xls files?

Thanks again.

_____________________________________

Hard to answer, when you don't explain what you think is the "easy but
messy way", and what you think is the "correct" way, and how exactly
the first way "messes up the existing actions" !

The proper way for a setup program to add new options to the
right-click menu, as I understand it, is to add the relevant entries to
the registry:

http://msdn.microsoft.com/library/d...ell_basics/shell_basics_extending/context.asp

HTH,
TC
 
T

TC

Sorry, I don't know what would cause that, off hand.

Remember there can be several versions of Word, Excel etc. on the same
PC. In theory you could have Excel.Sheet.8 (Excel 97), Excel.Sheet.9
(the next version of Excel), and so on. Are you sure you've altered the
right one?

I'd try reading the relevant articles once again. Perhaps there are
some other keys which are set for Excel to prevent any customization.

Alternatively, try asking in one of the win32 programming groups. I'd
say it's a win32 shell issue, not particularly an Excel issue.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top