WinItemize() returns a truncated headline

Started by werner.foerster, June 22, 2020, 07:53:37 AM

Previous topic - Next topic

werner.foerster

Dear WinBatch-Users,

I would like to read out the family name, first name and a file number from a window heading (e.g. OUTPUT FROM USER: Donald Trump, AKZ: 47110815).

If I have a short name, the command WinItemize () returns the complete heading line and all works fine. If I have a very long name, then the number at the end of the heading is incomplete (e.g. I only get the value 4711 back).

What can I do to get the full headline of the window?

Best regards from germany/bavaria

td

Assuming you are using a recent version of WinBatch, WinItemize has a Window title limit of 2049 Unicode characters so it will truncate Window titles longer than that 2049 characters. If you believe your window title is less than 2049 characters, your title could have an embedded tab character delimiter.  You can tell if the latter is the case by checking for the window title being spread across two items in the function's returned item list.

If your window does have a title longer than 2049 characters, you could have the WinItemize function return each window's "winid" along with its truncated title.  You would then need to convert the "winid" to a "real" window handle using the WinIdConvert function.  Once you have the window handle you could use either the Control Manager extender's "cWndInfo" function or the WIL DllCall function to call the Win32 "GetWindowTextLength" and "GetWindowText" functions to get the full text of the window of interest.

It reads more complicated than it actually is but if you believe that your window's text length it longer than 2049 characters and you need help coding the above, just say so.

WinIdConvert:
https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/WinIdConvert.htm

DllCall:
https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/WILAK_D__026.htm

cWinInfo:
https://docs.winbatch.com/mergedProjects/ControlManager/CTRLMGR/CTRLMGR_C__005.htm

Here is an example script that shows how to implement your own version of WinItemize that can have a much bigger text limit:
https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/DllCall~Information+DllCall~With~Callback~Example.txt
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade