com.sun.jna.Native.getComponentPointer()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(433)

本文整理了Java中com.sun.jna.Native.getComponentPointer()方法的一些代码示例,展示了Native.getComponentPointer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Native.getComponentPointer()方法的具体详情如下:
包路径:com.sun.jna.Native
类名称:Native
方法名:getComponentPointer

Native.getComponentPointer介绍

[英]Utility method to get the native window pointer for a heavyweight Java Component as a Pointer value. This method is primarily for w32, which uses the HANDLE type (actually void *) to identify windows.
[中]获取重量级Java组件的本机窗口指针作为指针值的实用方法。此方法主要用于w32,它使用HANDLE类型(实际上是void *)来标识窗口。

代码示例

代码示例来源:origin: com.sun.jna/jna

/** Utility method to get the native window pointer for a Java 
 * {@link Window} as a {@link Pointer} value.  This method is primarily for 
 * w32, which uses the <code>HANDLE</code> type (actually 
 * <code>void *</code>) to identify windows. 
 * @throws HeadlessException if the current VM is running headless 
 */
public static Pointer getWindowPointer(Window w) throws HeadlessException {
  return getComponentPointer(w);
}

代码示例来源:origin: Exslims/MercuryTrade

private static WinDef.HWND getHWnd(Component w) {
  WinDef.HWND hwnd = new WinDef.HWND();
  hwnd.setPointer(Native.getComponentPointer(w));
  return hwnd;
}

代码示例来源:origin: net.java.dev.jna/jna-platform

private HWND getHWnd(Component w) {
  HWND hwnd = new HWND();
  hwnd.setPointer(Native.getComponentPointer(w));
  return hwnd;
}

代码示例来源:origin: net.java.dev.jna/platform

private HWND getHWnd(Component w) {
  HWND hwnd = new HWND();
  hwnd.setPointer(Native.getComponentPointer(w));
  return hwnd;
}

代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java

/**
 * Sets the native window for the {@link Element} to use to display video.
 *
 * @param window A native window to use to display video, or <tt>null</tt> to
 * stop using the previously set window.
 * @deprecated use {@link org.gstreamer.swing.XOverlaySwing#setWindowHandle(java.awt.Component)} instead
 */
@Deprecated
public void setWindowHandle(java.awt.Component window) {
  if (window == null) {
    setWindowHandle(0);
    return;
  }
  if (window.isLightweight())
    throw new IllegalArgumentException("Component must be a native window");
  if (Platform.isWindows())
    GSTXOVERLAY_API.gst_x_overlay_set_window_handle(this, Native.getComponentPointer(window));
  else
    setWindowHandle(Native.getComponentID(window));
}

代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java

/**
   * Sets the native window for the {@link Element} to use to display video.
   *
   * @param window A native window to use to display video, or <tt>null</tt> to
   * stop using the previously set window.
   */
  public void setWindowHandle(java.awt.Component window) {
    
    long nativeWindow = 0;

    if (window != null) {
    
      if (window.isLightweight()) {
        throw new IllegalArgumentException("Component must be a native window");
      }
    
      if (Platform.isWindows()) {
        nativeWindow = Pointer.nativeValue(Native.getComponentPointer(window));
      } else {
        nativeWindow = Native.getComponentID(window);
      }
    }
         setWindowHandle(nativeWindow);
  }
}

代码示例来源:origin: gstreamer-java/gst1-java-core

/**
 * Sets the native window for the {@link Element} to use to display video.
 *
 * @param window A native window to use to display video, or <tt>null</tt> to
 * stop using the previously set window.
 */
public void setWindowHandle(java.awt.Component window) {
  if (window == null) {
    setWindowHandle(0);
    return;
  }
  if (window.isLightweight())
    throw new IllegalArgumentException("Component must be a native window");
  if (Platform.isWindows())
    GSTXOVERLAY_API.gst_x_overlay_set_window_handle(this, Native.getComponentPointer(window));
  else
    setWindowHandle(Native.getComponentID(window));
}

代码示例来源:origin: gstreamer-java/gst1-java-core

/**
 * Sets the native window for the {@link Element} to use to display video.
 *
 * @param window A native window to use to display video, or <tt>null</tt> to
 * stop using the previously set window.
 */
public void setWindowHandle(java.awt.Component window) {
  if (window == null) {
    setWindowHandle(0);
    return;
  }
  if (window.isLightweight())
    throw new IllegalArgumentException("Component must be a native window");
  if (Platform.isWindows())
    GSTVIDEOOVERLAY_API.gst_video_overlay_set_window_handle(this, Native.getComponentPointer(window));
  else
    setWindowHandle(Native.getComponentID(window));
}

代码示例来源:origin: com.github.axet/desktop

public WindowsPowerXP() {
  if (!Kernel32Ex.INSTANCE.SetProcessShutdownParameters(0x03FF, 0))
    throw new GetLastErrorException();
  mp.start();
  if (!Kernel32Ex.INSTANCE.SetConsoleCtrlHandler(hr, true))
    throw new GetLastErrorException();
  final HWND hwnd = new HWND();
  f.pack();
  hwnd.setPointer(Native.getComponentPointer(f));
  int wID = User32.INSTANCE.GetWindowThreadProcessId(hwnd, null);
  hHook = User32.INSTANCE.SetWindowsHookEx(WH_CALLWNDPROC, hp, null, wID);
  if (hHook == null)
    throw new GetLastErrorException();
}

相关文章

Native类方法