Get Window handle from point

S

Sinisa

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(hwGroup);
/* this is also working */

hwButt = ::RealChildWindowFromPoint(hwDlg,p);
/* but here i always get NULL */

as i understand from msdn RealChildWindowFromPoint 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.
 
H

Howard

You need to ask in a Windows newsgroup. The C+ language knows nothing about
windows or mouse coordinates.

-Howard
 
A

Artie Gold

Howard said:
You need to ask in a Windows newsgroup. The C+ language knows nothing about
windows or mouse coordinates.

....and we know nothing of the C+ language either! ;-)
[yeah, I know it's a typo...just couldn't resist!]

Cheers,
--ag
 
H

Howard

Artie Gold said:
Howard said:
You need to ask in a Windows newsgroup. The C+ language knows nothing
about windows or mouse coordinates.

...and we know nothing of the C+ language either! ;-)
[yeah, I know it's a typo...just couldn't resist!]

Cheers,
--ag

What...this isn't the C+ newsgroup??? Oh, crap... no wonder my programs
aren't working!

-Howard
 
M

Mike Wahler

Howard said:
Artie Gold said:
Howard said:
You need to ask in a Windows newsgroup. The C+ language knows nothing
about windows or mouse coordinates.

...and we know nothing of the C+ language either! ;-)
[yeah, I know it's a typo...just couldn't resist!]

Cheers,
--ag

What...this isn't the C+ newsgroup??? Oh, crap... no wonder my programs
aren't working!

I'm developing the C-squared language. A massive project
requiring much energy.

-Mike
 
M

Marcus Kwok

Mike Wahler said:
I'm developing the C-squared language. A massive project
requiring much energy.

Mike's C-squared = MC^2
Maybe you should just call it E.
 
M

Mike Wahler

Marcus Kwok said:
Mike's C-squared = MC^2
Maybe you should just call it E.

That was the point of my joke. (Someone else
has already created 'D').


-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top