Tracking a changing window title

Started by cssyphus, August 22, 2022, 05:26:31 AM

Previous topic - Next topic

cssyphus

I need to keep track of a changing window title.

First, I get a handle to the window using hMyWin = winIdGet("the window I want")

After that, I check using if isDefined(hMyWin) . . .

But how can I query the window title for that handle, other than switching to that window and using something like currWinTitle = winGetActive()?

Is there a way to query that window title in the background - i.e. without switching the focus to that window?

I am hoping there might be a command like

currWinTitle = winTitle(hMyWIn)

I should know the answer, but am having a memory brown out on this matter.

Age.. belier of the adage "that wot don't kill us makes us stronger."


td

There are several ways to obtain the title of a window in WinBatch. One approach is to use the Control Manager's cWindInfo function. Of course, you also need to use the WIL WinIdConvert function to change the Window ID to a raw handle first.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

That did the trick, thanks Tony


_win = `Window I wana get`
AddExtender(`C:\Program Files (x86)\WinBatch\System\wwctl44i.dll`)
if winExist(_win)
_hWin = winIdGet(_win)
_hhWin = cWinIDConvert(_hWin)
_winTitle = cWndInfo(_hhWin, 0)
message(``, _winTitle)
endif

td

Note that WIL has its own function called WinIdConvert. You do not need to use the control manager version anymore.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade