Solved

get type cyrsor position at screen from microsoft word and any enviroment for type text

Posted on 2006-07-05
1
199 Views
Last Modified: 2010-04-05
hi
i want to show a form when user type anything in microsoft word or any word proccesor enviroment sych as MS Notepad or . and need to get type cursor position at screen for displaying my form from this position. please help me for get type cursor position at screen.
and so sorry for my bad english ;-)
best regards.
0
Comment
Question by:mahdiparak
1 Comment
 
LVL 10

Accepted Solution

by:
atul_parmar earned 500 total points
Comment Utility
Hi, try this

var
  p : TPoint;
  hWord, Pid1, Pid2 : THandle;
  WordTitle : String;
begin
  WordTitle := 'Document1 - Microsoft Word';
  hWord := FindWindow(nil, PChar(WordTitle));
  if (hWord = 0) or (hWord <>  GetForegroundWindow) then Exit;
  Pid1 := GetWindowThreadProcessId(hWord, nil);
  Pid2 := GetCurrentThreadId;
  AttachThreadInput(Pid1, Pid2, True);
  if GetCaretPos(p) then
    if Windows.ClientToScreen(hWord, p) then
      MoveWindow(Handle, p.X, p.Y, Width, Height, True);
end;
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now