Jump to content
Sign in to follow this  

Reading Statusbar

Recommended Posts

Ok, this is kind of hard to explain...but here it goes.

I was using 'v3.2.12.0' and everthing was working fine...until I switched to 'v3.2.12.1'.

At work we use a phone application. The statusbar of this application displays the current status of the representative.



AgentStatus: Ready

AgentStatus: NotReady

AgentStatus: Talking

and so on...

This is the command I used in the older version to read the status:

$handle = ControlGetHandle("Agent Desktop", "", "[CLASS:WindowsForms10.msctls_statusbar32; INSTANCE:1]")

$agentstatus = _GUICtrlStatusBar_GetText($handle, 3)

Eversince I have switched to the newer version, using the above command does not display the full information...ie: instead of showing 'AgentStatus: Ready', it only shows 'Agentstatus'.

Is there now a problem with this command or do I need to add some extra lines to fix this issue.

Edited by Monty

Share this post

Link to post
Share on other sites

Replace _GUICtrlStatusBar_GetText() in "C:\Program Files\AutoIt3\Include\guistatusbar.au3" by this fix.

This was fixed in (7th June, 2008) (Beta)


- Fixed #321: _GUICtrlStatusBar_GetText buffer length for Unicode

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlStatusBar_GetText
; Description ...: Retrieves the text from the specified part
; Syntax.........: _GUICtrlStatusBar_GetText($hWnd, $iPart)
; Parameters ....: $hWnd        - Handle to the control
;                  $iPart       - Zero based part index
; Return values .: Success      - Part text
; Author ........: Paul Campbell (PaulIA)
; Modified.......:
; Remarks .......:
; Related .......: _GUICtrlStatusBar_SetText
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func _GUICtrlStatusBar_GetText($hWnd, $iPart)
 If $Debug_SB Then _GUICtrlStatusBar_ValidateClassName($hWnd)
 Local $iBuffer, $pBuffer, $tBuffer, $pMemory, $tMemMap
 Local $fUnicode = _GUICtrlStatusBar_GetUnicodeFormat($hWnd)
 $iBuffer = _GUICtrlStatusBar_GetTextLength($hWnd, $iPart)
 If $iBuffer = 0 Then Return ""

 If $fUnicode Then
    $iBuffer *= 2
    $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
    $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
 $pBuffer = DllStructGetPtr($tBuffer)
 If _WinAPI_InProcess($hWnd, $__ghSBLastWnd) Then
    If $fUnicode Then
        _SendMessage($hWnd, $SB_GETTEXTW, $iPart, $pBuffer, 0, "wparam", "ptr")
        _SendMessage($hWnd, $SB_GETTEXT, $iPart, $pBuffer, 0, "wparam", "ptr")
    $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
    If $fUnicode Then
        _SendMessage($hWnd, $SB_GETTEXTW, $iPart, $pMemory, 0, "wparam", "ptr")
        _SendMessage($hWnd, $SB_GETTEXT, $iPart, $pMemory, 0, "wparam", "ptr")
    _MemRead($tMemMap, $pMemory, $pBuffer, $iBuffer)
 Return DllStructGetData($tBuffer, "Text")
EndFunc   ;==>_GUICtrlStatusBar_GetText

Share this post

Link to post
Share on other sites

Thanks for this. Was not aware and thought I was going crazy. Will try first thing tomorrow morning at work.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...