tags:

views:

568

answers:

1

How to open files from explorer into different tabs. I can associate an open with menu with the file type, now when I already have the program working, how to open the new file into another tab, instead of new program. How to find the already running process exactly, not with the name and send the filename to it.

Let me make myself clear: I want my app to be single instance, so that when user select 10 text files and press enter key, my application will open all the 10 text files into 10 tabs, instead of creating 10 processes. How to do that? How to communicate between various instances of the same process.

EDIT SOLVED: Implemented the functionality using WM_COPYDATA in C# and the SingleApplication class from codeproject.

+1  A: 

I am not quite sure what you mean in this question. Are you trying to open Windows Explorer windows into one window with tabs? If that is the case, then I recommend you look into QT TabBar, which extends Windows Explorer to allow for such behavior.

Or perhaps you are trying to have a link open to a new tab in a web browser. If that is the case, this behavior is defined by the web browser itself. For Internet Explorer 7, you can set this behavior under Tools > Internet Options.

In the General tab, click the Settings button next to the "Tabs" section. You will want to set the "Open links from other programs in:" option to open a new tab.

Keep in mind that this behavior is defined by each user, and you can't ever make any guarantees that they will have the same browser settings as you do.


After reading your comments, I think I understand a bit better. It sounds like you want your application to only allow one instance at a time. Since you tagged this post C#, I will assume that is what you are writing your program in.

Codeproject.com has a great tutorial on how to make your program only allow a single instance.

Here is a snippet of code from their site:

static void Main() 
{
   if(SingleInstance.SingleApplication.Run() == false)
   {
      return;
   }
   //Write your program logic here
}

You would want to write code just before the return statement to have the existing instance open the file in a new tab.

If you are able to provide detailed information about what your program is doing, we might be able to help you with some of the specifics.

Tim
I have updated the question and comments with more detail.
Priyank Bolia
I was already using the SingleInstance.SingleApplication, I wanted to know the IPC mechanism to use. I figured out WM_COPYDATA is the best and easy way to do that.Many Thanks.
Priyank Bolia