How to implement single instance per machine application?

前端 未结 7 2119
無奈伤痛
無奈伤痛 2020-12-06 17:42

I have to restrict my .net 4 WPF application so that it can be run only once per machine. Note that I said per machine, not per session.
I implemented single instance ap

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 18:07

    You could open a file with exclusive rights somewhere in %PROGRAMDATA% The second instance that starts will try to open the same file and fail if it's already open.

提交回复
热议问题