本文整理汇总了Java中com.sun.jna.ptr.LongByReference.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java LongByReference.getValue方法的具体用法?Java LongByReference.getValue怎么用?Java LongByReference.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.ptr.LongByReference
的用法示例。
在下文中一共展示了LongByReference.getValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTotalCPU
import com.sun.jna.ptr.LongByReference; //导入方法依赖的package包/类
/**
* Gets the total cpu.
*
* @return the total cpu
*/
public long getTotalCPU()
{
long result = -1;
if (!isRunning())
return -1;
LongByReference lpCreationTime = new LongByReference();
LongByReference lpExitTime = new LongByReference();
LongByReference lpKernelTime = new LongByReference();
LongByReference lpUserTime = new LongByReference();
if (MyKernel32.INSTANCE.GetProcessTimes(_processInformation.hProcess,
lpCreationTime, lpExitTime, lpKernelTime, lpUserTime))
result = lpUserTime.getValue() + lpKernelTime.getValue();
return result;
}
示例2: owlGetModel
import com.sun.jna.ptr.LongByReference; //导入方法依赖的package包/类
public long owlGetModel(Pointer model) {
LongByReference owlInstanceReference = new LongByReference();
engine.owlGetModel(model, owlInstanceReference);
return owlInstanceReference.getValue();
}
示例3: owlGetInstance
import com.sun.jna.ptr.LongByReference; //导入方法依赖的package包/类
public long owlGetInstance(Pointer model, Pointer instance) {
LongByReference owlInstanceReference = new LongByReference();
engine.owlGetInstance(model, instance, owlInstanceReference);
return owlInstanceReference.getValue();
}
示例4: getSystemIdleTimeMS
import com.sun.jna.ptr.LongByReference; //导入方法依赖的package包/类
/**
* Queries the OS for the current value of the idle timer and returns the
* results.
*
* @return The number of milliseconds since the last user activity.
* @throws IOKitException If an error occurred while querying the OS.
*/
@SuppressWarnings("null")
public static long getSystemIdleTimeMS() throws IOKitException {
IOIteratorTRef iteratorRef = new IOIteratorTRef(true);
KernReturnT ioReturn = ioKit.IOServiceGetMatchingServices(null, ioKit.IOServiceMatching("IOHIDSystem"), iteratorRef);
try {
if (ioReturn == DefaultKernReturnT.KERN_SUCCESS) {
IORegistryEntryT entry = IORegistryEntryT.toIORegistryT(ioKit.IOIteratorNext(iteratorRef.getValue()));
if (entry != null) {
try {
CFMutableDictionaryRefByReference dictionaryRef = new CFMutableDictionaryRefByReference();
ioReturn = ioKit.IORegistryEntryCreateCFProperties(entry, dictionaryRef, CoreFoundation.ALLOCATOR, 0);
if (ioReturn == DefaultKernReturnT.KERN_SUCCESS) {
CFMutableDictionaryRef dictionary = dictionaryRef.getCFMutableDictionaryRef();
try {
CFTypeRef cfType = cf.CFDictionaryGetValue(
dictionaryRef.getCFMutableDictionaryRef(),
CFStringRef.toCFStringRef("HIDIdleTime")
);
if (cfType != null) {
CFNumberRef cfNumber = new CFNumberRef(cfType);
LongByReference nanoSeconds = new LongByReference();
if (cf.CFNumberGetValue(cfNumber, CFNumberType.kCFNumberSInt64Type, nanoSeconds)) {
return nanoSeconds.getValue() >> 20;
}
throw new IOKitException("HIDIdleTime out of range");
}
throw new IOKitException("HIDIdleTime not found");
} finally {
cf.CFRelease(dictionary);
}
}
throw new IOKitException(
"IORegistryEntryCreateCFProperties failed with error code: " +
ioReturn.toStandardString()
);
} finally {
ioKit.IOObjectRelease(entry);
}
}
throw new IOKitException("IOHIDSystem not found");
}
throw new IOKitException("IOServiceGetMatchingServices failed with error code: " + ioReturn.toStandardString());
} finally {
// Even though Java doesn't understand it, this can be null because IOServiceGetMatchingServices() can return null.
if (iteratorRef != null) {
ioKit.IOObjectRelease(iteratorRef.getValue());
}
}
}
示例5: getParam
import com.sun.jna.ptr.LongByReference; //导入方法依赖的package包/类
/**
* Get a WinDivert parameter. See {@link Enums.Param Param} for the list of parameters.
* <p>
* The remapped function is {@code WinDivertGetParam}:
* </p>
* <pre>{@code
* BOOL WinDivertGetParam(
* __in HANDLE handle,
* __in WINDIVERT_PARAM param,
* __out UINT64 *pValue
* );
* }</pre>
* <p>
* For more info on the C call visit: <a href="http://reqrypt.org/windivert-doc.html#divert_get_param">http://reqrypt.org/windivert-doc.html#divert_get_param</a>
*
* @param param The {@link Enums.Param param} to set
* @return The value for the parameter
*/
public long getParam(Param param) {
if (!isOpen()) {
throw new IllegalStateException("WinDivert handle not in OPEN state");
}
LongByReference value = new LongByReference();
dll.WinDivertGetParam(handle, param.getValue(), value);
return value.getValue();
}