Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages
Started by CC
Wed, 26 Mar 2003 20:00
GetProcessMemoryInfo-Working But....
Author: CC
Date: Wed, 26 Mar 2003 20:00
Date: Wed, 26 Mar 2003 20:00
14 lines
1126 bytes
1126 bytes
I am trying to use GetProcessMemoryInfo The module I'm calling it from is a thread. I pass in Application->Handle to the api, it returns error message "Invalid handle" What handle should I use? Thanks, CurtC
Re: GetProcessMemoryInfo-Working But....
Author: Remy Lebeau (TeamB)
Date: Wed, 26 Mar 2003 21:14
Date: Wed, 26 Mar 2003 21:14
18 lines
1442 bytes
1442 bytes
GetProcessMemoryInfo() expects a process handle, but you are passing it a window handle instead. They are not the same thing. Use GetCurrentProcess() to retrieve the process handle. Gambit "CC" <Xcurtc@tmscorp.com> wrote in message news:3e82069d@newsgroups.borland.com... > I am trying to use > > GetProcessMemoryInfo > > The module I'm calling it from is a thread. > > I pass in Application->Handle to the api, > it returns error message "Invalid handle"
Re: GetProcessMemoryInfo-Working But....
Author: Terry
Date: Wed, 26 Mar 2003 22:50
Date: Wed, 26 Mar 2003 22:50
19 lines
1566 bytes
1566 bytes
Are you trying to do something like this:
PROCESS_MEMORY_COUNTERS pmc;
HANDLE hProcess;
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ, FALSE, ProcessID);
if(hProcess != NULL)
{
if(GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
{
Item->SubItems->Add(FloatToStrF(StrToFloat(pmc.WorkingSetSize/1024),
ffNumber, 15, 0) + " K");
}
CloseHandle(hProcess);
}
Re: GetProcessMemoryInfo-Working But....
Author: CC
Date: Thu, 27 Mar 2003 14:32
Date: Thu, 27 Mar 2003 14:32
28 lines
1745 bytes
1745 bytes
Thank you terry !
This help a BUNCH! Now - if I can figure out why my program is eating
memory!!!! Arg -
Thanks again,
Curt
"Terry" <terry@helloworld.com> wrote in message
news:3e822e95@newsgroups.borland.com...
> Are you trying to do something like this:
>
>
> PROCESS_MEMORY_COUNTERS pmc;
> HANDLE hProcess;
>
> hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |
> PROCESS_VM_READ, FALSE, ProcessID);
> if(hProcess != NULL)
> {
> if(GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
> {
>
> Item->SubItems->Add(FloatToStrF(StrToFloat(pmc.WorkingSetSize/1024),
> ffNumber, 15, 0) + " K");
> }
>
> CloseHandle(hProcess);
> }
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads