Need comments on "Open with" list behaviour.

D

Don.Leri

Hi,

I have an MFC application (let's call it Viewer) assigned to specific
extension (let's call it .ext).

HKEY_CLASSES_ROOT \ .ext \ Default = "Viewer.Document"

I need to avoid the following case...

When i right-click on .ext file and navigate to "Open With" item i get
a menu with two entries of Viewer.exe

Steps to get such case are as follows:

0. clear .ext association

.... at this moment there is no "Open With" item in pop-up menu

1. open Viewer.exe from one location and assign it to .ext (program
writes association to registry)

.... at this moment there is "Open With" item in pop-up menu without
list of programs to select from

2. open Viewer.exe from another location and close it

.... at this moment there is "Open With" item in pop-up menu with list
of two Viewer.exe in context menu appearing on hoovering over "Open
With" item.

Additional notes...

In regedit i remove all OpenWithList and OpenWithProgid entries for

.../Explorer/FileExt/.ext

from all roots.

Then in explorer i right-click on .ext file and still get a list with
two Viewer.exe entries in it.

Question is...

How to get rid of duplicated entries and have only one most recent?

Any details on how "Open With" list is populated will be greatly
appreciated also.
 
D

Don.Leri

Probably, it's not the right forum for my problem...

as it appears problem comes from CWinApp ::RegisterShellFileTypes(int)

Viewer.exe registers itself on start and besides other registrations
(like registering class ids and calling registrations of
COleObjectFactory and COleTemplateServer) it calls CWinApp
::RegisterShellFileTypes(int).

The result is...

.... when it is started from one location "Open With" list has one
Viewer.exe
.... when it is started again from another location "Open With" list has
already two Viewer.exe entries.

So, it looks like all it needs is to find out a workaround for CWinApp
::RegisterShellFileTypes(int) behaviour to avoid multiple entries of
the same program in "Open With" list.
 
R

Ramesh, MS-MVP

Don,

As you said, this happens if the executable is launched from two different
locations. For instance, the file association may point to

%SystemRoot%\system32\NOTEPAD.EXE

Whereas Notepad.exe under HKCR\Applications\Notepad.exe may point to the
following location:

%SystemRoot%\NOTEPAD.EXE

Fixing any one of the above registry values will remove the duplicate
instances in Open with sub-menu / dialog.

FileExtInfo - View the association settings for a file type easily:
http://windowsxp.mvps.org/fileextinfo.htm

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


Probably, it's not the right forum for my problem...

as it appears problem comes from CWinApp ::RegisterShellFileTypes(int)

Viewer.exe registers itself on start and besides other registrations
(like registering class ids and calling registrations of
COleObjectFactory and COleTemplateServer) it calls CWinApp
::RegisterShellFileTypes(int).

The result is...

.... when it is started from one location "Open With" list has one
Viewer.exe
.... when it is started again from another location "Open With" list has
already two Viewer.exe entries.

So, it looks like all it needs is to find out a workaround for CWinApp
::RegisterShellFileTypes(int) behaviour to avoid multiple entries of
the same program in "Open With" list.
 

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