Jump to content
Sign in to follow this  

Listview column header text (NOT GUI)

Recommended Posts


This seems an obvious question but havent been able to find a similar question nor answer. How to get the text values from the column headers within a listview (NOT GUI)?

Share this post

Link to post
Share on other sites

PaulIA's Auto3Lib library of AutoIt functions contains _ListView_GetColumn, which should do this for you. Once you have it installed, dissect his "Listview 1.au3" example script to see how it works.


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post

Link to post
Share on other sites

You actually have to use both A3LListView.au3 AND A3LHeader.au3:

#include <GuiConstants.au3>
#include <A3LHeader.au3>
#include <A3LListView.au3>

$hGUI = GUICreate("ListView Edit Lable", 400, 300)
$ListView = GUICtrlCreateListView("col1|col2|col3", 10, 10, 380, 240)
GUICtrlCreateListViewItem("line1|data1|more1", $ListView)
GUICtrlCreateListViewItem("line2|data2|more2", $ListView)
GUICtrlCreateListViewItem("line3|data3|more3", $ListView)
GUICtrlCreateListViewItem("line4|data4|more4", $ListView)
GUICtrlCreateListViewItem("line5|data5|more5", $ListView)
$Btn_Header = GUICtrlCreateButton("Header", 150, 260, 100, 30)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
        Case $Btn_Header
            $hListView = ControlGetHandle($hGUI, "", $ListView)
            $iColCnt = _ListView_GetColumnCount ($hListView)
            ConsoleWrite("Debug: $iColCnt = " & $iColCnt & @LF)
            $hHeader = _ListView_GetHeader ($hListView)
            $sMsg = "ListView Column Headers:" & @CRLF
            For $i = 0 To $iColCnt - 1
                $sMsg &= @CRLF & $i & ": " & _Header_GetItemText ($hHeader, $i)
            MsgBox(64, "Results", $sMsg)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.