Jump to content

ListView max. limits


Zedna
 Share

Recommended Posts

ListView max. limits:
 - max 259 Chars display in subitem (Windows' limit)
 - max 4096 Chars stored in subitem (AutoIt's limit)
 - max 4096 Chars get from subitem (AutoIt's limit)
 

$text = "ListView max. limits:" & @CRLF & _
        " - max 259 Chars display in subitem (Windows' limit)" & @CRLF & _
        " - max 4096 Chars stored in subitem (AutoIt's limit)" & @CRLF & _
        " - max 4096 Chars get from subitem (AutoIt's limit)"

#AutoIt3Wrapper_UseX64=n

#include <GUIConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("ListView max. limits", 400, 400)
$ListView1 = GUICtrlCreateListView("#|Value", 2, 2, 396, 296)
GUICtrlCreateLabel($text, 20, 308, 376, 90)
GUISetState(@SW_SHOW)

Add(250, 0)
Add(260, 1)
Add(270, 2)
Add(300, 3)
Add(500, 4)
Add(1000, 5)
Add(2000, 6)
Add(4000, 7)
Add(4090, 8)
Add(4100, 9)

_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 300)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func Add($n, $i)
    GUICtrlCreateListViewItem($n & '|' & Generate($n), $ListView1)
    ConsoleWrite($n & ': ' & _GUICtrlListView_GetItemText($ListView1, $i, 1) & @CRLF)
EndFunc

Func Generate($len)
    $s = '1234567890'
    $ret = ''
    For $i = 1 To $len/10
        $ret &= $s
    Next
    Return $ret
EndFunc

 

MSDN:

https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvitema

Quote

pszText: If the structure receives item attributes, pszText is a pointer to a buffer that receives the item text. Note that although the list-view control allows any length string to be stored as item text, only the first 259 TCHARs are displayed.

 

In AutoIt's GUIListView UDF there is 4096 max. buffer length (for subitem text) hardcoded for all _GUICtrlListView_xxx() functions.

 

Edited by Zedna
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...