com.sun.jna.Function Java Examples

The following examples show how to use com.sun.jna.Function. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Win7TaskBar.java    From consulo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #2
Source File: Jdotxt.java    From jdotxt with GNU General Public License v3.0 5 votes vote down vote up
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;
	}
}
 
Example #3
Source File: NotesNativeAPI.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public native short SECKFMGetPublicKey(
Memory pName,
short Function,
short Flags,
IntByReference rethPubKey);