VB.net禁止程序多开
文章目录
APP多开一方面耗费电脑资源,另一方面影响用户体验。
所以,我们开发APP的时候如何做到禁止程序多开呢?
我们将以下代码复制粘贴到窗体的Form1_Load中即可:
If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) Then
MessageBox.Show("当前程序已处于运行状态!", "禁止运行 ", MessageBoxButtons.OK, MessageBoxIcon.Error)
End
End If