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!
Who is Participating?
Kent OlsenConnect With a Mentor Data 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! :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.