Loading with a file

  • Thread starter Thread starter Tomomichi Amano
  • Start date Start date
T

Tomomichi Amano

Hello. Normally when you click on a TXT file, NOTEPAD starts up and shows
the file.
How do I do this in my own program (what do I do with the program, how, what
do I do with the file settings, how?)?

<I am making a text editor, and I want my program to load and show TXT files
when they are clicked>

Thanks in advance.
 
You need to use the registry and set a file association between .txt and
your application. There are probably some ways to handle this automatically
with WMI or installers.
 
Replace the static void/int Main() method with static void/int
Main(string[] args);
Then you can simply try to use whatever is entered as a file name, like
"MyNotepad c:\mytextfile.txt"
string filename = args[0]; // == c:\mytextfile.txt
 
Back
Top