Question Opening files within a single instance app using file association

ViRuXe

New member
Joined
Jul 24, 2010
Messages
2
Programming Experience
1-3
Hi there. My nickname is ViRuXe, I'm from Portugal and this is my first post here. :)

So, the thing is, I have an application that has a tabcontrol to handle multiple documents, just like Notepad++. And I also have file association working correctly with it.

All I want to do is to make it open the double-clicked file onto a new "codetab" instead of creating a new instance of the program just to open a file.

I've been searching Google for hours and couldn't come up with relevant results on this.

I would greatly appreciate if someone could help me on this one. ;)

ViRuXe
 
Thank you so much! That was exactly what I was looking for!

I always wondered when I would use that ApplicationEvents file...

Well, for the solution to my problem:

- Opened the Application Events file through the Project Properties page
- Chose on the General Menu - MyApplication Events
- Chose on the Declarations Menu - StartupNextInstance
- Started doing my code

Right now it looks like this:
VB.NET:
Private Sub MyApplication_StartupNextInstance(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
            For Each s As String In e.CommandLine
                MsgBox(s.ToString)

            Next
        End Sub

So if I select multiple files at the same time and open them at once, a MsgBox appears with the app arguments for each one.

Once again thank you.
 
Last edited:
Back
Top