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"