Get Window handle from point

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sinisa

    #1

    Get Window handle from point

    Hi, first sorry on awkward english.

    I'll try to illustrate my problem:
    (dont know how will this look on your scrren)

    |--Dialog----------------------------------------------------------------------------|
    |
    |
    | |-------groupbox----
    -----------------------------------------------------| |
    | |
    | |
    | |
    | |
    | | |-------------------------------|
    | |
    | | | Button P(x,y) |
    | |
    | | |-------------------------------|
    | |
    | |
    | |
    | |
    | |
    |
    |-------------------------------------------------------------------------------|
    |
    |
    |
    |
    |
    |-----------------------------------------------------------------------------------------|


    P(x,y) represents (point) position of cursor with coordinates x,y
    , and that point
    lies on button.

    Button and groupbox are childs from dialog.

    My problem is how to get handle form Button.

    i tryed something like:
    (this is only part of code)

    HWND hwDlg;
    HWND hwGroup;
    HWND hwButt;

    hwGroup = :: WindowFromPoint (p);
    /* this is working, i get valid handle*/

    hwDlg = ::GetParent(hwG roup);
    /* this is also working */

    hwButt = ::RealChildWind owFromPoint(hwD lg,p);
    /* but here i always get NULL */

    as i understand from msdn RealChildWindow FromPoint should return child
    handle if
    window(in this case button) if point is "over" window , and window is
    in transparent area of groupbox .

    any advice is most welcome.



Working...