troubleshooting Question

How to: simple C++ example of GetProcessByName

Avatar of tullhead
tullheadFlag for United States of America asked on
C++.NET Programming
6 Comments1 Solution6842 ViewsLast Modified:
In a Microsoft article, I found this example:

#using <mscorlib.dll>
#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;

int MyProcedure()
{
    // Get all instances of Notepad running on the computer
    Process* localByName[] = Process::GetProcessesByName(S"notepad");
}

Using VS2010 and C++ I would like to make a little app to run this code.  In my attempt, it yielded the error that I must use /clr -- so I tried setting that, then it said it was incompatible with another setting, and so on, and so on.   I'm an old VS 6.0 and MFC C++ programmer - but just starting in .NET and don't know what "managed code is", etc.  Could someone give me a couple pointers on creating the world's simplest app that executes the code above?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros