Package org.zkoss.ztl.jna

Examples of org.zkoss.ztl.jna.User32Extra


        case retrieveLastRemoteControlLogs:
          results = new RetrieveLastRemoteControlLogsCommand().execute();
          break;
        case captureEntirePageScreenshotToString:
          if (values.size() > 1) {
                final User32Extra user32Extra = User32Extra.INSTANCE;
                final String title = values.get(0);
                final String browserName = values.get(1);
                threadLocal.set(null); // reset
                HWND w = user32Extra.GetForegroundWindow();
                if (w != null) {
                  byte[] titleBuff = new byte[1024];
                  User32Extra u32extra = User32Extra.INSTANCE;
                    u32extra.GetWindowTextA(w, titleBuff, titleBuff.length);
                    String winTitle = Native.toString(titleBuff);
                    if (winTitle.indexOf(title) >= 0 && winTitle.toLowerCase().indexOf(
                        (browserName.toLowerCase().indexOf("ie") >=0 ? "internet explorer" : browserName)) >= 0) {
                      LOGGER.info("** Match " + browserName + " **");
                      threadLocal.set(w);
                    }
                }
               
                if (threadLocal.get() == null) {
                  user32Extra.EnumWindows(new WndEnumProc() {
                      public boolean callback(HWND hWnd, int lParam) {
                          // skip IE issue, because it may have two same winTitle
                          if (threadLocal.get() != null) return true;
                         
                          byte[] titleBuff = new byte[1024];
                          User32Extra u32extra = User32Extra.INSTANCE;
                          u32extra.GetWindowTextA(hWnd, titleBuff, titleBuff.length);
                          String winTitle = Native.toString(titleBuff);
                         
                         
                          if (winTitle.indexOf(title) >= 0 && winTitle.toLowerCase().indexOf(
                              (browserName.toLowerCase().indexOf("ie") >=0 ? "internet explorer" : browserName)) >= 0) {
                           
                            // ignore IE's empty window instance
                            if (browserName.toLowerCase().indexOf("ie") >= 0) {
                                  RECT bounds = new RECT();
                                  org.zkoss.ztl.jna.User32Extra.INSTANCE.GetClientRect(hWnd, bounds);
 
                                  int width = bounds.right - bounds.left;
                                  int height = bounds.bottom - bounds.top;
                                  if (width == 0 || height == 0) {
                                    LOGGER.debug("** size is 0 :[width: " + width + ", height: " + height + "]**");
                                    return true;
                                  }
                            }
                              u32extra.ShowWindow(hWnd, 9);
                              u32extra.SetForegroundWindow(hWnd);
                              threadLocal.set(hWnd);
                          }
                         
                          return true;
                      }
View Full Code Here

TOP

Related Classes of org.zkoss.ztl.jna.User32Extra

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.