internal static string BuildAccKey(System.IntPtr accObj, int vmId)
 {
     System.Text.StringBuilder builder = new System.Text.StringBuilder();
     if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero))
     {
         try
         {
             System.IntPtr ptr  = JavaAccNativeMethods.getTopLevelObject(vmId, accObj);
             System.IntPtr hWnd = JavaAccNativeMethods.getHWNDFromAccessibleContext(vmId, ptr);
             builder.AppendFormat("{0}.{1}.{2:X8}", (int)GetRoleID(accObj, vmId), (int)vmId, (int)hWnd.ToInt32());
             LPRECT lpRect = new LPRECT();
             Win32NativeMethods.GetWindowRect(hWnd, ref lpRect);
             AccessibleContextInfo accContextInfo = new AccessibleContextInfo();
             JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo);
             int num    = (int)(accContextInfo.x - lpRect.Left);
             int num2   = (int)(accContextInfo.y - lpRect.Top);
             int width  = accContextInfo.width;
             int height = accContextInfo.height;
             builder.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, ".{0},{1},{2},{3}", new object[] { (int)num, (int)num2, (int)width, (int)height });
         }
         catch (System.Exception exception)
         {
             if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception))
             {
                 throw;
             }
         }
     }
     return(builder.ToString());
 }
示例#2
0
        internal static Rectangle GetRelAccLocation(IAccessible accObj, int childId)
        {
            IntPtr windowFromIAccessible = GetWindowFromIAccessible(accObj);
            LPRECT lpRect = new LPRECT();

            Win32NativeMethods.GetWindowRect(windowFromIAccessible, ref lpRect);
            Rectangle accLocation = GetAccLocation(accObj, childId);

            return(new Rectangle(lpRect.Left - accLocation.X, lpRect.Top - accLocation.Y, accLocation.Width, accLocation.Height));
        }
示例#3
0
 public static System.IntPtr FindWindowByPosition(System.IntPtr hWndParent, int processId, int threadId, int x, int y, bool ignoreProcThread)
 {
     _CurrWindowComparer = delegate(System.IntPtr hWnd) {
         LPPOINT lpPoint = new LPPOINT();
         LPRECT  lpRect  = new LPRECT();
         Win32NativeMethods.GetWindowRect(hWnd, ref lpRect);
         lpPoint.X = lpRect.Left;
         lpPoint.Y = lpRect.Top;
         Win32NativeMethods.ScreenToClient(hWndParent, ref lpPoint);
         return((bool)(((ignoreProcThread || IsHwndOnProcThread(hWnd, processId, threadId)) && ((int)lpPoint.X).Equals(x)) && ((int)lpPoint.Y).Equals(y)));
     };
     return(FindWindowViaBfs(hWndParent));
 }