mato


Re: Visual Basic Language System.Diagnostics.Process.Start ???

kleinma

when you call process.start on a text file, its the same thing as finding that textfile on your hard drive and double clicking it.

When you double click a .txt file and it opens in notepad, and you double click another .txt file, it opens in a new instance, not the same one.

This is how notepad works.

You could possibly either do something with sendkeys, or possibly you could use windows APIs to make notepad think it had a .txt file drag/dropped on it, which would make it open the text file in the same instance.






Re: Visual Basic Language System.Diagnostics.Process.Start ???

CommonGenius.com

Each time you start a process to open a document, keep a reference to that process. When you are ready to open another document, kill the original process (not usually recommended, but killing notepad won't hurt anything) and then start the new process. Its not exactly what you want, but I'm not sure what you want can reasonably be done. This way at least you won't have a lot of notepad windows floating around.




Re: Visual Basic Language System.Diagnostics.Process.Start ???

kleinma

You should also keep in mind if you truly want to use notepad, then you should be launching notepad.exe and passing the filename as a commandline param.

Otherwise you will be launching whatever their default text file editor is.

For example I use a great OSS app called notepad++ for my text editor, I have associated it with .txt files on my system.

Since it has tabs like IE7 or Firefox, it is a single instance application, which means multiple instances can't be opened at the same time.

What I am getting at is, if you were to run process.start("textfilehere") on my system, and I already had a different textfile open in notepad++ that I was working on, it would open the textfile from your process.start() in the same instance but a new tab, and you killing the notepad++ process would make me lose my initial text document as well, which would make me pretty mad if a program did that to me.