Jump to content

_GUICtrlListViewGetColumnHeaderText


Recommended Posts

Does anyone understand

Gary Frosts

Func _GUICtrlListViewSetColumnHeaderText($h_listview, $i_col, $s_text)
    If Not _IsClassName ($h_listview, "SysListView32") Then Return SetError($LV_ERR, $LV_ERR, False)
    Local $struct_LVCOLUMN, $ret, $struct_String

    $struct_String = DllStructCreate("char[" & StringLen($s_text) + 1 & "]")
    If @error Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
    DllStructSetData($struct_String, 1, $s_text)
    $struct_LVCOLUMN = DllStructCreate($LVCOLUMN)
    If @error Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
    DllStructSetData($struct_LVCOLUMN, $LVC_MASK, $LVCF_TEXT)
    If IsHWnd($h_listview) Then
        Local $sBuffer_pointer = DllStructGetPtr($struct_String)
        Local $column_struct_pointer = DllStructGetPtr($struct_LVCOLUMN)
        Local $i_Size = DllStructGetSize($struct_LVCOLUMN)
        Local $struct_MemMap
        Local $Memory_pointer = _MemInit ($h_listview, $i_Size + StringLen($s_text) + 1, $struct_MemMap)
        If @error Then
            _MemFree ($struct_MemMap)
            Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
        EndIf
        Local $string_Memory_pointer = $Memory_pointer + $i_Size
        DllStructSetData($struct_LVCOLUMN, $LVC_PSZTEXT, $string_Memory_pointer)
        _MemWrite ($struct_MemMap, $column_struct_pointer)
        If @error Then
            _MemFree ($struct_MemMap)
            Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
        EndIf
        _MemWrite ($struct_MemMap, $sBuffer_pointer, $string_Memory_pointer, StringLen($s_text) + 1)
        If @error Then
            _MemFree ($struct_MemMap)
            Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
        EndIf
        $ret = _SendMessage($h_listview, $LVM_SETCOLUMNA, $i_col, $Memory_pointer)
        If @error Then
            _MemFree ($struct_MemMap)
            Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
        EndIf
        _MemFree ($struct_MemMap)
        If @error Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
    Else
        DllStructSetData($struct_LVCOLUMN, $LVC_PSZTEXT, DllStructGetPtr($struct_String))
        $ret = GUICtrlSendMsg($h_listview, $LVM_SETCOLUMNA, $i_col, DllStructGetPtr($struct_LVCOLUMN))
    EndIf
    Return $ret
EndFunc   ;==>_GUICtrlListViewSetColumnHeaderText

If so, I would think we could reverse it... right?

A decision is a powerful thing
Link to comment
Share on other sites

I want to do the exact opposite of _GUICtrlListViewSetColumnHeaderText ()

I want to return the Column Header Text of a particular column.

Auto3Lib:

A3LHeader.au3 - _Header_GetItemText()

#include <A3LHeader.au3>

$win = WinGetHandle("some title")
$header = ControlGetHandle($win, "", "SysHeader321")
$pocet_sloupcu = _Header_GetItemCount($header)

$text = ''
$radek = ''

for $i = 0 to $pocet_sloupcu - 1
    $radek &= _Header_GetItemText($header, $i) & @TAB
next
$text = StringTrimRight($radek,1) &  @CRLF

MsgBox(0,'columns',$text)
Link to comment
Share on other sites

Only five simple chars in my name and how much peoples have problem with it ... :)

dang it! Sorry Zedna... it's interesting that such a simple name gets misseplled (maybe that's the cognitive science person in me pondering)

A decision is a powerful thing
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...