Single instance wpf application

Tmann

Member
Joined
Jun 24, 2011
Messages
8
Programming Experience
5-10
Afternoon all, I have a vb wpf application that opens a text file when you double click it in explorer (using command line args) my question is when I select multiple files and select open it opens separate instances for each file and only passes one command line arg to each application. I'm assuming the way to resolve this is to make the application a single instance application but I'm struggling with finding a solution to this, I dont really want to reference any winforms dlls if possilbe Thanks
 
A common solution seems to be to use the WindowsFormsApplicationBase class, same that Forms uses for application framework. No additional references is needed for this, since all VB projects must reference the Microsoft.VisualBasic assembly anyway. There is a sample in Windows SDK, I'll have a look later, available here Single Instance Detection Sample.
 
Back
Top