Solved

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

Posted on 2006-07-05
1
203 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

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