GetCaretPos help needed (get keyboard possition)
-
Hi all, i am using the API : [DllImport("user32.dll")]public static extern int GetCaretPos(ref Point lpPoint); what i'm trying to do is the show contextMenu above the KB cursor. it's working good with MSN messenger and Notepad (the function returns the cursor's possition in the active window) but, in other programs like:MSWord,Yahoo messenger it returns(X=, Y=0) how is it possible? Sincerely, Ran.
R.Z
-
Hi all, i am using the API : [DllImport("user32.dll")]public static extern int GetCaretPos(ref Point lpPoint); what i'm trying to do is the show contextMenu above the KB cursor. it's working good with MSN messenger and Notepad (the function returns the cursor's possition in the active window) but, in other programs like:MSWord,Yahoo messenger it returns(X=, Y=0) how is it possible? Sincerely, Ran.
R.Z
-
How do u work with MSN messager and notepad, i want to get your some source code. Please ,Thank u very much
Sorry ...
Thats the code that give you on msn and notepad. i'm looking to work also on Word and Yahoo... private Point getCaretLocation() { IntPtr hFocus = (IntPtr)GetForegroundWindow(); IntPtr hFore; IntPtr id=IntPtr.Zero; if (hFocus != IntPtr.Zero) { hFore= (IntPtr)GetForegroundWindow (); AttachThreadInput((int)GetWindowThreadProcessId((int)hFore, id), GetCurrentThreadId(), 1); hFocus = (IntPtr)GetForegroundWindow(); Point mypoint=Point.Empty; GetCaretPos(ref mypoint); Console.WriteLine(mypoint.ToString()); ClientToScreen (hFocus, ref mypoint); return mypoint; } return Point.Empty; }
R.Z