When will FindControl use the Objectfromhwnd function? --VCL difficult to debug, add a log function, record the time

Source: Internet
Author: User

Isdelphihandle
Findvclwindow
function Isvclcontrol (handle:hwnd): Boolean;
function FindControl (handle:hwnd): Twincontrol;
function Findvclwindow (const pos:tpoint): Twincontrol;

functionFindControl (Handle:hwnd): Twincontrol;varOwningprocess:dword;beginResult:=Nil; if(Handle <>0) and(GetWindowThreadProcessId (Handle, owningprocess) <>0) and(owningprocess= GetCurrentProcessId) Then  begin    ifGlobalfindatom (PChar (controlatomstring)) = Controlatom ThenResult:=Pointer (Getprop (Handle, Makeintatom (Controlatom)))ElseResult:=Objectfromhwnd (Handle); End;End;functionObjectfromhwnd (Handle:hwnd): Twincontrol;varOwningprocess:dword;begin  if(GetWindowThreadProcessId (Handle, owningprocess) <>0) and(owningprocess= GetCurrentProcessId) ThenResult:= Pointer (SendMessage (Handle, Rm_getobjectinstance,0,0))  ElseResult:=Nil;End;

I measured it, whether the drag control is placed on the form, or dynamically generated control, is a pointer to the Delphi object through the Getprop method. So when do you use Marvellous's Objectfromhwnd function?

Clue or click TButton after the occurrence, because Levi's book mentions this point ~

When will FindControl use the Objectfromhwnd function? --VCL difficult to debug, add a log function, record the time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.