Get component object's access from active focused control

Posted on 2007-10-15
Last Modified: 2013-11-17
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!
Question by:npuleio
    LVL 45

    Accepted Solution

    Hi npuleio,

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

    Good Luck,

    Author Comment

    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

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

      Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

    730 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now