• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

"32-bit value associated with the text"

hello experts...

i am trying to read the status bar of another process, and have had success getting the text of most statusbars.  for instance, i can read all 3 panels of Windows Explorer's statusbar.  however, i am actually trying to read the status bar panels of the program FlashFXP.  There are 7 panels, and i can read panels 3-7 no problem; however, when i sendmessage SB_GETTEXT to panel 1 or 2... something different happens.  Normally (for panel 3-7, or for the Windows Explorer panels) the returned value of the SB_GETTEXT SendMessage is the text length; however, the result for panels 1 and 2 seems to be a pointer to a string... but i'm not sure... when i try to read the buffer and convert the string to unicode... it comes out "garbled" and almost looks like an encrypted string.  But to make things more confusing, I do see readable text within the garbage characters... but only for panel 1... it's all garbage for panel 2.

...having read the following passage about SB_GETTEXT, i am under the impression that panels 1 and 2 of FlashFXP is of the "style" of SBT_OWNERDRAW... which "returns the 32-bit value associated with the text instead of the length and operation type."

"'The SB_GETTEXT message retrieves the text from the specified
'part of a status window.
'wParam = Zero-based index of the part from which to retrieve text.
'lParam = Pointer to the null-terminated string buffer that receives the text.
'Returns a 32-bit value that consists of two 16-bit values. The
'low word specifies the length, in characters, of the text. The high
'word specifies the type of operation used to draw the text. The
'type can be one of the following values:
'If the text has the SBT_OWNERDRAW drawing type, this message
'returns the 32-bit value associated with the text instead of
'the length and operation type."

as i mentioned above, i thought that meant it was a pointer to a string... i'm not that used to working with those, but my functions that worked on pointers in previous projects do not work for these "pointers"... could this "32-bit value associated with the text" something other than a pointer? if so, how can i extract the string?
  • 3
  • 3
1 Solution
Use SB_GETTEXTLENGTH message to detect whether status bar pane is owner-drawn. If high word of returned value is SBT_OWNERDRAW, it's impossible to know pane text. The 32-bit value associated with the text returned by SB_GETTEXT maybe any information - pointer, handle, number etc. This information is passed to the function which draws status bar pane, and used by the way unknown for external program.
RobK6364Author Commented:
on further analysis... i am 100% sure that panel 1 and 2 are SBT_OWNERDRAW... and that the others are NOT.  so i just need help understanding how to pull the string from the "32-bit value associated with the text"
RobK6364Author Commented:
hmmm... any explanation as to why I can retreive partially readable text from panel 1?  i have not tried yet, but i beleive i could parse the string to remove the garbage characters and get panel 1... but i still need panel 2.

alex, you say that the returned value is passed to a function to draw the status bar... i had read something similiar to that before, pertaining to SB_SETTEXT... do you think it could be possible to use that number to recreate the statusbar in my VB program and read it there instead of the external program?
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

From MSDN Article "Status Bars":

To define a window part as owner-drawn, send the SB_SETTEXT message to the status bar, specifying the part and the SBT_OWNERDRAW drawing technique. When SBT_OWNERDRAW is specified, the lParam parameter is a 32-bit application-defined value that the application can use when drawing the part. For example, you can specify a font handle, a bitmap handle, an address of a string, and so on.   << !!!

When a status bar needs to draw an owner-drawn part, it sends the WM_DRAWITEM message to the parent window. The wParam parameter of the message is the child window identifier of the status bar, and the lParam parameter is the address of a DRAWITEMSTRUCT structure. The parent window uses the information in the structure to draw the part. For an owner-drawn part of a status bar, DRAWITEMSTRUCT contains the following information:

itemData  Application-defined 32-bit value specified in the lParam parameter of the SB_SETTEXT message.

As you can see, only programmer who developed the program with status bar knows what is this 32-bits value (it may be not used at all). You can only guess (successfully or not). Generally, it is impossible to retreive owner-drawn status bar pane text.

>>  i am 100% sure that panel 1 and 2 are SBT_OWNERDRAW

Test this using SB_GETTEXTLENGTH message as described in my first post.
RobK6364Author Commented:
^^ i did test for SBT_OWNERDRAW using SB_GETTEXTLENGTH...

... so you dont think it could be someone possible to use that number to recreate the statusbar in my VB program and read it there instead of the external program?  i guess maybe i could, but the text still might not be right?

also, do you think it is at all likely that the information contained in panel 2 (transfer speed) could be found in another control/handle, besides the statusbar?  
1) I think it's impossible.
2) This information exists, but how to find it? There is no general way to do this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now