Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


"32-bit value associated with the text"

Posted on 2004-05-02
Medium Priority
Last Modified: 2007-12-19
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?
Question by:RobK6364
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 48

Expert Comment

ID: 10975095
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.

Author Comment

ID: 10975124
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"

Author Comment

ID: 10975157
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?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 48

Expert Comment

ID: 10975303
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.

Author Comment

ID: 10978279
^^ 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?  
LVL 48

Accepted Solution

AlexFM earned 600 total points
ID: 10979279
1) I think it's impossible.
2) This information exists, but how to find it? There is no general way to do this.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question