How to add command to right-click menu of certain extension programmatically?

I have created 2 exe files: open.exe and edit.exe. and a new extension: say .newext.

Now I want to

  1. open by double click on .newext file with open exe.
  2. get a menu with right click on .newext file where in bold it is written "Open" and under that it is written "Edit". And by clicking "Edit" the edit.exe opens the .newext file.
  3. do this programmatically so that it could work on as much platforms as it is possible (at least on Xp, Vista, and Win7).

How I can achieve this?

Answers


You must edit the classes tree in the registry (using the registry functions from AdvApi32.dll). The following is not tested and off my head:

  • The base key is HKEY_LOCAL_MACHINE\Software\Classes for system-wide settings and HKEY_CURRENT_USER\Software\Classes for user-specific settings
  • In this base key, create a subkey with name .newext and default value X, where X is the class name (an arbitrary string that uniquely identifies the file type)
  • In the base key, create a subkey with name X and default value Y, where Y is the user-visible description of the file type
  • In the key X, create a subkey named shell with default value open
  • In the shell key, create a subkey named open with default value &Open
  • In the open key, create a subkey named command with default value "C:\path\to\open.exe" "%1"
  • In the shell key, create a subkey named edit with default value &Edit
  • In the edit key, create a subkey named command with default value "C:\path\to\edit.exe" "%1"

Need Your Help

Is there a blogger tag to get the URL of a Page's main image?

facebook-opengraph opengraph blogger

In blogger, for posts, we can use the data:blog.postImageUrl data 'tag' to include an image for Open Graph/Twitter cards meta tags like so:

Set font style to formula field

crystal-reports

I have a problem with crystal report 10. I have one formula field in the detail of crystal report. And I want to set font style in this formula field but I don't how to set it after I check the con...