how to get list of pid of all processes running on the system using c++ in windows???
get list of pid of all processes running on the system
Collapse
X
-
Tags: None
-
-
its giving errorOriginally posted by weaknessforcatsTry EnumProcess() in psapi.h.
process error LNK2019: unresolved external symbol _EnumProcesses@ 12 referenced in function _mainComment
-
[code=cpp]Originally posted by happiness4allits giving error
process error LNK2019: unresolved external symbol _EnumProcesses@ 12 referenced in function _main
include <windows.h>
#include<psapi. h>
#include <iostream>
using namespace std;
int main() {
u_long a[100];
u_long rsize;
EnumProcesses(a ,sizeof(a),&rsi ze);
return 0;
}
[/code]Comment
-
You forgot to add psapi.lib to your build as an additional linker dependency.Originally posted by happiness4allQuote:
Originally Posted by happiness4all
its giving error
process error LNK2019: unresolved external symbol _EnumProcesses@ 12 referenced in function _main
Code: ( cpp )
include <windows.h>
#include<psapi. h>
#include <iostream>
using namespace std;
int main() {
u_long a[100];
u_long rsize;
EnumProcesses(a ,sizeof(a),&rsi ze);
return 0;
}
This code compiles and links with no errors on Visual Studio.NET 2005 after I added psapi.lib to the build.Comment
-
u r rite i also added the lib then it worked fine.Originally posted by weaknessforcatsYou forgot to add psapi.lib to your build as an additional linker dependency.
This code compiles and links with no errors on Visual Studio.NET 2005 after I added psapi.lib to the build.
why do we have to add some libslike wsock32.lib when we use winsock..etc.Comment
-
Libraries are just precompiled code. Otherwise, you would need the source code. So, you use the header provided with the library and you add the library as a linker dependency.Originally posted by happiness4allwhy do we have to add some libslike wsock32.lib when we use winsock..etc.
For example, you can create your own library with youe favorite functions in it and to the same.Comment
Comment