Solved

"32-bit value associated with the text"

Posted on 2004-05-02
9
330 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
[X]
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
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 15 hours left to enroll

623 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