Jump to content

How to get SysListView32 header text?


Recommended Posts

Try something like this:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $aInfo, $idListview

    GUICreate("ListView Get Column", 400, 300)
    $idListview = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
    _GUICtrlListView_SetColumnWidth($idListview, 0, 100)
    GUISetState(@SW_SHOW)

    GUICtrlCreateListViewItem("index 0|data1|more1", $idListview)
    GUICtrlCreateListViewItem("index 1|data2|more2", $idListview)
    GUICtrlCreateListViewItem("index 2|data3|more3", $idListview)
    GUICtrlCreateListViewItem("index 3|data4|more4", $idListview)
    GUICtrlCreateListViewItem("index 4|data5|more5", $idListview)

    ; Change column
    $aInfo = _GUICtrlListView_GetColumn($idListview, 0)
    MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 Width: " & $aInfo[4])
    _GUICtrlListView_SetColumn($idListview, 0, "New Column 1", 150)
    $aInfo = _GUICtrlListView_GetColumn($idListview, 0)
    MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 header text: " & $aInfo[5]) ; <<<<<<<<<<<<<<<<<<<<<<

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>Example

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

15 hours ago, BrewManNH said:

尝试这样的东西:

#include <GUIConstantsEx.au3> 
#include <GuiListView.au3> 
#include <MsgBoxConstants.au3>

示例()

Func Example()
    Local  $ aInfo , $ idListview

    GUICreate(“ListView中获取列” , 400300 )
    $ idListview  =  GUICtrlCreateListView(“COL1 | COL2 | COL3” , 22394268 )
    _GUICtrlListView_SetExtendedListViewStyle($ idListview , BITOR$ LVS_EX_FULLROWSELECT , $ LVS_EX_CHECKBOXES ))
    _GUICtrlListView_SetColumnWidth($ idListview , 0100 )
    GUISetState@SW_SHOW)

    GUICtrlCreateListViewItem(“索引0 | DATA1 | more1” , $ idListview )
    GUICtrlCreateListViewItem(“索引1 | DATA2 |更多2” , $ idListview )
    GUICtrlCreateListViewItem(“索引2 | DATA3 | more3” , $ idListview )
    GUICtrlCreateListViewItem(“索引3 | DATA4 | more4“ , $ idListview )
    GUICtrlCreateListViewItem(”index 4 | data5 | more5“ , $ idListview )

    ; 更改列
    $ aInfo  =  _GUICtrlListView_GetColumn($ idListview , 0 )
    MsgBox$ MB_SYSTEMMODAL , “信息” , “列1宽度:”  & $ aInfo [ 4 ] )
    _GUICtrlListView_SetColumn($ idListview , 0 , “新列1” , 150 )
    $ aInfo  =  _GUICtrlListView_GetColumn($ idListview , 0 )
    MsgBox$ MB_SYSTEMMODAL , “信息”, “Column 1 header text:”  & $ aInfo [ 5 ]; <<<<<<<<<<<<<<<<<<<<<<

    ; 循环直到用户退出。
    难道
    直到 GUIGetMsg() =  $ GUI_EVENT_CLOSE

    GUIDelete()
EndFunc    ; ==>示例

 

Thank you very much. I have solved my problem.

Link to comment
Share on other sites

  • 3 months later...

You really need to give us a LOT more information before anyone could even begin to understand what the problem is.

What are you trying to get the information from for example. What are you trying to get from it?

Post a runnable example as well.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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...