[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

Get component object's access from active focused control

in a C++ Builder 6 code, I have this API call:

HWND hWnd edt = GetFocus();
dummy = GetClassName(hWnd, classname, 256);
AnsiString ClassNameA = classname;
if (ClassNameA == "TEdit")

and now I would ask you how I can get the component found as active focused? Something like (TEdit*) edt = (TEdit*)GetComponentFromhWnd(hWnd) so I can access to all properties?..

thanks a lot in advance!
1 Solution
Kent OlsenData Warehouse Architect / DBACommented:
Hi npuleio,

  Screen->ActiveControl will return a pointer to the control that has focus.

Good Luck,
npuleioAuthor Commented:
That's was right! I wonder how come I didn't found by myself that Screen->ActiveControl... plus I found also it has Screen->ActiveControl->ClassNameIs("TEdit") so I would save also some lines of code! Thanks Kdo! Have a great day! :-)

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now