You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package com.sinvon.api.utils;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef;
public class WindowTopUtil {
// Topmost window handle
public static final WinDef.HWND HWND_TOPMOST = new WinDef.HWND(new Pointer(-1));
public static void setWindowTop(String windowTitle) {
if (windowTitle == null || windowTitle.isEmpty()) {
System.out.println("The provided window title is null or empty; unable to set the window to topmost."); // debug
return;
}
User32 user32 = User32.INSTANCE;
// Find window handle
WinDef.HWND hWnd = user32.FindWindow(null, windowTitle);
if (hWnd == null) {
System.out.println("Failed to retrieve the window handle; unable to set the window to topmost.");
return;
}
// Set window to topmost
user32.SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, User32.SWP_NOMOVE | User32.SWP_NOSIZE);
}
}
main.java
// set window title
String windowTitle = "My Webview App";
wv.setTitle(windowTitle);
// set WebView Window Top
WindowTopUtil.setWindowTop(windowTitle);
it works.
The text was updated successfully, but these errors were encountered:
I wrote a plan , hope will be useful to you.
depandency
WindowTopUtil.java
main.java
it works.
The text was updated successfully, but these errors were encountered: