Page 1 of 1

Get the text from statusbar

Posted: Thu Mar 25, 2004 1:22 pm
by Le Soldat Inconnu
Hello,

I have a matter to get the get the text of a statusbar.
i hope to get the statusbar text from another windows (not get the statusbar text from my window but get the statusbar text from the purebasic editor for example)

Code: Select all

Delay(1000)

; Get the Foreground Window
WindowE = GetForegroundWindow_()

; Get the handle of the statusbar
hwndStatus = FindWindowEx_(WindowE, 0, "msctls_statusbar32", 0)

; get the number of field
NbField = SendMessage_(hwndStatus, #SB_GETPARTS, 50, 0)

Debug "Type of operation used To draw the text :"
Debug Str(0) + " : The text is drawn with a border to appear lower than the plane of the window."
Debug Str(#SBT_NOBORDERS) + " : The text is drawn without borders."
Debug Str(#SBT_POPOUT) + " : The text is drawn with a border to appear higher than the plane of the window."

Debug ""

Debug "Number of parts  = " + Str(NbField)

Debug ""

For n = 0 To NbField - 1
  
  ; Get the text length
  length.l = SendMessage_(hwndStatus, #SB_GETTEXTLENGTH, n, 0)
  
  Low = length & $FFFF
  High = length >> 16 & $FFFF
  
  Debug "Text length = " + Str(Low)
  Debug "Text draw with = " + Str(High)
  
  ; get the Text
  Text.s = Space(Low)
  r = SendMessage_(hwndStatus, #SB_GETTEXT, n, Text)
  
  Debug "Text = " + Text
Next
I can get the number of parts of the statusbar, the text lenght but when I get the the text, my function returns ""

Could you help me, thanks :wink:

Posted: Sat Mar 27, 2004 10:52 am
by Le Soldat Inconnu
No idea ???

Posted: Sun Sep 05, 2004 6:31 am
by MrMat
Hi,

Did you get this working? I've been trying to do something very similar and have come up against the same problem. Does anyone know why the code above doesn't get the text?

Thank you very much,
Mat

Posted: Sun Sep 05, 2004 6:52 am
by MrMat
To answer my own question, it looks like SB_GETTEXT doesn't work across processes, but WM_GETTEXT does so using that will do for my needs :-)

Re: Get the text from statusbar

Posted: Mon Mar 10, 2025 12:06 pm
by BarryG
Request done as I need to get the StatusBar text too -> https://www.purebasic.fr/english/viewtopic.php?t=86486