How can i check if another instance is running ?
Also if it is running how can I force my already opened instance to open a file ?
Also if it is possible can I force it to get focus? ( I need this seperate)
How can i check if another instance is running ?
You could use Process.GetProcesses()
to get a list of processes which are running on your machine. And simply do your compare with Process.Name
. With rather simple name, you may need additional check for your application.
Also if it is running how can I force my already opened instance to open a file ?
If you want to communicate between 2 processes, I would recommend SendMessage
method. See here.
Also if it is possible can I force it to get focus? ( I need this seperate)
You could use SetForgoundWindow
method (also require P/Invoke
). See here.