这是我的PSAPI.java接口:
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
public interface PsApi extends StdCallLibrary {
public static abstract class PPROCESS_MEMORY_COUNTERS extends Structure {
public int cb;
public int PageFaultCount;
public int PeakWorkingSetSize;
public int WorkingSetSize;
public int QuotaPeakPagedPoolUsage;
public int QuotaPagedPoolUsage;
public int QuotaPeakNonPagedPoolUsage;
public int QuotaNonPagedPoolUsage;
public int PagefileUsage;
public int PeakPagefileUsage;
}
boolean GetProcessMemoryInfo(HANDLE process, PsApi pmem, int cb);
}
另一个版本(没有摘要):
public static class PPROCESS_MEMORY_COUNTERS extends Structure {
public int cb;
public int PageFaultCount;
public int PeakWorkingSetSize;
public int WorkingSetSize;
public int QuotaPeakPagedPoolUsage;
public int QuotaPagedPoolUsage;
public int QuotaPeakNonPagedPoolUsage;
public int QuotaNonPagedPoolUsage;
public int PagefileUsage;
public int PeakPagefileUsage;
@Override
protected List getFieldOrder() {
// TODO Auto-generated method stub
return null;
}
}
要使用GetProcessMemoryInfo()
函数,我应该声明变量:
PPROCESS_MEMORY_COUNTERS pmem;
但它返回一个错误:
PPROCESS_MEMORY_COUNTERS 无法解析为类型
如何正确包含 PPROCESS_MEMORY_COUNTERS 结构?谢谢。