I built a full fledeged java based tool for doing this. Let me present you a short tutorial demostrating the way in which it can be done
1) Java Program
Develop a swing based normal java program which takes an input file name and depending on the extention of file shows a menu. The menu should be very small in size. The normal swing based program could be like this.
Takes the file name (with path) in the constructor like this
Decides on the action to perform depending on user click
Please note that if you are using java 5 you can make use of this feature
MouseInfo.getPointerInfo().getLocation()
Using this you can display the menu on the location where user has the mouse
MouseInfo.getPointerInfo().getLocation()
Using this you can display the menu on the location where user has the mouse
The main method of the program should look something like this
And when you run this java program the output should be something like this
2) Use Janel to convert your java program to exe , Please refer to my other blog on how to do this.
Lets assume the exe file name you created for your java program is menubuilder.exe
3) Use Regedit to add the entry.
Regedit is windows tool using which you can see all your registry entries. I would suggest that before
using this tutorial please export all your registry key and backit up somewhere.
Lets assume you want to add custom right click menu to .java extention.
Lets assume the exe file name you created for your java program is menubuilder.exe
3) Use Regedit to add the entry.
Regedit is windows tool using which you can see all your registry entries. I would suggest that before
using this tutorial please export all your registry key and backit up somewhere.
Lets assume you want to add custom right click menu to .java extention.
Step 1 ) Open Regedit and expand HKEY_CLASSES_ROOT.
Step 2) You can see .java key there , just click on that key and check if
PerceivedType is equal to "text". If yes then note down the default value
(java_auto_file as shown in the figure).
NOTE : If the PercievedType is not text then you would probably have Shell key inside your .java key. In that case jump to step 5
PerceivedType is equal to "text". If yes then note down the default value
(java_auto_file as shown in the figure).
NOTE : If the PercievedType is not text then you would probably have Shell key inside your .java key. In that case jump to step 5
Step 3) Open the java_auto_file key.
Step 4 ) Open Shell key inside java_auto_key (this should already be there)
Step 5) Create a subkey called MyMenu inside this Shell key.
Step 6 ) Create a command key inside your newly created MyMenu key.
Step 7) Set the value of command key to as shown in figure.
Step 7) Set the value of command key to as shown in figure.
Step 8 ) Exit the regedit.
Step 9) Just Pray that every thing was done alright ( kidding)
Now when you go to windows explorer and right click on java file you would be able to see the MyMenu as shown in figure and clicking on it would open your favorite menu.
Step 9) Just Pray that every thing was done alright ( kidding)
Now when you go to windows explorer and right click on java file you would be able to see the MyMenu as shown in figure and clicking on it would open your favorite menu.
Please let me know if you need source code for all this. I can surely share the source for free!!!!!!!!!!!!!!!
0 comments:
Post a Comment