Get screen position of a control handle returned by RoboScripter

Started by cssyphus, February 04, 2020, 08:06:12 AM

Previous topic - Next topic

cssyphus

I used RoboScripter to get a handle to a window control (a button on an IrfanView dialog).  I wish to somehow get the coords of the button so that I can know how close the mouse is to the button at any given moment.

I've looked at the various cWnd functions and nothing leaps out at me as to how to accomplish this. Anyone have a suggestion or idea?

My code to get the button:


if winExist(`Browse Subfolders~`)
_winIrfanBrowseSubs = cWndByWndSpec(`#32770`,`i_view32`,8,3129,1,2,65535,65535,3131,65535,3064)
_btnIrfanUseFolder = cWndByID(_winIrfanBrowseSubs, 1)
;;;_btnCoords = HOW_DO_I_DO_THIS?
endif

Is this a pandemic... or an IQ test? newz.icu

td

Search on the term "getwindowrect" in the Tech Database.  "GetWindowRect" is a Win32 API function the returns the window rectangle and there are numerous examples.  The results are in screen Pixels so you may need to convert them into virtual coordinates depending on your intended purpose.


But one example:
https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Window~Manipulation+Active~Window~Height~and~Width~in~Pixels.txt
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

snowsnowsnow

This looks a lot like this thread that I started a while back:

https://forum.winbatch.com/index.php?topic=2273.msg11869#msg11869

"td" gave a nice solution in that thread that worked very well for me (even though he said it was just a rough first draft...)

td

Forgot all about that one... Probably need to add that bit of script to the Tech Database.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

Is this a pandemic... or an IQ test? newz.icu