Tech Support > Microsoft Windows > Development Resources > Unequally identify a control under the mouse
Unequally identify a control under the mouse
Posted by Louis Cyphre on February 27th, 2007


Hi everybody,
is there any way to unequally identify a windows application control
(such as edit, button, radio, toolbar, menu, etc..) under the mouse? I
need an identifier that will remain unchanged after user restart the
application or reboot the OS. I tried to use the control resource id:


POINT mycursorpos;

::GetCursorPos(&mycursorpos);
CWnd* under = CWnd::WindowFromPoint(mycursorpos);

int resourceId = under->GetDlgCtrlID();

HWND client_hwnd = ::WindowFromPoint(mycursorpos);

int resourceId = ::GetDlgCtrlID(client_hwnd);


The above code has some problems:
- not always working, specially with toolbars and menus
- not working at all for application like Opera and Firefox
- no results on Java applications

Thanks in advance!

Posted by Louis Cyphre on March 27th, 2007


bump...


Similar Posts