class WindowsFormsApp : Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase { private App _wpfApp; public WindowsFormsApp() { IsSingleInstance = true; } protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e) { MessageBox.Show("First File"); //Get 1st click file path GetFilePath(); _wpfApp = new App(); _wpfApp.Run(); return false; } protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e) { MessageBox.Show("Second File"); //Get 2nd click file path GetFilePath(); } protected void GetFilePath() { if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData != null && AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData.Length > 0) { var filePath = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0]; var uri = new Uri(filePath); MessageBox.Show(uri.LocalPath); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)