I have an application that acts like an on screen keyboard, I need it to know if there is a keyboard cursor (caret) active any where, so the keyboard will set to active.
It is easy by searching for the caret position, since it should be larger than 0
GUITHREADINFO lpgui = new GUITHREADINFO();
IntPtr fore = GetForegroundWindow();
uint tpid = GetWindowThreadProcessId(fore, IntPtr.Zero);
lpgui.cbSize = Marshal.SizeOf(lpgui.GetType());
bool flag = GetGUIThreadInfo(tpid, out lpgui);
WINDOWINFO pwi = new WINDOWINFO();
pwi.cbSize = (uint)Marshal.SizeOf(pwi.GetType());
GetWindowInfo((IntPtr)lpgui.hwndCaret, ref pwi);
if (flag)
{
if (!(lpgui.rcCaret.Location.X == 0 && lpgui.rcCaret.Location.Y == 0))
{
//TODO
}
}