Skip to content

Commit

Permalink
Add BringWindowToTop to User32
Browse files Browse the repository at this point in the history
  • Loading branch information
kahgoh committed Jun 4, 2021
1 parent b7b48c9 commit 058eb9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/User32.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ public interface User32 extends StdCallLibrary, WinUser, WinNT {
*/
boolean EnumThreadWindows(int dwThreadId, WNDENUMPROC lpEnumFunc, Pointer data);


/**
* Brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If
* the window is a child window, the top-level parent window associated with the child window is activated.
*
* @param hWnd
* A handle to the window to bring to the top of the Z order.
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
* To get extended error information, call GetLastError.
*/
boolean BringWindowToTop(HWND hWnd);

/**
* The FlashWindowEx function flashes the specified window. It does not
* change the active state of the window.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ public void testGetActiveWindow() {
assertNull("GetActiveWindow result should be null (there is no active window)", result);
}

@Test
public void testBringWindowToTop() {
boolean result = User32.INSTANCE.BringWindowToTop(null);
assertFalse("BringWindowToTop result should be false", result);
}

@Test
public void testSendMessage() {
DesktopWindow explorerProc = getWindowByProcessPath("explorer.exe");
Expand Down

0 comments on commit 058eb9b

Please sign in to comment.