Place the cursor to the box that user want by setting tab order correctly
hit enter to do some default value by handling control key press event
use this.width, this.height to get window position
//to get active window size
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr GetForegroundWindow();
private static IntPtr GetCurrActiveWindow()
{
IntPtr handle = IntPtr.Zero;
return GetForegroundWindow();
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
public static RECT GetCurrActiveWindowSize()
{
RECT size = new RECT();
try
{
GetWindowRect(GetCurrActiveWindow(), out size);
}
catch (Exception ex)
{
TraceMessage.Write("QTMUtility.GetCurrActiveWindowSize", ex.Message, TraceMessageType.Exception);
}
return size;
}