Jump to content

Reading Statusbar


 Share

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.

Examples:

----------

AgentStatus: Ready

AgentStatus: NotReady

AgentStatus: Talking

and so on...

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

CODE
$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
Link to comment
Share on other sites

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

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

UDFs:

- 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 & "]")
 Else
    $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
 EndIf
 $pBuffer = DllStructGetPtr($tBuffer)
 If _WinAPI_InProcess($hWnd, $__ghSBLastWnd) Then
    If $fUnicode Then
        _SendMessage($hWnd, $SB_GETTEXTW, $iPart, $pBuffer, 0, "wparam", "ptr")
    Else
        _SendMessage($hWnd, $SB_GETTEXT, $iPart, $pBuffer, 0, "wparam", "ptr")
    EndIf
 Else
    $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
    If $fUnicode Then
        _SendMessage($hWnd, $SB_GETTEXTW, $iPart, $pMemory, 0, "wparam", "ptr")
    Else
        _SendMessage($hWnd, $SB_GETTEXT, $iPart, $pMemory, 0, "wparam", "ptr")
    EndIf
    _MemRead($tMemMap, $pMemory, $pBuffer, $iBuffer)
    _MemFree($tMemMap)
 EndIf
 Return DllStructGetData($tBuffer, "Text")
EndFunc   ;==>_GUICtrlStatusBar_GetText
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...