Solved

"32-bit value associated with the text"

Posted on 2004-05-02
9
324 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

867 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

21 Experts available now in Live!

Get 1:1 Help Now