Digging into the 2nd panel of a msctls_statusbar32 Question

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Randall
Junior Coder
Posts: 38
Joined: Fri Jan 13, 2012 4:39 am

Digging into the 2nd panel of a msctls_statusbar32 Question

Post by Randall » Sun Mar 04, 2012 8:47 am

Does anyone know how to retrieve the controltext of a msctls_statusbar32 window? (standard Microsoft Cstatus) While the GetControlText> works fine for just the text on the first panel, I actually need to get the text from the 2nd panel.

I am going to assume that this is going to take some VB programming to accomplish.

Randall

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 05, 2012 11:38 am

The first panel of a status bar is exposed as caption text, hence you can get it easily with GetControlText. But the rest requires lower level handling and API calls.

Simples solution is to use GetTextInRect. We can get the rectangular bounds of the status bar, then pass these to GetTextInRect to get all the text. Then parse out what you want:

E.g. this works against Notepad++ to get all the status bar text:

Code: Select all

GetTextInit
GetWindowHandle>Notepad++*,HWnd
FindObject>HWnd,msctls_statusbar32,,1,sbHWnd,l,t,r,b,captionText
GetTextInRect>l,t,r,b,AllStatusText
Trim>AllStatusText,AllStatusText
MessageModal>AllStatusText
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts