Beispiel #1
0
  public String GetWindowInfoXml() {

    final List<WindowInfo> infoList = new ArrayList<WindowInfo>();

    class ChildWindowCallback implements WinUser.WNDENUMPROC {
      public boolean callback(HWND hWnd, Pointer lParam) {
        infoList.add(new WindowInfo(hWnd, true));
        return true;
      }
    }
    class ParentWindowCallback implements WinUser.WNDENUMPROC {
      public boolean callback(HWND hWnd, Pointer lParam) {
        infoList.add(new WindowInfo(hWnd, false));
        user32.EnumChildWindows(hWnd, new ChildWindowCallback(), new Pointer(0));
        return true;
      }
    }
    user32.EnumWindows(new ParentWindowCallback(), 0);

    // convert list to string xml
    StringBuilder sb = new StringBuilder("");
    for (WindowInfo w : infoList) {
      // System.out.println(w);
      sb.append(w + "\r\n");
    }
    sb.append("count - " + infoList.size() + "\r\n");
    return sb.toString();
  }
Beispiel #2
0
 public boolean restoreWindow(HWND handle) {
   return user32.ShowWindow(handle, WinUser.SW_RESTORE);
 }
Beispiel #3
0
 public boolean minimizeWindow(HWND handle) {
   return user32.ShowWindow(handle, WinUser.SW_MINIMIZE);
 }
Beispiel #4
0
 public boolean showWindow(HWND handle) {
   return user32.ShowWindow(handle, WinUser.SW_SHOW);
 }
Beispiel #5
0
 public boolean activateWindow(HWND handle) {
   boolean result = user32.SetForegroundWindow(handle);
   return result;
 }
Beispiel #6
0
 public HWND findWindowByTitle(String title) {
   HWND handle = user32.FindWindow(null, title);
   return handle;
 }