Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Handle from Window Position, but without focus

Posted on 2006-10-20
2
Medium Priority
?
203 Views
Last Modified: 2010-04-05
I need to get a handle from control in determinated window, and this window don necessarily have a focus.

If I use WindowFromPoint(ControlPoint), they return the handle only if the control has focus.

I need to get the Handle, using coordinates relatives to ParentWindow of control, something like that:

GetHandleFromPosition(ParentHandle, PositionRelativeOnParent)

Thanks,

Felipe.
0
Comment
Question by:felipesch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 28

Assisted Solution

by:TName
TName earned 1500 total points
ID: 17778031
0
 
LVL 28

Accepted Solution

by:
TName earned 1500 total points
ID: 17778984
Ok, this works for me:

procedure TForm1.Button1Click(Sender: TObject);
var
hMain, hSub :HWND;
len:Integer;
Cap: String;
begin
 hMain:=FindWindow(nil,'TestApp');
 if hMain<>0 then begin
   hSub:=ChildWindowfromPoint(hMain, Point(200,200));
   if hSub<>0 then begin
      len := SendMessage(hSub, WM_GETTEXTLENGTH, 0, 0)+1;
      SetLength(Cap,len);
      SendMessage(hSub, WM_GETTEXT, Len, longint(Cap));
      ShowMessage(Cap);
     end;
 end;
end;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

670 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