PDA

View Full Version : What have I to use/include to call winapi /win32 functions?



tonnot
10th March 2011, 18:01
I want to implement a memory control for my program (I want to know how much memory that it spend)
I have a little piece of code for it (found on the web), and it use :

#include <windows.h>
#include <psapi.h>

I have errors on :

if ( !EnumProcesses( a ....
if ( GetProcessMemoryInfo( hProc
Am I forgetting something ?
Thanks

Lykurg
10th March 2011, 18:30
I have errors on :

if ( !EnumProcesses( a ....
if ( GetProcessMemoryInfo( hProcOf course you have errors because your syntax is not valid. You have four opening brackets and none closing one...



... or what error do you mean!

tonnot
10th March 2011, 18:36
Of course, I have not written all the code...
The errors are 'undefined references' in this 2 lines.
Thanks

JohannesMunk
10th March 2011, 19:00
Did you link against psapi?

You need something like this in your pro file.


win32:LIBS += -lpsapi
HIH

Joh

kuzulis
10th March 2011, 19:01
what compiler? If MinGW then try add in *.pro file this:


LIBS += -lPsapi

and etc.

PS: man msdn!

---

OOPS :)

tonnot
10th March 2011, 19:16
Thanks
I'm going to try it .