System::Diagnostics::Process bug

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top