?
Solved

Get the handle of a disabled item on another form.

Posted on 2005-03-07
4
Medium Priority
?
204 Views
Last Modified: 2010-04-05
Hi.

I have a code that get the handle of controls in another form when the mouse pass over them.

GetCursorPos(P);
Edit1.Text := IntToStr(WindowFromPoint(P));
GetClassName(StrToInt(Edit1.Text),Buff,255);
Edit2.Text := Buff;
Window Name :=GetWindowText(StrToInt(Edit1.Text),Buff,255);
If Buff <> '' then Edit3.Text := buff;
.......
.......
This code doesnt work for items that are disabled...
Is it possible to see those controls that are disabled?

Thanks in advance.
0
Comment
Question by:CodedK
[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
4 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 1200 total points
ID: 13480879
You will need to use ChildWindowFromPoint to get those handles. An example function which will obtain the handle you are after:

function GetWindowAtCursor: HWND;
var  hwndChild:     HWND;
     ptScreen:      TPoint;
begin

  // Get cursor pos
  if GetCursorPos(ptScreen) then
  begin
     // Get window at point
     result:=WindowFromPoint(ptScreen);
     // Check result
     if (result <> 0) then
     begin
        // Convert point to child coords
        ScreenToClient(result, ptScreen);
        // Attempt to get the child window (enabled, disabled, hidden or otherwise)
        hwndChild:=ChildWindowFromPoint(result, ptScreen);
        // Check child handle
        if (hwndChild <> 0) then result:=hwndChild;
     end;
  end
  else
     result:=0

end;

Regards,
Russell
0
 
LVL 16

Author Comment

by:CodedK
ID: 13481023
Thanks very much ...
I'll give it a try tomorrow.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 13481056
No problem, and no rush....

Russell
0
 
LVL 16

Author Comment

by:CodedK
ID: 13485018
Thank u very much Russell.
Works perfect... :)
I'll get back for the other question in a while..
0

Featured Post

Independent Software Vendors: 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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