Is there an easy way to get the file location for an associated file that is used to open an already open Click-Once application?
Using Visual Studio 2012
In reference to ApplicationEvents.vb:
This code works perfectly for the file association when the application is closed and is opened with the associated file:
However I have tried this with StartupNextInstance and I get the original file that opened this forms location and information.
In addition I have tried as a test the following:
I always receive 0 as a count when opening via the file that is associated with this program for the above code.
So in short:
I would like to know if what I want to do has a simple solution like the first code instance that works?
What is the best way to test file association (Release, Debug, Or After Publish)?
The application is Click-Once Deployed and has the single instance checkbox already checked.
I don't code a lot but I have been doing so off and on in VB and this area I am very new at.
I appreciate your support in this matter.
Best Regards,
Mark
Using Visual Studio 2012
In reference to ApplicationEvents.vb:
This code works perfectly for the file association when the application is closed and is opened with the associated file:
VB.NET:
Private Sub MyApplication_Startup(sender As Object, e As ApplicationServices.StartupEventArgs) Handles Me.Startup
Try
For Each s As String In AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData
Dim fs As StreamReader = New StreamReader(Replace(s.Substring(8), "%20", " "))
_DataA = fs.ReadLine()
_DataB = fs.ReadLine()
fs.Close()
Next
Catch
End Try
End Sub
However I have tried this with StartupNextInstance and I get the original file that opened this forms location and information.
In addition I have tried as a test the following:
VB.NET:
Private Sub MyApplication_StartupNextInstance(sender As Object, e As ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
MsgBox(e.CommandLine.Count)
For Each a As String In e.CommandLine
MsgBox(a)
Next
End Sub
I always receive 0 as a count when opening via the file that is associated with this program for the above code.
So in short:
I would like to know if what I want to do has a simple solution like the first code instance that works?
What is the best way to test file association (Release, Debug, Or After Publish)?
The application is Click-Once Deployed and has the single instance checkbox already checked.
I don't code a lot but I have been doing so off and on in VB and this area I am very new at.
I appreciate your support in this matter.
Best Regards,
Mark