Currently, we are having trouble processing the window to prevent multiple boots.
By obtaining PIDs by process name and forcibly deleting windows with the same process name and different PIDs, I thought it would be possible to prevent multiple boots, so I looked it up.If you search for it, you will see a lot of similar processing, so when you refer to it, you will see the error in the title in the process.CloseMainWindow.
Strangely enough, it can be successful, so it's rather troublesome.
Thank you for your cooperation.
System.Diagnostics.ProcessThisProcess=System.Diagnostics.Process.GetCurrentProcess();
System.Diagnostics.Process[]hProcesses=System.Diagnostics.Process.GetProcessesByName(hThisProcess.ProcessName);
intiThisProcessId=hThisProcess.Id;
foreach(System.Diagnostics.Process in hProcesses){
if(hProcess.Id!=iThisProcessId){
if(!hProcess.CloseMainWindow()){
hProcess.Kill();
}
else{
Logger.Info("CloseMainWindow Success:"+hProcess.Id);
}
}
}
I'm doing something very dangerous...
Why don't we throw away all the current codes and check for multiple boot with Mutex?
Please refer to other tips.
http://dobon.net/vb/dotnet/process/checkprevinstance.html
Huh? Is it ASP.NET? If so, it's a confusing code...
© 2024 OneMinuteCode. All rights reserved.