internal void guessWindow(IGuesserListener listener, ManagedWinapi.Windows.SystemWindow window) { foreach (IWindowGuesser g in windowGuessers) { g.guess(listener, window); } }
void FindAndMoveMsgBox(string title, Form form) { //Moves a messagebox to the desired position Thread thr = new Thread(() => // create a new thread { IntPtr msgBox = IntPtr.Zero; // while there's no MessageBox, FindWindow returns IntPtr.Zero while ((msgBox = FindWindow(IntPtr.Zero, title)) == IntPtr.Zero) ; // after the while loop, msgBox is the handle of your MessageBox ManagedWinapi.Windows.SystemWindow msgBoxWindow = new ManagedWinapi.Windows.SystemWindow(msgBox); msgBoxWindow.Location = new Point(form.Location.X + (form.Size.Width - msgBoxWindow.Size.Width)/2, form.Location.Y + (form.Size.Height - msgBoxWindow.Size.Height)/2); }); thr.IsBackground = true; thr.Start(); // starts the thread }
public PointInfo(PointF MouseLocation) { _MouseLocation = Point.Round(MouseLocation); _Window = ManagedWinapi.Windows.SystemWindow.FromPointEx(_MouseLocation.X, _MouseLocation.Y, true, false); _WindowHandle = _Window.HWnd; }