c# - Get standard application for txt files (.NET) -
possible duplicate:
finding default application opening particular file type on windows
hello, in application want open text file, has no .txt extension. there way standard application .txt files in .net (c#)? sure use "notepad", there might people (like me), prefer (their standard) editor.
thank much.
edit:
the registry key "[hkey_classes_root]\txtfile\shell\open\command" references notepad, that's not standard app txt files. how current standard app .txt?
the absolute best option use shellexecuteex
, passing see_mask_classname
flag, open file if ".txt"
. method support things dde-based , drag-and-drop-based file opening mechanisms.
but if want (e.g. running partial trust , can't p/invoke shellexecuteex
), here's how:
there's level of indirection. first have lookup
hkcr\.txt
read default value out of key, call txtkey.
then check
hkcr\ txtkey \shell\open\command
there's function you: assocquerystring
Comments
Post a Comment