can anybody give me an example of how to list processes either using static Process* GetProcesses() []; or some other method?
i check on MSN but cant make much sense of it let alone make it work.
thanx
can anybody give me an example of how to list processes either using static Process* GetProcesses() []; or some other method?
i check on MSN but cant make much sense of it let alone make it work.
thanx
AFAIK there's no win32 API function of that name. If you're using an NT based o/s then you can load EnumProcesses() from PSAPI.DLL (it's not included in any headers or libraries so you can use LoadLibrary()). Here's two links from google demostrating EnumProcesses() use -
http://oasis2.openave.net/pub/298/3/...ocesses.h.html
http://oasis2.openave.net/pub/298/3/...esses.cpp.html
zen
unfortunately im not on NT but thanx anyway.
im pretty sure im not imagining it though:
http://msdn.microsoft.com/library/de...ssestopic1.asp
it doesnt have to be winapi.
Oh, do you mean using a 'managed C++' app with Visual Studio.NET. It looks pretty straightforward in the help files, but I wasn't able to access a Process object using managed C++ as the compiler kept telling me that it wasn't a member of the Diagnostic namespace (I was able to access it using C# though).
If this is what you're after you may be better off finding a .NET board somewhere.
zen
After playing about with it I've got it to work -
If you don't have a compiler that can use the managed NET extensions then you'll have to use a different method.Code:#using <mscorlib.dll> #using <system.dll> using namespace System; using namespace System:: Diagnostics; // This is the entry point for this application #ifdef _UNICODE int wmain(void) #else int main(void) #endif { //Get All Processes Process* myProcess[] = Process::GetProcesses(); //Print first 20 for(int i=0;i<20;i++) Console::WriteLine(myProcess[i]->ProcessName); return 0; }
zen
thanx :-)
it looks like my compiler doesnt support. ill try looking into another method.
Thankyou for your advice, i really appreciate it :-).