05-15-2019, 01:17 AM
This works for most processes, however for a process like iexplore.exe, I am only able to get the pid of "iexplore.exe", not "iexplore.exe *32".
Using "int iexplore=ProcessNameToId("iexplore.exe *32" 0 1)" returns 0.
Since iexplore.exe and iexplore.exe *32 have different PID assigned, how can I choose or select which to grab the memory for??
------------------------------------------------------------------------------------------------------------------
function# pid
pid=ProcessNameToId("iexplore.exe" 0 2)
;Returns process memory usage, KB.
;It is what you see in Task Manager, "Commit Size" column. Or in Process Hacker, "Private bytes" column.
;pid - process id. See <help>ProcessNameToId</help>.
__Handle hp=OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION|PROCESS_VM_READ 0 pid)
if(hp=0)
end ES_FAILED 16
PROCESS_MEMORY_COUNTERS z.cb=sizeof(z)
if GetProcessMemoryInfo(hp &z sizeof(z))
int ee = z.PagefileUsage/1024
out pid
out ee
------------------------------------------------------------------------------------------------------------------
Rob
Using "int iexplore=ProcessNameToId("iexplore.exe *32" 0 1)" returns 0.
Since iexplore.exe and iexplore.exe *32 have different PID assigned, how can I choose or select which to grab the memory for??
------------------------------------------------------------------------------------------------------------------
function# pid
pid=ProcessNameToId("iexplore.exe" 0 2)
;Returns process memory usage, KB.
;It is what you see in Task Manager, "Commit Size" column. Or in Process Hacker, "Private bytes" column.
;pid - process id. See <help>ProcessNameToId</help>.
__Handle hp=OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION|PROCESS_VM_READ 0 pid)
if(hp=0)
end ES_FAILED 16
PROCESS_MEMORY_COUNTERS z.cb=sizeof(z)
if GetProcessMemoryInfo(hp &z sizeof(z))
int ee = z.PagefileUsage/1024
out pid
out ee
------------------------------------------------------------------------------------------------------------------
Rob