-
June 13th, 2015, 04:16 PM
#1
OpenWith Application
Hello,
I have a weird problem trying to associate an extension with my application.
I am using visual studio 2008 and a custom document manager derived from CDocManager in order to support multiple extensions.
The application runs fine from the Release build folder and the icon for the application is shown correctly in the taskbar.
Normally, you can associate any extension with a default program by right-clicking on the filename in Windows Explorer. If successful, a new program icon showing the program name and the company name is shown in the OpenWith dialog box. After clicking on Ok, the program is launched and opens the file. And the registry entry for UserChoice for the extension is updated!
However, when I try to associate an extension with an exe file in the Release folder, no icon is created in the OpenWith dialog box! And the association is unsuccessful! The application is not started and the registry entry for UserChoice is not updated!
But when I run the program at command level by specifying the full path to the Release folder and the file to be opened, the application runs successfully! I am stumped!
After spending hours on the internet, I found an interim solution that works and that is to rename the application exe file! You can now associate the extension with the application.
But this sounds fishy. I tried cleaning the solution, deleting the .res file, and rebuilding but when I went back to the original name, it just does not want to associate a specific exe name! Grrr!
Any ideas?
Thanks
Last edited by robertpantangco; June 14th, 2015 at 02:29 AM.
-
June 15th, 2015, 05:25 AM
#2
Re: OpenWith Application
Originally Posted by robertpantangco
Any ideas?
Use ProcessMonitor for logging registry operations and see what happens in normal case compared to abnormal case.
Best regards,
Igor
-
June 15th, 2015, 01:38 PM
#3
Re: OpenWith Application
Igor,
I'll do the ProcessMonitor to find out exactly what's going on.
In the meantime, I just found out that Windows does not allow the same executable filename for association with an extension! You have to delete the existing association first from the registry.
This presents some difficulties when you try to keep the same exe name in your application install setup.exe for your customers.
-
June 16th, 2015, 01:45 AM
#4
Re: OpenWith Application
Okay, found the answer, you have to inspect if the path to YourCoolApp.exe is valid, and is a full path:
Code:
HKEY_CLASSES_ROOT\Applications\YourCoolApp.exe\shell\open\command
Your installer should take care about creating it on install phase, and cleaning up this on uninstall, of course.
PS. Thanks to this your question, as it was itching me a couple of years why some of my programs have stopped to appear in OpenWith dialog. Fixed that.
Last edited by Igor Vartanov; June 16th, 2015 at 01:53 AM.
Best regards,
Igor
-
June 16th, 2015, 02:14 AM
#5
Re: OpenWith Application
Igor,
Thanks. Glad we helped each other out!
Robert
-
June 16th, 2015, 02:22 AM
#6
Re: OpenWith Application
BTW, this is how registry looks for an exe supporting several file types:
Code:
REGEDIT4
[HKEY_CLASSES_ROOT\Applications\ois.exe]
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell]
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell\Edit]
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell\Edit\command]
@="C:\\PROGRA~2\\MICROS~1\\Office14\\OIS.EXE /shellEdit \"%1\""
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell\Open]
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell\Open\command]
@="C:\\PROGRA~2\\MICROS~1\\Office14\\OIS.EXE /shellOpen \"%1\""
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell\Preview]
[HKEY_CLASSES_ROOT\Applications\ois.exe\shell\Preview\command]
@="C:\\PROGRA~2\\MICROS~1\\Office14\\OIS.EXE /shellPreview \"%1\""
[HKEY_CLASSES_ROOT\Applications\ois.exe\SupportedTypes]
".tif"=""
".dib"=""
".jpeg"=""
".wmf"=""
".bmp"=""
".png"=""
".emf"=""
".gif"=""
".jfif"=""
".jpg"=""
".jpe"=""
".tiff"=""
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|