本文整理汇总了Java中com.sun.jna.Function类的典型用法代码示例。如果您正苦于以下问题:Java Function类的具体用法?Java Function怎么用?Java Function使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Function类属于com.sun.jna包,在下文中一共展示了Function类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAeroEnabled
import com.sun.jna.Function; //导入依赖的package包/类
public static boolean isAeroEnabled(){
if( HearthHelper.getOSName().equals("win") && DWM == null){
try{
DWM = NativeLibrary.getInstance("dwmapi");
} catch(Throwable e) {}
}
boolean dwmEnabled = false;
if(DWM != null){
boolean[] bool = { false };
Object[] args = { bool };
Function DwmIsCompositionEnabled = DWM.getFunction("DwmIsCompositionEnabled");
HRESULT result = (HRESULT) DwmIsCompositionEnabled.invoke(HRESULT.class, args);
boolean success = result.intValue()==0;
if(success && bool[0]){
dwmEnabled = true;
}
}
return dwmEnabled;
}
示例2: toString
import com.sun.jna.Function; //导入依赖的package包/类
@Override
public String toString() {
if (getPointer() == null) {
return "null";
}
if (getPointer() instanceof Function || getPointer() instanceof Memory) {
return "Java initialized, not a real CF type";
}
CFStringRef description = INSTANCE.CFCopyDescription(this);
try {
return description.toString();
} finally {
INSTANCE.CFRelease(description);
}
}
示例3: initialize
import com.sun.jna.Function; //导入依赖的package包/类
private static void initialize() {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
Ole32 ole32 = Ole32.INSTANCE;
ole32.CoInitializeEx(Pointer.NULL, 0);
Guid.GUID CLSID_TaskbarList = Ole32Util.getGUIDFromString("{56FDF344-FD6D-11d0-958A-006097C9A090}");
Guid.GUID IID_ITaskbarList3 = Ole32Util.getGUIDFromString("{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}");
PointerByReference p = new PointerByReference();
WinNT.HRESULT hr = ole32.CoCreateInstance(CLSID_TaskbarList, Pointer.NULL, ObjBase.CLSCTX_ALL, IID_ITaskbarList3, p);
if (!W32Errors.S_OK.equals(hr)) {
LOG.error("Win7TaskBar CoCreateInstance(IID_ITaskbarList3) hResult: " + hr);
ourInitialized = false;
return;
}
myInterfacePointer = p.getValue();
Pointer vTablePointer = myInterfacePointer.getPointer(0);
Pointer[] vTable = new Pointer[TaskBarList_Methods];
vTablePointer.read(0, vTable, 0, vTable.length);
mySetProgressValue = Function.getFunction(vTable[TaskBarList_SetProgressValue], Function.ALT_CONVENTION);
mySetProgressState = Function.getFunction(vTable[TaskBarList_SetProgressState], Function.ALT_CONVENTION);
mySetOverlayIcon = Function.getFunction(vTable[TaskBarList_SetOverlayIcon], Function.ALT_CONVENTION);
}
示例4: _readdir
import com.sun.jna.Function; //导入依赖的package包/类
@FuseMethod
final int _readdir(final String path, final Pointer buf,
final Pointer fillFunction, final TypeOff offset,
final StructFuseFileInfo info) {
return readdir(
path,
new DirectoryFillerImpl(buf, Function.getFunction(fillFunction)));
}
示例5: createFunction
import com.sun.jna.Function; //导入依赖的package包/类
@Override
public INativeFunction createFunction(long address, Object callingConvention) {
int callFlags;
if (callingConvention == INativeFunction.CallingConventionCdecl) {
callFlags = Function.C_CONVENTION;
} else if (callingConvention == INativeFunction.CallingConventionStdcall) {
callFlags = Function.ALT_CONVENTION;
} else {
throw new IllegalArgumentException("illegal calling convention");
}
Pointer pointer = new Pointer(address);
Function function = Function.getFunction(pointer, callFlags);
return new JnaNativeFunction(function);
}
示例6: createLibrary
import com.sun.jna.Function; //导入依赖的package包/类
@Override
public INativeLibrary createLibrary(String name, Object callingConvention) {
Map<String, Object> options = new HashMap<>(2);
if (callingConvention == INativeFunction.CallingConventionCdecl) {
options.put(Library.OPTION_CALLING_CONVENTION,
Function.C_CONVENTION);
} else if (callingConvention == INativeFunction.CallingConventionStdcall) {
options.put(Library.OPTION_CALLING_CONVENTION,
Function.ALT_CONVENTION);
} else {
throw new IllegalArgumentException("illegal calling convention");
}
options.put(Library.OPTION_OPEN_FLAGS, -1);
return new JnaNativeLibrary(this, name, options);
}
示例7: onWindows
import com.sun.jna.Function; //导入依赖的package包/类
public static void onWindows() {
// Windows taskbar fix: provideAppUserModelID
try {
NativeLibrary lib = NativeLibrary.getInstance("shell32");
Function function = lib.getFunction("SetCurrentProcessExplicitAppUserModelID");
Object[] args = {new WString(APPID)};
function.invokeInt(args);
} catch (Error e) {
return;
} catch (Exception x) {
return;
}
}
示例8: SECKFMGetPublicKey
import com.sun.jna.Function; //导入依赖的package包/类
public native short SECKFMGetPublicKey(
Memory pName,
short Function,
short Flags,
IntByReference rethPubKey);
示例9: _readdir
import com.sun.jna.Function; //导入依赖的package包/类
@FuseMethod
final int _readdir(final String path, final Pointer buf, final Pointer fillFunction, final TypeOff offset,
final StructFuseFileInfo info)
{
return readdir(path, new DirectoryFillerImpl(buf, Function.getFunction(fillFunction)));
}
示例10: DirectoryFillerImpl
import com.sun.jna.Function; //导入依赖的package包/类
DirectoryFillerImpl(final Pointer buf, final Function nativeFunction)
{
this.buf = buf;
this.nativeFunction = nativeFunction;
add(currentDirectory, parentDirectory);
}
示例11: getFunction
import com.sun.jna.Function; //导入依赖的package包/类
@Override
public INativeFunction getFunction(String name) {
Function function = getLibrary().getFunction(name);
return new JnaNativeFunction(function);
}
示例12: JnaNativeFunction
import com.sun.jna.Function; //导入依赖的package包/类
public JnaNativeFunction(Function function) {
this.function = function;
}
示例13: getFunction
import com.sun.jna.Function; //导入依赖的package包/类
protected Function getFunction() {
return function;
}