Solved

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

Posted on 2006-07-05
1
205 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
ID: 17043282
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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