正在学API,来个API的,高手纠正下。#Include <WinAPI.au3>
#Include <array.au3>
$PROCESS_QUERY_INFORMATION=0x400
$PROCESS_QUERY_LIMITED_INFORMATION=0x1000
$PROCESS_SET_INFORMATION =0x0200
$PROCESS_SET_QUOTA =0x0100
$PROCESS_SUSPEND_RESUME =0x0800
$PROCESS_TERMINATE =0x0001
$PROCESS_VM_OPERATION =0x0008
$PROCESS_VM_READ =0x10
$PROCESS_VM_WRITE =0x0020;常量
$_PIDN="explorer.exe"
$_PID=ProcessExists($_PIDN)
$_Return=DllCall("Kernel32.dll","hwnd","OpenProcess","dword",0x400+0x10,"int",False,"dword",$_PID)
If Not IsArray($_Return) Or $_Return[0]=0 Then
MsgBox(0,"error","API错误代码:" & _WinAPI_GetLastError())
Exit
EndIf
$_Struct=DllStructCreate("DWORD;DWORD;DWORD;DWORD;DWORD;DWORD;DWORD;DWORD;DWORD;DWORD")
$_Return=DllCall("Psapi.dll","int","GetProcessMemoryInfo","hwnd",$_Return[0],"ptr",DllStructGetPtr($_Struct),"dword",DllStructGetSize($_Struct))
MsgBox(0,"","进程:"&$_PIDN & " 占用内存: " & DllStructGetData($_Struct,4)/1024 & " KB")
|