Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Add entry to explorer's context menu query?

Posted on 2004-09-29
10
Medium Priority
?
406 Views
Last Modified: 2013-11-20
Hi all

I want to add the entry of my dialog based app's exe in the context menu of all files.

To do this what i have done is in the registry: under HKEY_CLASSES_ROOT\*\shell     i have created a new key by the name "my_exe" & then a key named "command" under the key "my_exe".

Now in the  key named "command" i set the data of  (default) as " C:\aa.exe %1".

Now as result this whenever i right click on any file i see the entry of my exe as "my_exe".

So far so good. Now i have 3 files on my desktop 1.doc, 2.txt & 3.cpp. When i double click on 1.doc file gets opened in WORD. for 2.txt file gets opened in the NOTEPAD but when i double click on the 3.cpp my_exe  is executed where as 3.cpp shud be opened in Visual Studio.

On closely watching when i right click on 1.doc in the context menu "Open"is the default command.

for  2.txt also "Open" is default command  but for 3.cpp "my_exe" is  bold ie "my_exe" becums the default command for 3.cpp.  

y is this happening. How can i stop this?

I want only when the user right clicks on a file and then select "my_exe", then only my exe shud be executed.


Waiting for suggestions
Regards


0
Comment
Question by:stellarguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
10 Comments
 
LVL 5

Expert Comment

by:Nass89
ID: 12178984
Hi,
When you click on a file that its extension is known for explorer, it adds 'open' to menu and makes it bold. Bold means that explorer knows where to find the exe file to open it.
If the extension is not known for explorer it makes the first menu item in context menu bold. In your fall 'My_exe' is bold as first item.
I guess, 'CPP' extension is not defined for your explorer. To check it look under:

HKEY_CLASSES_ROOT\cppfile\Shell\Open\command

Is there any application defined?

Good Luck!
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 12179913
There are 2 group of keys to consider:

HKEY_CLASSES_ROOT\cppfile\Shell\Edit\command
HKEY_CLASSES_ROOT\cppfile\Shell\Open\command
Both keys are the **DEFAULT** action for your CPP files

HKEY_USER\SomeUserIDhere\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cpp\OpenWithList
Contains the list of **ALL** applications that handle this type of file
Also is repeated in HKEY_CURRENT_USER
0
 

Author Comment

by:stellarguy
ID: 12214988
Thanx Nass89 for ur comments.

>>HKEY_CLASSES_ROOT\cppfile\Shell\Open\command
>>Is there any application defined?

Yes the complete path of msdev.exe is given but still "aa.exe" is in bold
where as "open with msdev" is the second entry in the context menu.

Also i am here talking about all types of files in the system.
Is there any way with the help of which i can avoid "aa.exe" to be the default command for any file type.?

Waiting for comments
Regards
   

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:stellarguy
ID: 12215016
Thanx  jaime_olivares for ur comments

>>HKEY_CLASSES_ROOT\cppfile\Shell\Edit\command
>>HKEY_CLASSES_ROOT\cppfile\Shell\Open\command

I cud not find these keys. The only that is available under "HKEY_CLASSES_ROOT\cppfile\Shell" is  "&Open with MSDev".

Also i am here talking about all types of files in the system.
Is there any way with the help of which i can avoid "aa.exe" to be the default command for any file type.?

I have also looked at the alternate option of writing a COM Dll & thus implemeting the IContextMenu interface.
I have through examples on Codeguru but cud not understand much.
I have no knowledge of COM.

Can u provide any link or some sode that does the above job?

Thanx & Regards
 


0
 
LVL 5

Expert Comment

by:Nass89
ID: 12216115
Hi,
Try to rightclick over an unknown extension file. Is it same when you right click over cpp file?
As I wrote, when the extension is unknown, you see what you wrote. "The first menu item selected and open with...'.
When you add MyExe to "HCR\*\Shell", it will appear over every file. It is not avoidable.

To appear only over a desired extension, you must add it to "HCR\xxxfile\open\command".
Tto appear the "Open with", add it to HCR\xxxfile\Open with MyExe".

**xxx is the dsired extension**
Good Luck!
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12216928
>I cud not find these keys. The only that is available under "HKEY_CLASSES_ROOT\cppfile\Shell" is  "&Open with MSDev".

That's the same, just have to create your own key:

"HKEY_CLASSES_ROOT\cppfile\Shell\Open with MyApp".

and the respective 'command' key inside.

I don't recommend to use COM if you are not an experienced programmer.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12560530
Still waiting for author's feed back, think have provided a valid solution
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question