System::Diagnostics::Process bug

  • Thread starter Thread starter jonathan.zimmerman
  • Start date Start date
J

jonathan.zimmerman

I cannot allow two instances of my app to run, so I try running the
following code:

#using <mscorlib.dll>
#include "mainForm.h"

using namespace System::Diagnostics;

int __stdcall WinMain()
{
Process *localByName[] = Process::GetProcessesByName(S"LxiListener");
if (localByName->Length > 1) {
MessageBox::Show("app is already running...", "Alert");
}
else
{
mainForm *s = new mainForm();
Application::Run(s);
}
return 0;
}

This works fine on all computers but mine in debug mode, and when I execute
this code normally on my computer it works, but if I run it in debug mode on
my computer I get this Exception:

"An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll
Additional information: Couldn't get process information from remote
machine."

What is wrong??? Is my OS messed up or what? I am not even trying to get
processes from a remote machine, this call should only search the local
machine.
 
Back
Top