Solved

"32-bit value associated with the text"

Posted on 2004-05-02
9
323 Views
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:
'    0, SBT_NOBORDERS, SBT_POPOUT, SBT_RTLREADING
'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?
0
Comment
Question by:RobK6364
  • 3
  • 3
9 Comments
 
LVL 48

Expert Comment

by:AlexFM
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.
0
 
LVL 1

Author Comment

by:RobK6364
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"
0
 
LVL 1

Author Comment

by:RobK6364
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?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 48

Expert Comment

by:AlexFM
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.
0
 
LVL 1

Author Comment

by:RobK6364
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?  
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 150 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.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now