Java 类com.sun.jna.platform.win32.User32 实例源码

项目:NanoUI    文件:TaskBar.java   
private void createHotKeys() {
    Thread keys = new Thread(() -> {
        keysThreadID = Kernel32.INSTANCE.GetCurrentThreadId();
        User32.INSTANCE.RegisterHotKey(new HWND(Pointer.NULL), 1, MOD_WIN | MOD_NOREPEAT, VK_E);
        MSG msg = new MSG();
        while (User32.INSTANCE.GetMessage(msg, new HWND(Pointer.NULL), 0, 0) != 0 && running) {
            if (msg.message == WM_HOTKEY) {
                try {
                    switch (msg.wParam.intValue()) {
                    case 1:
                        new ProcessBuilder("explorer.exe", ",").start();
                        break;
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        User32.INSTANCE.UnregisterHotKey(Pointer.NULL, 1);
    });
    keys.start();
}
项目:NanoUI    文件:TaskBar.java   
@Override
public void dispose() {
    super.dispose();
    window.dispose(AppUI.getMainWindow());
    if (ENABLED_NOTIFICATIONS)
        TrayHook.INSTANCE.UnregisterSystemTrayHook();
    User32Ext.INSTANCE.SystemParametersInfo(SPI.SPI_SETWORKAREA, 0, old.getPointer(), 0);
    User32Ext.INSTANCE.DeregisterShellHookWindow(local);
    if (noExplorer) {
        backgroundWindow.getWindow().closeDisplay();
        User32.INSTANCE.PostThreadMessage(keysThreadID, WM_QUIT, new WPARAM(), new LPARAM());
        User32Ext.INSTANCE.SystemParametersInfo(SPI.SPI_SETMINIMIZEDMETRICS, oldMM.size(), oldMM.getPointer(), 0);
    } else {
        if (taskbar != null)
            User32.INSTANCE.ShowWindow(taskbar, SW_SHOW);
    }
}
项目:ui-automation    文件:UtilsTest.java   
@Test
public void testStartProcess_Starts_Notepad() {
    try {
        Utils.startProcess("notepad.exe");

        this.andRest();

        WinDef.HWND hwnd = User32.INSTANCE.FindWindow(null, getLocal("notepad.title"));

        assertTrue("startProcess - no process", hwnd != null);
    } catch (IOException io) {
        assertTrue("startProcess: " + io.getMessage(), false);
    }

    assertTrue("startProcess", true);
}
项目:ui-automation    文件:UtilsTest.java   
@Test
public void testQuitProcess_Quits_Notepad() {
    try {
        Utils.startProcess("notepad.exe");

        WinDef.HWND hwnd = User32.INSTANCE.FindWindow(null, getLocal("notepad.title"));

        if (hwnd != null) {
            Utils.quitProcess(hwnd);
        }
    } catch (IOException io) {
        assertTrue("quitProcess: " + io.getMessage(), false);
    }

    assertTrue("quitProcess", true);
}
项目:ui-automation    文件:UtilsTest.java   
@Test
public void testCloseWindow_Closes_Notepad() {
    try {
        Utils.startProcess("notepad.exe");

        WinDef.HWND hwnd = User32.INSTANCE.FindWindow(null, getLocal("notepad.title"));

        if (hwnd != null) {
            Utils.closeWindow(hwnd);
        }
    } catch (IOException io) {
        assertTrue("quitProcess: " + io.getMessage(), false);
    }

    assertTrue("quitProcess", true);
}
项目:MercuryTrade    文件:ChatHelper.java   
private void gameToFront() {
    User32.INSTANCE.EnumWindows((hWnd, arg1) -> {
        char[] className = new char[512];
        User32.INSTANCE.GetClassName(hWnd, className, 512);
        String wText = Native.toString(className);

        if (wText.isEmpty()) {
            return true;
        }
        if (wText.equals("POEWindowClass")) {
            User32.INSTANCE.SetForegroundWindow(hWnd);
            return false;
        }
        return true;
    }, null);
}
项目:trezor-ssh-agent    文件:SSHAgent.java   
private HWND createWindowsProcess() {

        WString windowClass = new WString(APPNAME);
        HMODULE hInst = libK.GetModuleHandle("");
        WNDCLASSEX wndclass = new WNDCLASSEX();
        wndclass.hInstance = hInst;
        wndclass.lpfnWndProc = SSHAgent.this;
        wndclass.lpszClassName = windowClass;
        // register window class
        libU.RegisterClassEx(wndclass);
        getLastError();
        // create new window
        HWND winprocess = libU
                .CreateWindowEx(
                        User32.WS_OVERLAPPED,
                        windowClass,
                        APPNAME,
                        0, 0, 0, 0, 0,
                        null, // WM_DEVICECHANGE contradicts parent=WinUser.HWND_MESSAGE
                        null, hInst, null);

        mutex = libK.CreateMutex(null, false, MUTEX_NAME);
        return winprocess;
    }
项目:synergynet3.1    文件:Win7NativeTouchSource.java   
/**
 * Gets the native window handles.
 *
 * @return the native window handles
 */
private void getNativeWindowHandles()
{

    SwingUtilities.invokeLater(new Runnable()
    {
        @Override
        public void run()
        {
            HWND fgWindow = User32.INSTANCE.GetForegroundWindow();
            int titleLength = User32.INSTANCE.GetWindowTextLength(fgWindow) + 1;
            char[] title = new char[titleLength];
            User32.INSTANCE.GetWindowText(fgWindow, title, titleLength);
            int awtCanvasHandle = (int) Pointer.nativeValue(fgWindow.getPointer());
            setApplicationHandle(awtCanvasHandle);
        }
    });
}
项目:synthuse-src    文件:KeyboardHook.java   
public void createHotKeysHook() {
    registerAllHotKeys();
    //User32Ex.instance.MsgWaitForMultipleObjects(0, Pointer.NULL, true, INFINITE, QS_HOTKEY);

    //System.out.println("starting message loop");
    MSG msg = new MSG();
    try {

        while (!quit) {
            User32.INSTANCE.PeekMessage(msg, null, 0, 0, 1);
            if (msg.message == User32.WM_HOTKEY){ // && msg.wParam.intValue() == 1
                //System.out.println("Hot key pressed " + msg.wParam);
                TargetKeyPress target = findTargetKeyPressById(msg.wParam.intValue());
                if (target != null)
                    events.keyPressed(target);
                msg = new MSG(); //must clear msg so it doesn't repeat
            }
            Thread.sleep(10);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    unregisterAllHotKeys();
    //System.out.println("message loop stopped");
}
项目:synthuse-src    文件:KeyboardHook.java   
private void registerAllHotKeys() // must register hot keys in the same thread that is watching for hotkey messages
{
    //System.out.println("registering hotkeys");
    for (TargetKeyPress tkp : KeyboardHook.targetList) {
        //BOOL WINAPI RegisterHotKey(HWND hWnd, int id, UINT fsModifiers, UINT vk);
        int modifiers = User32.MOD_NOREPEAT;
        if (tkp.withShift)
            modifiers = modifiers | User32.MOD_SHIFT;
        if (tkp.withCtrl)
            modifiers = modifiers | User32.MOD_CONTROL;
        if (tkp.withAlt)
            modifiers = modifiers | User32.MOD_ALT;
        //System.out.println("RegisterHotKey " + tkp.idNumber + "," + modifiers + ", " + tkp.targetKeyCode);

        if (!User32.INSTANCE.RegisterHotKey(new WinDef.HWND(Pointer.NULL), tkp.idNumber, modifiers, tkp.targetKeyCode))
        {
            System.out.println("Couldn't register hotkey " + tkp.targetKeyCode);
        }
    }
}
项目:JAutoItX    文件:WinTest.java   
@Test
public void getHandle() {
    Assert.assertNull(Win.getHandle(NOTEPAD_TITLE));
    Assert.assertNull(Win.getHandle((HWND) null));

    // run notepad
    int pid = runNotepad();

    HWND hWnd = Win.getHandle_(NOTEPAD_TITLE);
    Assert.assertNotNull(hWnd);

    assertEquals(
            AutoItX.hwndToHandle(User32.INSTANCE.GetForegroundWindow()),
            Win.getHandle(NOTEPAD_TITLE));
    assertEquals(
            AutoItX.hwndToHandle(User32.INSTANCE.GetForegroundWindow()),
            Win.getHandle(hWnd));

    // close notepad
    closeNotepad(pid);

    Assert.assertNull(Win.getHandle(NOTEPAD_TITLE));
    Assert.assertNull(Win.getHandle(hWnd));
}
项目:jpexs-decompiler    文件:Win32ProcessTools.java   
public static BufferedImage extractExeIcon(String fullExeFile, int index, boolean large) {
    PointerByReference iconsLargeRef = new PointerByReference();
    PointerByReference iconsSmallRef = new PointerByReference();
    int cnt = Shell32.INSTANCE.ExtractIconEx(fullExeFile, index, iconsLargeRef, iconsSmallRef, new WinDef.UINT(1)).intValue();
    if (cnt == 0) {
        return null;
    }
    Pointer iconsLarge = iconsLargeRef.getPointer();
    Pointer iconsSmall = iconsSmallRef.getPointer();

    WinDef.HICON icon;
    if (large) {
        icon = new WinDef.HICON(iconsLarge.getPointer(0));
    } else {
        icon = new WinDef.HICON(iconsSmall.getPointer(0));
    }

    BufferedImage ic = iconToImage(icon);

    User32.INSTANCE.DestroyIcon(icon);
    return ic;
}
项目:MonitorBrightness    文件:MonitorInfoDemo.java   
/**
 * @param args (ignored)
 */
public static void main(String[] args)
{
    System.out.println("Installed Physical Monitors: " + User32.INSTANCE.GetSystemMetrics(WinUser.SM_CMONITORS));

    User32.INSTANCE.EnumDisplayMonitors(null, null, new MONITORENUMPROC() {

        @Override
        public int apply(HMONITOR hMonitor, HDC hdc, RECT rect, LPARAM lparam)
        {
            enumerate(hMonitor);

            return 1;
        }

    }, new LPARAM(0));
}
项目:consulo    文件:RemoteDesktopDetector.java   
private void updateState() {
  if (!myFailureDetected) {
    try {
      // This might not work in all cases, but hopefully is a more reliable method than the current one (checking for font smoothing)
      // see https://msdn.microsoft.com/en-us/library/aa380798%28v=vs.85%29.aspx
      boolean newValue = User32.INSTANCE.GetSystemMetrics(0x1000) != 0; // 0x1000 is SM_REMOTESESSION
      LOG.debug("Detected remote desktop: ", newValue);
      if (newValue != myRemoteDesktopConnected) {
        myRemoteDesktopConnected = newValue;
        if (myRemoteDesktopConnected) {
          // We postpone notification to avoid recursive initialization of RemoteDesktopDetector
          // (in case it's initialized by request from com.intellij.notification.EventLog)
          ApplicationManager.getApplication().invokeLater(() -> Notifications.Bus.notify(
                  NOTIFICATION_GROUP
                          .createNotification(ApplicationBundle.message("remote.desktop.detected.message"), NotificationType.INFORMATION)
                          .setTitle(ApplicationBundle.message("remote.desktop.detected.title"))));
        }
      }
    }
    catch (Throwable e) {
      myRemoteDesktopConnected = false;
      myFailureDetected = true;
      LOG.warn("Error while calling GetSystemMetrics", e);
    }
  }
}
项目:HouseControl    文件:ActivateWindow.java   
public static HWND findWind(final String name) {
 final User32 user32 = User32.INSTANCE;
 title=null;
 wind = null;
 user32.EnumWindows(new WNDENUMPROC() {
     public boolean callback(HWND hWnd, Pointer arg1) {
         char[] windowText = new char[512];
         user32.GetWindowText(hWnd, windowText, 512);
         String wText = Native.toString(windowText);
         if (wText.contains(name)) {
          title = wText;
          wind = hWnd;
          return false;
         }
         return true;
     }
 }, null);
 return wind;
}
项目:Motunautr    文件:Main.java   
private static void createWindow(final File f) {
    SwingUtilities.invokeLater(() -> {
        if (!f.isDirectory()) // if the file was changed or deleted before this could execute, exit
            return;
        final BDWindow w = new BDWindow(f);
        windows.add(w);
        w.pack();
        w.setVisible(true);

        threadPool.execute(() -> {
            // sets whether the windows blur the background behind them
            Settings.INSTANCE.blurBackground.addListener(enabled -> {
                ch.njol.betterdesktop.win32.User32.enableBlur(w, enabled);
            });

            // disables the windows from being hidden when "peeking" the desktop
            Settings.INSTANCE.excludeFromPeek.addListener(enabled -> {
                Dwmapi.setExcludedFromPeek(w, enabled);
            });

            // prevents "show desktop" button from hiding the windows
            if (Settings.INSTANCE.showOnDesktop.get()) {
                final HWND progman = User32.INSTANCE.FindWindow("Progman", "Program Manager");
                User32.INSTANCE.SetWindowLongPtr(new HWND(Native.getComponentPointer(w)), WinUser.GWL_HWNDPARENT, progman.getPointer());
                // the following is required so that this setting actually does something - no idea why though
                try {
                    Thread.sleep(100);
                } catch (final InterruptedException e1) {}
                w.setAlwaysOnTop(true);
                w.setAlwaysOnTop(false);
            }
        });
    });
}
项目:poker-bot    文件:User32Utils.java   
public static WindowHolder findAndShowWindow(String className, String windowsName) {
    HWND hWnd = user32.FindWindow(className, windowsName);
    if (hWnd == null) {
        System.out.println("there is no running calc app");
        return null;
    }
    user32.ShowWindow(hWnd, User32.SW_SHOW);
    WINDOWINFO pwi = new WINDOWINFO();
    WindowHolder windowHolder = new WindowHolder(hWnd, pwi);
    user32.SetForegroundWindow(hWnd);
    return windowHolder;
}
项目:poker-bot    文件:WindowSearchCalback.java   
@Override
public boolean callback(HWND hWnd, Pointer data) {
    char[] textBuffer = new char[512];
    char[] textBuffer2 = new char[512];
    User32.INSTANCE.GetClassName(hWnd, textBuffer, 512);
    User32.INSTANCE.GetWindowText(hWnd, textBuffer2, 512);
    String wText = Native.toString(textBuffer);
    String wText2 = Native.toString(textBuffer2);
    childList.add(hWnd);
    System.out.println("className: " + wText + " title: " + wText2);
    return true;
}
项目:NanoUI    文件:Background.java   
@Override
public void init() {
    super.init();
    WindowManager.createWindow(handle, window, true);

    long hwndGLFW = glfwGetWin32Window(window.getID());
    HWND hwnd = new HWND(Pointer.createConstant(hwndGLFW));

    WindowProc proc = new WindowProc() {

        @Override
        public long invoke(long hw, int uMsg, long wParam, long lParam) {
            if (hw == hwndGLFW)
                switch (uMsg) {
                case WM_WINDOWPOSCHANGING:
                    WINDOWPOS pos = new WINDOWPOS(new Pointer(lParam));
                    pos.flags |= SWP_NOZORDER | SWP_NOACTIVATE;
                    pos.write();
                    break;
                }
            return org.lwjgl.system.windows.User32.DefWindowProc(hw, uMsg, wParam, lParam);
        }
    };
    User32.INSTANCE.SetWindowLongPtr(hwnd, GWL_WNDPROC, Pointer.createConstant(proc.address()));
    User32Ext.INSTANCE.SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
    User32Ext.INSTANCE.SetWindowLongPtr(hwnd, GWL_STYLE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

    User32.INSTANCE.SetWindowPos(hwnd, new HWND(Pointer.createConstant(HWND_BOTTOM)), 0, 0, 0, 0,
            SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
    wallpaper = window.getResourceLoader().loadNVGTexture(getCurrentDesktopWallpaper(), true);
    TaskManager.addTask(() -> window.setVisible(true));
}
项目:NanoUI    文件:Util.java   
public static String getAppUserModelId(HWND hwnd) {
    IntByReference processID = new IntByReference();
    User32.INSTANCE.GetWindowThreadProcessId(hwnd, processID);
    HANDLE hProcess = Kernel32.INSTANCE.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, processID.getValue());
    UINTByReference length = new UINTByReference();
    Kernel32Ext.INSTANCE.GetApplicationUserModelId(hProcess, length, null);
    char[] modelID = new char[length.getValue().intValue()];
    Kernel32Ext.INSTANCE.GetApplicationUserModelId(hProcess, length, modelID);
    return new String(Native.toString(modelID));
}
项目:NanoUI    文件:NotificationsWindow.java   
@Override
public void update(float delta) {
    compWin.update(delta, window);
    while (!iconsTask.isEmpty()) {
        iconsTask.poll().run();
    }
    for (Component comp : iconsMap.values()) {
        NotificationButton btn = (NotificationButton) comp;
        if (!User32.INSTANCE.IsWindow(btn.iconData.hWnd)) {
            iconDeleted(btn.iconData);
        }
    }
}
项目:ui-automation    文件:Utils.java   
private static void ensureWinApiInstances() {
    if (user32 == null) {
           user32 = User32.INSTANCE;
       }
    if (kernel32 == null) {
        kernel32 = Kernel32.INSTANCE;
       }
}
项目:ui-automation    文件:AutomationWindow.java   
/**
 * Constructor for the AutomationWindow.
 * @param builder The builder
 */
public AutomationWindow (ElementBuilder builder) {
    super(builder);

    if (builder.getHasUser32()) {
        this.user32 = builder.getUser32();
    } else {
        this.user32 = User32.INSTANCE;
    }
    this.windowPattern = builder.getWindow();
}
项目:ui-automation    文件:AutomationWindow.java   
/**
 * Sets transparency of the window.
 * @param alpha 0..255 alpha attribute.
 * @throws Win32Exception WIN32 call has failed.
 * @throws AutomationException Something is wrong in automation.
 */
public void setTransparency(int alpha) throws Win32Exception, AutomationException {
    WinDef.HWND hwnd = this.getNativeWindowHandle();

    if (user32.SetWindowLong(hwnd, User32.GWL_EXSTYLE, User32.WS_EX_LAYERED) == 0) {
        throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
    }

    if (!user32.SetLayeredWindowAttributes(hwnd, 0, (byte)alpha, User32.LWA_ALPHA)) {
        throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
    }
}
项目:ui-automation    文件:AutomationApplication.java   
/**
 * Waits for the application to accept input, i.e. not be idle.
 * @param timeout Timeout to wait for.
 */
public void waitForInputIdle(final int timeout) {
    if (user32 == null) {
        user32 = User32.INSTANCE;
    }
    user32.WaitForInputIdle(this.handle, new WinDef.DWORD(timeout));
}
项目:ui-automation    文件:AutomationApplication.java   
/**
 * Waits for the application to accept input, i.e. not be idle, with maximum timeout.
 */
public void waitForInputIdle() {
    if (user32 == null) {
        user32 = User32.INSTANCE;
    }

    user32.WaitForInputIdle(this.handle, INFINITE_TIMEOUT);
}
项目:ui-automation    文件:AutomationApplication.java   
/**
 * Closes the window.
 *
 * @param title Title of the window to close.
 */
public void close(final String title) {
    if (user32 == null) {
        user32 = User32.INSTANCE;
    }

    WinDef.HWND hwnd = user32.FindWindow(null, title);

    if (hwnd != null) {
        Utils.closeWindow(hwnd);
    }
}
项目:ui-automation    文件:AutomationApplication.java   
/**
 * Closes the window.
 *
 * @param titlePattern a pattern matching the title of the window to close
 */
public void close(final Pattern titlePattern) {
    if (user32 == null) {
        user32 = User32.INSTANCE;
    }

    WinDef.HWND hwnd = Utils.findWindow(null, titlePattern);

    if (hwnd != null) {
        Utils.closeWindow(hwnd);
    }
}
项目:ui-automation    文件:AutomationApplication.java   
/**
 * Quits the process.
 *
 * @param title Title of the window of the process to quit.
 */
public void quit(final String title) {
    if (user32 == null) {
        user32 = User32.INSTANCE;
    }

    WinDef.HWND hwnd = user32.FindWindow(null, title);

    if (hwnd != null) {
        Utils.quitProcess(hwnd);
    }
}
项目:ui-automation    文件:AutomationApplication.java   
/**
 * Quits the process.
 *
 * @param titlePattern a pattern matching the title of the window of the process to quit
 */
public void quit(final Pattern titlePattern) {
    if (user32 == null) {
        user32 = User32.INSTANCE;
    }

    final WinDef.HWND handle = Utils.findWindow(null, titlePattern);

    if (handle != null) {
        Utils.quitProcess(handle);
    }
}
项目:ui-automation    文件:BaseAutomationTest.java   
@After
public void cleanUp() {

    while (true) {
        WinDef.HWND hwnd = User32.INSTANCE.FindWindow(null, getLocal("notepad.title"));
        if (hwnd == null) {
            break;
        }
        Utils.closeWindow(hwnd);
    }
}
项目:ui-automation    文件:UtilsTest.java   
@After
public void tearDown() {
    // Must be a better way of doing this????
    this.andRest();

    WinDef.HWND hwnd = User32.INSTANCE.FindWindow(null, getLocal("notepad.title"));

    if (hwnd != null) {
        Utils.quitProcess(hwnd);
    }
}
项目:ui-automation    文件:AutomationApplicationTest.java   
@Test
public void testClose_Calls_FindWindow() throws Exception {
    User32 user32 = Mockito.mock(User32.class);

    AutomationApplication app = new AutomationApplication(
            new ElementBuilder(element).handle(handle).user32(user32).attached(true));

    app.close("Untitled - Notepad");

    verify(user32, atLeastOnce()).FindWindow(any(), any());
}
项目:ui-automation    文件:AutomationApplicationTest.java   
@Test
public void testClose_with_RegexPattern_Calls_EnumWindows() throws Exception {
    User32 user32 = Mockito.mock(User32.class);
    UtilsTest.setUser32(user32);

    AutomationApplication app = new AutomationApplication(
            new ElementBuilder(element).handle(handle).attached(true).user32(user32));

    app.close(Pattern.compile("Untitled - Notepad"));

    verify(user32, atLeastOnce()).EnumWindows(any(), any());
}
项目:ui-automation    文件:AutomationApplicationTest.java   
@Test
public void testQuit_Calls_FindWindow() throws Exception {
    User32 user32 = Mockito.mock(User32.class);

    AutomationApplication app = new AutomationApplication(
            new ElementBuilder(element).handle(handle).attached(true).user32(user32));

    app.quit("Untitled - Notepad");

    verify(user32, atLeastOnce()).FindWindow(any(), any());
}
项目:ui-automation    文件:AutomationApplicationTest.java   
@Test
public void testQuit_with_RegexPattern_Calls_EnumWindows() throws Exception {
    User32 user32 = Mockito.mock(User32.class);
    UtilsTest.setUser32(user32);

    AutomationApplication app = new AutomationApplication(
            new ElementBuilder(element).handle(handle).attached(true).user32(user32));

    app.quit(Pattern.compile("Untitled - Notepad"));

    verify(user32, atLeastOnce()).EnumWindows(any(), any());
}
项目:yajsw    文件:WindowsXPMouse.java   
public WindowsXPMouse()
{
    if (!Platform.isWindows())
    {
        throw new UnsupportedOperationException(
                "Not supported on this platform.");
    }
    USER32INST = User32.INSTANCE;
    KERNEL32INST = Kernel32.INSTANCE;
    mouseHook = hookTheMouse();
    Native.setProtected(true);

}
项目:MercuryTrade    文件:AbstractAdrFrame.java   
private void setTransparent(Component w) {
    this.componentHwnd = getHWnd(w);
    this.settingWl = User32.INSTANCE.GetWindowLong(componentHwnd, WinUser.GWL_EXSTYLE);
    int transparentWl = User32.INSTANCE.GetWindowLong(componentHwnd, WinUser.GWL_EXSTYLE) |
            WinUser.WS_EX_LAYERED |
            WinUser.WS_EX_TRANSPARENT;
    User32.INSTANCE.SetWindowLong(componentHwnd, WinUser.GWL_EXSTYLE, transparentWl);
}
项目:MercuryTrade    文件:TestOpaque.java   
private static void setTransparent(Component w) {
        WinDef.HWND hwnd = getHWnd(w);
        int wl = User32.INSTANCE.GetWindowLong(hwnd, WinUser.GWL_EXSTYLE);
//        wl = wl | WinUser.WS_EX_LAYERED | WinUser.WS_EX_TRANSPARENT;
        wl = wl | WinUser.WS_EX_LAYERED | WinUser.WS_EX_TRANSPARENT;
        User32.INSTANCE.SetWindowLong(hwnd, WinUser.GWL_EXSTYLE, wl);
    }
项目:MercuryTrade    文件:AppMain.java   
private static String getGamePath() {
    return WindowUtils.getAllWindows(false).stream().filter(window -> {
        char[] className = new char[512];
        User32.INSTANCE.GetClassName(window.getHWND(), className, 512);
        return Native.toString(className).equals("POEWindowClass");
    }).map(it -> {
        String filePath = it.getFilePath();
        return StringUtils.substringBeforeLast(filePath, "\\");
    }).findAny().orElse(null);
}