Gandalf said:
i'm looking for a function/way to get window class position in the
screen.
any idea?
Well, you could use pinvoke and get the position of a Process' main window
handle.
protected override void OnLoad(EventArgs e)
{
Process[] processes = Process.GetProcesses();
foreach (Process p in processes)
{
IntPtr hWnd = p.MainWindowHandle;
RECT rect;
if (GetWindowRect(hWnd, out rect))
MessageBox.Show("Main window of " + p.ProcessName + " : " + rect);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
public override string ToString()
{
return String.Format("Left: {0}, Top: {1}, Width: {2}, Height: {3}",
Left, Top, Right - Left, Bottom - Top);
}
}
[DllImport("user32.dll")]
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);