|
-
August 20th, 2001, 07:08 AM
#1
Double Click on File
Hi!
Please some one told me that how to attach a file to an application such that when i Double Click the file then it is opened in the same attached application e.g. when .txt file is Double Clicked then it is opened in the Notepad. similar task is required to me. Please give me any hint.
Thanks in advance
-
August 20th, 2001, 07:28 AM
#2
Re: Double Click on File
You can register new file extensions using Windows Explorer (explorer.exe) under the Tools menu, alternatively you can set associations using regedit and a .reg file or writing the required registry keys programmatically.
You can execute the file-associated application using the Shell functions 'ShellExecute' or ShellExecuteEx' functions.
-
August 20th, 2001, 07:33 AM
#3
Re: Double Click on File
This information is written to the registry.
for example, for .txt ==> Notepad:
the key "HKEY_CLASSES_ROOT\.txt" has the default value "txtfile"
this assigns the ".txt" extension to a certain type of file, namely "txtfile".
under "HKEY_CLASSES_ROOT\txtfile\shell" we find a list of sub keys with available operations, on my system it's
open
EditWithVS
print
for each sub key, the default value indicates the name displayed in the context menu, and another subkey "command" indicates the command to execute.
if no other default operation is specified, "open" will be taken as default for the double click
so the default value of "HKEY_CLASSES_ROOT\txtfile\shell\open\command" contains the command line to execute for .txt files.
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
|