Getting text of a statusbar-part won't work

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by skypa.

Hi,

this is more an API question, but I hope someone can help me though. I am trying to read out the text of a statusbar (mscomctls_statusbar32), used i.e. at the bottom of the InternetExplorer. Now my problem is, to read out every part of a statusbar, because GetWindowText (or SendMessage_(handle, #WM_GETTEXT) will only work for the first part of the statusbar.
After some searching, I finally found the SB_GETTEXT and SB_SETTEXT variables for the SendMessage API. But if I try to read out the second part of a statusbar, for example, reading out the length of the text (with SB_GETTEXTLENGTH) will work, but not getting the text of it.

length = SendMessage_(handle, #SB_GETTEXTLENGTH, 5,0) ; 5 stands for the 5th part of the statusbar
a$ = Space(length)
SendMessage_(handle, #SB_GETTEXT,length, @a$) ; an this doesn't work

Thanks for help in advance

skypa

Edited by - skypa on 06 August 2002 20:19:35
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Art Sentinel.

Hi skypa,

Firstly did you make a typing error?

length = SendMessage(handle, #SB_GETTEXTLENGTH, 5,0)

should be:

length = SendMessage_(handle, #SB_GETTEXTLENGTH, 5,0)

Secondly, in your code snipplet, you stated that 5 stands for the 5th part of the statusbar? However, according to the WinAPI Docs, the wParam of SB_GETTEXTLENGTH is a Zero-based index of the part from which to retrieve text. This would make the 5th part of the status bar '4'?

Take care.


- Art Sentinel
http://www.artsentinel.net

--------------

Top Ten Reasons Not To Procrastinate:


Coming Soon...

Edited by - Art Sentinel on 06 August 2002 20:07:47
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by skypa.

Hi,

first of all, thanks for the answer. Second of all, I made a typing error, of course SendMessage_ is correct.
In addition to this, I think "Zero-Based" means, zero included, because when I tried to get the textlength of the 5th part of the InternetExplorer statusbar, the return value was correct.
However, it doesn't really matter whether 5 or 4, because I tried all the numbers, but I don't get the #sb_gettext to work
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Art Sentinel.

skypa, after much testing I found your solution! (It is actually deceptively simple.) I am writing a tutorial for you right now. I will post it in the Tricks n Tips section in a day or so. :)

Take care.


- Art Sentinel
http://www.artsentinel.net

--------------

Top Ten Reasons Not To Procrastinate:


Coming Soon...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by skypa.
skypa, after much testing I found your solution! (It is actually deceptively simple.) I am writing a tutorial for you right now. I will post it in the Tricks n Tips section in a day or so. :)
Thanks a lot.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Art Sentinel.

skypa, the tutorial is up, in case you have not seen it yet. I hope this helps you. :)

Take care.


- Art Sentinel
http://www.artsentinel.net

--------------

Top Ten Reasons Not To Procrastinate:


Coming Soon...
Post Reply