public static mshtml.IHTMLElement2 GetWindowWidthAndHeight(IntPtr hwnd, mshtml.IHTMLDocument2 doc, ref int clientWidth, ref int clientHeight, ref int scrollWidth, ref int scrollHeight) { HTMLDocumentClass class2 = doc as HTMLDocumentClass; mshtml.IHTMLElement2 documentElement = null; if (class2 != null) { documentElement = class2.documentElement as mshtml.IHTMLElement2; if (documentElement != null) { clientWidth = documentElement.clientWidth; clientHeight = documentElement.clientHeight; } } else { Rect lpRect = new Rect(); documentElement = doc.body as mshtml.IHTMLElement2; WindowUtil.GetWindowRect(hwnd, out lpRect); if (documentElement != null) { clientWidth = lpRect.Right - lpRect.Left; clientHeight = lpRect.Bottom - lpRect.Top; } } if (documentElement != null) { scrollWidth = documentElement.scrollWidth; scrollHeight = documentElement.scrollHeight; } return(documentElement); }
public static int GetWindowMessageLParam(IntPtr hwnd, Point mousePoint) { Rect lpRect = new Rect(); WindowUtil.GetWindowRect(hwnd, out lpRect); return(((lpRect.Top + mousePoint.Y) << 0x10) + (lpRect.Left + mousePoint.X)); }