Leaderboard
Popular Content
Showing content with the highest reputation on 11/08/2023 in all areas
-
Hi, some random DoS attacks ongoing at the mo. Server is auto banning, but maybe some outages. Thanks, Jos, for letting me know,3 points
-
I noticed there are a few annoying quirks in the Indent Fix stull like going to the wrong like on a newline. Will try to see to that tomorrow. Noticed while doing the rewrite of AutoIt3Wrapper using IPC and also getting rid of the tmp file as indicators for running processes.2 points
-
This Beta version contains SciTE v 5.4.0 and a major change to the AutoComplete functionality and automatically addition of required #include lines at the top. Many LUA functions are updated. 2023-12-27 13:30 Merged SciTE Release 5.4.0 with the SciTE4AutoIt3 sources Many changes to the new LUA functions 2023-03-10 13:00 Merged SciTE Release 5.3.4 with the SciTE4AutoIt3 sources Added option to jump to the definition of a Variable when Ctrl+J is used with the caret placed with a variable name. Many other small changes... see this thread for details Move the zip into the Beta directory making it for more people available. Move this thread to AutoIt Technical discussions, so others can participate in testing when they want. 2023-03-14 20:00 Merged SciTE Release 5.3.5 with the SciTE4AutoIt3 sources Also show constant includes in #include<... dropdown. Fixed issue with portable directory duplicates due to improper case checking Fixed REGEX getting all possible *.au3 files when Dir returns a Timestamp in format hh:mm AM/PM How to test/install: Backup your current SciTE directory! Download the Beta SciTE4AutoIt3.exe installer or portable zip. Run installer or do your thing with the portable zip. Check below documentation on all possible configuration option via #Directive or in the SciTEUser.properties. Jos ============ Quick feature overview... check this Documentation for all details ======================================== This is how it looks with a basic example: Here I am using @Melba23's ExMsgBox include file which is located in my Private Include directory: This shown you in more details the basics of the changes: The announced change here has grown into a project on it own, which I feel is now at a stage where I could use some help from beta testers trying out these updated. I have created the initial documentation on all updates made and how the added functionality works, which is now part of the Helpfile available: AutoComplete & Dynamic Includes Previous Top Next Overview This LUA script functionality build in the SciTE4AutoIt3 version of SciTE will dynamically add #include statements required for the used UDFs or Global Const Variables. When dynamic.includes=1 you will be able to use Ctrl+Shift+z to process the whole file and scan it for missing Global Const Variables or UDFs. When dynamic.includes.whiletyping=1 is also set, the LUA functionality will add the required #include lines while typing. This only works when dynamic.includes=1. The AutoComplete functionality has also been changed and will now also search for partial matches in the names in stead of "Starting with", so you don't need to know the exact start of the funtion to be able to search for it. Changes to existing features Syntax Coloring All found Func's as defined here, not just the standard ones, will now immediately have their correct Font & formatting as defined for properties Styles 15-17. After you specified a none-standard known UDF, you will see it has Style 17 Color&Formatting when it is an UDF that exists in an Include file specifically for this Script. Selection for #include lines You can now use either < ' " as starting character to trigger the DropdownList with available include files. This list will now include all Standard, User defined and Dynamically found Include files. You can now type any part of the include name, not just the starting letters, to find the Include file you want. For example when you type: #include<apic this will be shown and we just press 2 times the Down key: .. then when you hit the Tab key, this will be the result: Smart AutoComplete function for Variables, Functions and Abbreviations The Dropdown will show al list of possible Variables or Functions and Abbreviation when you start typing. The match is done on the whole functionname now, not just the starting characters. The Starting $ or _ characters are ignored in this search and the results are shown in the order of the starting position in the found "words" of the typed characters: Example 1: When we type Find the below is returned: As you can see they are sorted in the order of starting position of "Find" and then Alphabetically Example 2: When you type $Yes, the result will be: New: How Dynamic #Include line insertion works Example1 When you type the following in your source: _ArrayAdd .. and then when you hit the Opening bracket or space key, the required #include<array.au3> line will be added within the existing or newly created #region: The same will happen when you use one of the Global Const variables from one of the *constants*.au3 includes in the defined include directories. This #region can be moved to any place in the script you prefer and will be used from here on as long as you do not change anything in those 2 #region lines. Any Subsequent added include file will be added to the end of the list with the Date&Time of the addition so you can easily see when/what was added. Example2 This is an Example for an new script in the SciTE_Jump Directory showing the use of the #SciTE4AutoIt3_Dynamic_Include_Path=; directive: The includes for this Utility are located in the Includes subdirectory, so aren't considered unless we specify it as follows: #SciTE4AutoIt3_Dynamic_Include_Path=;Includes; ... and then we start typing the name of one of the UDFs in a include in this directory and hit Tab on the first one shown: When we then hit the Opening bracket or Space key, the required #include"includes\_SciTE.au3" line will be added within the existing or newly created #region: Example3 This is an Example for a Global Const include file addition: We have just typed the last line of this script: .. and hit the Space key, the required #include<MsgBoxConstants.au3> line will be added within the existing #Region above the #EndRegion line: These are all the Func's (UDFs) that will be recognized by the dynamic include process: All Funcs in the default autoit/includes directory with format _ABC(), undocumented Funcs will be added to AutoComplete All Funcs except __*.au3 from all extra *.au3 Files in the openfile= paths that have a #include-once in it, are added to Style 16 (UserUDFs). All Funcs from the current script file are added to style 17 (InFIleUDFs) All Gobal Const Variables defined in any of the previous defined paths that are defined in a *constants*.au3 scriptfile which also includes #include-once. All Funcs except __*.au3 from all *.au3 Files in the current script directory are added to Style 16 (UserUDFs). All Funcs except __*.au3 from all *.au3 Files in the directories defined with Directive:#SciTE4AutoIt3_Dynamic_Include_Path=;Includes\relative\path;d;\includes\absolute\path Items 1-4 are read from those directories one time during the life of SciTE, but only when the first *.au3 files is opened. (slows it down ~0.5 sec one time to build all required tables) Items 5-6 are read each time an *au3 file is Opened or Switched to its Tab. (slows it down ~0.1 - 0.2 secs per change of tab and at Save time, to build all required current file tables) Configuration options for AutoComplete & Dynamic Includes This is the section in au3.properties where the autocomplete & dynamic includes config is defined. You can copy any of these lines into your SciTEUser.properties: ## ------------------------------------------------------------------------------------------------------------------------ ## dynamic.include Directives and properties reference ## ----------------------------------------------------- #SciTE4AutoIt3_Dynamic_Include=y ;dynamic.include=y/n #SciTE4AutoIt3_Dynamic_Include_whiletyping=y ;dynamic.include.whiletyping=y/n #SciTE4AutoIt3_Dynamic_Include_recursive_check=n ;dynamic.include.recursive.check=n/y #SciTE4AutoIt3_Dynamic_Include_use_local_cache=n ;dynamic.include.use.local.cache=n/y #SciTE4AutoIt3_Dynamic_Include_version=prod ;dynamic.include.version=prod/beta #SciTE4AutoIt3_Dynamic_Include_verboselevel=0 ;dynamic.include.verbose.level=0/1/2 #SciTE4AutoIt3_Dynamic_Include_Path= #SciTE4AutoIt3_AutoItDynamicIncludes_debug=n ;debug.autoitdynamicincludes=n/y #SciTE4AutoIt3_AutoItAutocomplete_debug=n ;debug.autoitautocomplet=n/y #SciTE4AutoIt3_AutoItGotoDefinition_debug=n ;debug.autoitgotodefinition=n/y #SciTE4AutoIt3_AutoItTools_debug=n ;debug.autoIttools=n/y ## ================================================ ## dynamic.include config ## ================================================ #> dynamic.include=y/n n=disabled y=will automatically build the func tables for coloring and autocomplete (requires restart SciTE!) dynamic.include=y #> whiletyping=y/n n=disabled y=will automatically add any required standard or USERincludefile for the current line, on the fly, when ) or enter ispressed !) dynamic.include.whiletyping=y #> use.local.cache=n/y n=disable y=Use cache file for local Include UDFs and VARs which could increase the speed when you have a lot of local includefiles which normally shouldn't be the case dynamic.include.use.local.cache=n #> version prod=Use AutoIt3 Production version beta=Use AutoIt3 Beta version dynamic.include.version=prod #> recursive.check=n/y n=disable y=When you like to only add an Include when it isn't included through another #included file yet. dynamic.include.recursive.check=n # level of debug messages 0/1/2 0=disabled; 1= Warnings & Timing per Function; 2=1+Total timing dynamic.include.verbose.level=0 #> Max number of includes files to read from the user directories in the list. This doesn't including the standard AutoIt3 includes. dynamic.max.includes=150 #> Max number total UDFs in the Userlist to handle by dynamic includes. This doesn't including the standard AutoIt3 includes-UDFs. dynamic.max.funcs=3000 #> Scriptlines longer that this value won't be looked at for Checking for required #Include statements. dynamic.max.line.length=300 ## ================================================ ## Autocomplete and call tip settings ## ================================================ autocomplete.au3.disable=0 autocomplete.au3.ignorecase=1 # Define minimum length before AutoComplete dropdown is shown- default=2 autocomplete.au3.min.length=2 # Include Abbrevs in AutoComplete dropdown (default=1/y) autocomplete.au3.include_abbrevs=1 # Don't show AutoItComplete with these styles (Internal only in SciTE4AutoIt3) autocomplete.ignore.styles.$(au3)=1;2;3;6;7;10;13 # Define which character will be added after Tab or Enter was entered and not on a Function/UDF: Can be \s \t \n for space;tab;newline autocomplete.au3.on.enter=\n autocomplete.au3.on.tab= # List of all AutoComplete API files used api.$(au3)=$(SciteDefaultHome)\api\au3.api;$(SciteDefaultHome)\api\au3.autoit3wrapper.api;$(SciteUserHome)\au3.std.dynamic.calltips.api;$(SciteUserHome)\au3.file.dynamic.calltips.api;$(SciteUserHome)\au3.usr.dynamic.calltips.api;$(SciteUserHome)\au3.user.calltips.api ## ================================================ ## Separate settings for debugging these Lua files ## ================================================ #> Enable debugging for these lua scripts: debug.autoitdynamicincludes=n debug.autoitautocomplete=n debug.autoitgotodefinition=n debug.autoitindentfix=n debug.autoittools=n #> when debug.tofile is defined, log records will be send to the log in stead of OutputPane: debug.tofile=$(SciteUserHome)\SciTE_LUA_Scripts_Debug.err # ------------------------------------------------------------------------------------------------------------------------1 point
-
Note: This is the continuation thread from the original one of 2012. The old one growed over 50 pages...so to make the overview better i created a new main thread for the ISN AutoIt Studio. You can find the old original thread here. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system and a lot more features!! Here are some screenshots: Here are some higlights: Easy to create/manage/public your AutoIt projects! Integrated GUI-Editor (ISN Form Studio 2) Integrated file & projectmanager Auto backupfunction for your Projects Extendable with plugins! Available in several languages Trophies Syntax highlighting /Autocomplete / Intelisense Macros Changelog manager for your project Detailed overview of the project (total working hours, total size...) Am integrated To-Do List for your project Open Source (You can download the source code from my website) And much much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: Link For more information visit my Homepage: https://www.isnetwork.at So, have fun with the ISN AutoIt Studio! And feel free to post your feedback, bugreports or ideas for this project here in this thread!1 point
-
Not really unless there are these kind of real quicks as I still need to start that rewrite. improper indenting is what it is right now, but wrong lines after Enter is not good and very annoying, so will try to tackle that soon first ! :) EDIT: Uploaded an updated zip file which hopefully fixes that wrong line issue for now... still a lot of work there to do.1 point
-
ListView marked cells selection via keys
argumentum reacted to UEZ for a topic
Here is another version of what I actually wanted to achieve. Thanks again to Velted for the appropriate code section: ;coded by LarsJ / Velted #include <Array.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("MustDeclareVars", 1) Global $hGui, $hLV Example() Func Example() $hGui = GUICreate("Mark Cell in Listview", 500, 540) Local $idLV = GUICtrlCreateListView("Column 0|Column 1|Column 2", 25, 10, 250, 500) For $i = 0 To 99 GUICtrlCreateListViewItem("Cell " & $i & ".0" & "|" & Hex(Int(Random() * 0xFFFFFF), 6) & "|", $idLV) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode, $bIsSelected, $ClrText, $ClrTextBk $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hLV Switch $iCode ; Handle arrow key presses for selection movement Case $NM_CUSTOMDRAW Local $tNMLVCUSTOMDRAW = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $dwDrawStage = DllStructGetData($tNMLVCUSTOMDRAW, "dwDrawStage") Local $dwItemSpec = DllStructGetData($tNMLVCUSTOMDRAW, "dwItemSpec") ; Item index Local $iSubItem = DllStructGetData($tNMLVCUSTOMDRAW, "iSubItem") ; Subitem index Local $uItemState = DllStructGetData($tNMLVCUSTOMDRAW, "uItemState") ; Item state Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any ITEM-related drawing operations Case $CDDS_ITEMPREPAINT ; Before painting an item Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window of any SUBITEM-related drawing operations Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) ; Before painting a subitem $bIsSelected = _GUICtrlListView_GetItemSelected($hLV, $dwItemSpec) If $bIsSelected Then DllStructSetData($tNMLVCUSTOMDRAW, "uItemState", BitAND($uItemState, BitNOT($CDIS_SELECTED))) Switch $iSubItem Case 0 To 1 ; Marked column $ClrText = $bIsSelected ? 0xFFFFFF : 0X0000000 $ClrTextBk = $bIsSelected ? 0xCC6600 : 0xFFFFFF Case 2 $ClrText = 0x000000 $ClrTextBk = "0x" & _GUICtrlListView_GetItemText($hLV, $dwItemSpec, 1) Case Else ; Other columns Return $CDRF_DODEFAULT EndSwitch DllStructSetData($tNMLVCUSTOMDRAW, "ClrText", $ClrText) ; Forecolor black DllStructSetData($tNMLVCUSTOMDRAW, "ClrTextBk", $ClrTextBk) ; Backcolor white Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY1 point -
ListView marked cells selection via keys
argumentum reacted to UEZ for a topic
The solution was provided by Velted from the German forum: ;coded by LarsJ / Velted #include <Array.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("MustDeclareVars", 1) Global $hGui, $hLV, $iLVx, $iLVy, $aHit[2] = [-1, -1] ; $aHit contains row & col of marked cell Example() Func Example() $hGui = GUICreate("Mark Cell in Listview", 500, 540) Local $idLV0 = GUICtrlCreateListView("Column 0|Column 1|Column 2", 25, 10, 250, 500) For $i = 0 To 99 GUICtrlCreateListViewItem("Cell " & $i & ".0" & "|Cell " & $i & ".1" & "|Cell " & $i & ".2", $idLV0) Next $hLV = GUICtrlGetHandle($idLV0) $iLVx = 25 $iLVy = 10 GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hLV Local $iSelectedItem = _GUICtrlListView_GetSelectionMark($hLV) ; ConsoleWrite(_GUICtrlListView_GetSelectedIndices($hLV) & @CRLF) Switch $iCode ; Handle arrow key presses for selection movement Case $NM_CUSTOMDRAW Local $tNMLVCUSTOMDRAW = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $dwDrawStage = DllStructGetData($tNMLVCUSTOMDRAW, "dwDrawStage") Local $dwItemSpec = DllStructGetData($tNMLVCUSTOMDRAW, "dwItemSpec") ; Item index Local $iSubItem = DllStructGetData($tNMLVCUSTOMDRAW, "iSubItem") ; Subitem index Local $uItemState = DllStructGetData($tNMLVCUSTOMDRAW, "uItemState") ; Item state Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any ITEM-related drawing operations Case $CDDS_ITEMPREPAINT ; Before painting an item ConsoleWrite("Row: " & $dwItemSpec & " - State: " & $uItemState & @CRLF) If _GUICtrlListView_GetItemSelected($hLV, $dwItemSpec) Then Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window of any SUBITEM-related drawing operations Else Return $CDRF_DODEFAULT EndIf Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) ; Before painting a subitem DllStructSetData($tNMLVCUSTOMDRAW, "uItemState", BitAND($uItemState, BitNOT(0x11))) Switch $iSubItem Case 0 To 1 ; Marked column DllStructSetData($tNMLVCUSTOMDRAW, "ClrText", 0xFFFFFF) ; Forecolor white DllStructSetData($tNMLVCUSTOMDRAW, "clrTextBk", 0xCC6600) ; Backcolor dark blue, BGR Case Else ; Other columns DllStructSetData($tNMLVCUSTOMDRAW, "ClrText", 0x000000) ; Forecolor black DllStructSetData($tNMLVCUSTOMDRAW, "ClrTextBk", 0xFFFFFF) ; Backcolor white EndSwitch Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY1 point -
Well, the timer is actually in there already when I was testing but commented out.... just uncomment lines 132 & 373 in AutoitGotoDefinition.lua to enable them.1 point
-
ListView marked cells selection via keys
argumentum reacted to Gianni for a topic
take a look to 1) FirstTest.au3 here...1 point -
OverviewFirst part First part of this example was published March/April 2021 and contains these main sections: Simple implementation of a virtual treeview created from data in a source file Multi-line treeview items and a discussion of an example in the help file Other sections about Item images, Performance tests and Treeview structure Second part Second part of the example has started up in January 2023: Updated all first part examples (item param offset, performance optimizations) Short summary of first part and further development of Real virtual treeviews TreeView posts Other posts and examples regarding treeviews: Saving/reading item levels and texts is the starting point for this example Use of colors and fonts in treeview items through custom draw code Virtual treeviews The basic idea behind implementing both a virtual treeview and a virtual listview is to store as much data as possible in the data source and as little data as possible in the treeview and listview. The purpose is especially to performance optimize creation of the treeview and listview. A virtual listview is created with the LVS_OWNERDATA style. To populate listview items and subitems, you respond to LVN_GETDISPINFO notifications contained in WM_NOTIFY messages. A virtual treeview isn't created based on a particular style of the treeview. A virtual treeview is created by setting LPSTR_TEXTCALLBACK and I_CHILDRENCALLBACK values in the TVITEM structure used to create the treeview items. The LPSTR_TEXTCALLBACK and I_CHILDRENCALLBACK values cause TVN_GETDISPINFO notifications (also contained in WM_NOTIFY messages) to be generated. To populate treeview items and child items, you respond to these TVN_GETDISPINFO notifications. Create treeview from data sourceIn the attempt to implement a virtual treeview, the first step is to create the treeview based on a data source e.g. a simple text file. This post demonstrates how to uniquely store a treeview in a text file and then uniquely restore the same treeview. It's sufficient to store treeview item levels and texts. This is a slightly modified version of TreeView.txt: 0|0 0|1 0|2 1|3 1|This 1|is 2|6 2|a 2|very 2|nice 3|10 3|TreeView 0|, (comma) 1|13 1|indeed. 0|15 And a slightly modified version of the code to recreate the treeview (1) Conventional TreeView.au3) #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> Global $hTreeView Example() Func Example() ; Create GUI Local $hGui = GUICreate( "Create Conventional TreeView From File", 400, 300, 600, 300, $GUI_SS_DEFAULT_GUI ) ; Create TreeView Local $idTreeView = GUICtrlCreateTreeView( 4, 4, 392, 292, $GUI_SS_DEFAULT_TREEVIEW, $WS_EX_CLIENTEDGE ) $hTreeView = GUICtrlGetHandle( $idTreeView ) ; Read level and text of TreeView items and create TreeView CreateTreeView( FileReadToArray( "TreeView.txt" ) ) ; Show GUI GUISetState( @SW_SHOW, $hGui ) ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup GUIDelete( $hGui ) EndFunc ; Create conventional TreeView Func CreateTreeView( $aItems ) ; TreeView item information Local $aItem, $hItem ; TreeView level information Local $aLevels[100], $iLevel = 0, $iLevelPrev = 0 ; $aLevels[$iLevel] contains the last item of that level ; Add TreeView root $aItem = StringSplit( $aItems[0], "|", 2 ) $hItem = _GUICtrlTreeView_Add( $hTreeView, 0, $aItem[1] ) $aLevels[$iLevel] = $hItem ; Add TreeView items For $i = 1 To UBound( $aItems ) - 1 $aItem = StringSplit( $aItems[$i], "|", 2 ) $iLevel = $aItem[0] If $iLevel <> $iLevelPrev Then $hItem = $iLevel > $iLevelPrev ? _GUICtrlTreeView_AddChild( $hTreeView, $aLevels[$iLevelPrev], $aItem[1] ) _ ; A child of the previous level : _GUICtrlTreeView_Add( $hTreeView, $aLevels[$iLevel], $aItem[1] ) ; A sibling of the level $iLevelPrev = $iLevel Else ; $iLevel = $iLevelPrev $hItem = _GUICtrlTreeView_Add( $hTreeView, $aLevels[$iLevel], $aItem[1] ) ; A sibling of the level EndIf $aLevels[$iLevel] = $hItem Next ; $aLevels[$iLevel] contains the last item of that level ; Expand all child items _GUICtrlTreeView_Expand( $hTreeView ) EndFunc Reduced and optimized functionIn the CreateTreeView() function at bottom of the code above, the treeview is created using _GUICtrlTreeView_Add() and _GUICtrlTreeView_AddChild() from GuiTreeView.au3. Both of these functions executes __GUICtrlTreeView_AddItem(), which is an internal function. This internal function fills the TVITEM structures where you can set the LPSTR_TEXTCALLBACK and I_CHILDRENCALLBACK values. The second step is to reduce and optimize the code in CreateTreeView() so that the TVITEM structure is filled in directly in this function. This is the reduced and optimized function (2) Optimized TreeView.au3) ; Create TreeView with optimized code Func CreateTreeView( $aItems ) ; TreeView item information Local $aItem ; TreeView level information Local $aLevels[100][2], $iLevel = 0, $iLevelPrev = 0 ; $aLevels[$iLevel][0]/[1] contains the last item/parent of that level ; TreeView text buffer Local $iBuffer, $tBuffer = DllStructCreate( "wchar Text[50]" ), $pBuffer = DllStructGetPtr( $tBuffer ) ; TreeView insert structure Local $tInsert = DllStructCreate( $tagTVINSERTSTRUCT ), $pInsert = DllStructGetPtr( $tInsert ) DllStructSetData( $tInsert, "InsertAfter", $TVI_LAST ) DllStructSetData( $tInsert, "Mask", $TVIF_TEXT ) DllStructSetData( $tInsert, "Text", $pBuffer ) ; Add TreeView root $aItem = StringSplit( $aItems[0], "|", 2 ) $iBuffer = 2 * StringLen( $aItem[1] ) + 2 DllStructSetData( $tBuffer, "Text", $aItem[1] ) DllStructSetData( $tInsert, "TextMax", $iBuffer ) $aLevels[$iLevel][1] = NULL DllStructSetData( $tInsert, "Parent", $aLevels[$iLevel][1] ) $aLevels[$iLevel][0] = GUICtrlSendMsg( $idTreeView, $TVM_INSERTITEMW, 0, $pInsert ) ; Add TreeView items For $i = 1 To UBound( $aItems ) - 1 $aItem = StringSplit( $aItems[$i], "|", 2 ) $iBuffer = 2 * StringLen( $aItem[1] ) + 2 DllStructSetData( $tBuffer, "Text", $aItem[1] ) DllStructSetData( $tInsert, "TextMax", $iBuffer ) $iLevel = $aItem[0] If $iLevel <> $iLevelPrev Then $aLevels[$iLevel][1] = $iLevel > $iLevelPrev ? $aLevels[$iLevelPrev][0] _ ; A child of the previous level : GUICtrlSendMsg( $idTreeView, $TVM_GETNEXTITEM, $TVGN_PARENT, $aLevels[$iLevel][0] ) ; A sibling of the level $iLevelPrev = $iLevel EndIf DllStructSetData( $tInsert, "Parent", $aLevels[$iLevel][1] ) $aLevels[$iLevel][0] = GUICtrlSendMsg( $idTreeView, $TVM_INSERTITEMW, 0, $pInsert ) Next ; $aLevels[$iLevel][0]/[1] contains the last item/parent of that level ; Expand all child items _GUICtrlTreeView_Expand( $hTreeView ) EndFunc Semi-virtual treeviewThe third step is to implement a semi-virtual treeview, where only the tree structure itself but not the item texts are created in CreateTreeView(). Instead of filling in the texts, we set the LPSTR_TEXTCALLBACK value in the TVITEM structure. And then we fill in the texts as needed through a WM_NOTIFY message handler and TVN_GETDISPINFO notifications (3) Semi-Virtual TreeView.au3) ; Create TreeView structure Func CreateTreeView( $aItems ) ; TreeView level information Local $aLevels[100][2], $iLevel = 0, $iLevelPrev = 0 ; $aLevels[$iLevel][0]/[1] contains the last item/parent of that level ; TreeView insert structure Local $tInsert = DllStructCreate( $tagTVINSERTSTRUCT ), $pInsert = DllStructGetPtr( $tInsert ) DllStructSetData( $tInsert, "InsertAfter", $TVI_LAST ) DllStructSetData( $tInsert, "Mask", $TVIF_HANDLE+$TVIF_PARAM+$TVIF_TEXT ) DllStructSetData( $tInsert, "Text", -1 ) ; $LPSTR_TEXTCALLBACK ; Add TreeView root $aLevels[$iLevel][1] = Ptr(0) DllStructSetData( $tInsert, "Param", 0 ) DllStructSetData( $tInsert, "Parent", $aLevels[$iLevel][1] ) $aLevels[$iLevel][0] = GUICtrlSendMsg( $idTreeView, $TVM_INSERTITEMW, 0, $pInsert ) ; Add TreeView items For $i = 1 To UBound( $aItems ) - 1 $iLevel = StringSplit( $aItems[$i], "|", 2 )[0] If $iLevel <> $iLevelPrev Then $aLevels[$iLevel][1] = $iLevel > $iLevelPrev ? $aLevels[$iLevelPrev][0] _ ; A child of the previous level : GUICtrlSendMsg( $idTreeView, $TVM_GETNEXTITEM, $TVGN_PARENT, $aLevels[$iLevel][0] ) ; A sibling of the level $iLevelPrev = $iLevel EndIf DllStructSetData( $tInsert, "Param", $i ) DllStructSetData( $tInsert, "Parent", $aLevels[$iLevel][1] ) $aLevels[$iLevel][0] = GUICtrlSendMsg( $idTreeView, $TVM_INSERTITEMW, 0, $pInsert ) Next ; $aLevels[$iLevel][0]/[1] contains the last item/parent of that level ; Expand all child items _GUICtrlTreeView_Expand( $hTreeView ) EndFunc Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Switch HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Case $hTreeView Switch DllStructGetData( $tNMHDR, "Code" ) Case $TVN_GETDISPINFOW ; Display TreeView item text Local Static $tBuffer = DllStructCreate( "wchar Text[50]" ), $pBuffer = DllStructGetPtr( $tBuffer ) Local $tDispInfo = DllStructCreate( $tagNMTVDISPINFO, $lParam ), $sText = StringSplit( $aItems[DllStructGetData($tDispInfo,"Param")], "|", 2 )[1] DllStructSetData( $tBuffer, "Text", $sText ) DllStructSetData( $tDispInfo, "Text", $pBuffer ) DllStructSetData( $tDispInfo, "TextMax", 2 * StringLen( $sText ) + 2 ) EndSwitch EndSwitch #forceref $hWnd, $iMsg, $wParam EndFunc Note that this reduces and optimizes the code in CreateTreeView() even more because the buffer for text strings is no longer needed. Instead, the buffer is populated in the WM_NOTIFY message handler. This technique has the great advantage that only visible treeview items are filled with text strings. Because item texts are only filled in when the items are visible in the treeview, it's necessary to establish a connection between the treeview items and the data source that contains the texts. The data source, which is a simple text file, is loaded into an array. The connection between a treeview item and the data source is the index in this array. Therefore, the array index is stored in the Param field of the TVITEM structure. Virtual treeviewTo make the treeview completely virtual, the fourth and final step is to create and display child items only when required. That is, when an end user clicks the expand button to the left of a treeview item that actually contains child items. And only direct children of this item will be created. If an end user doesn't click an expand button (because these child items are not the ones he's looking for), the child items in question will not be created in the tree structure at all. To make the treeview completely virtual only first level (level-0) items are created in CreateTreeView(). Instead of creating child items, we set the I_CHILDRENCALLBACK value in the TVITEM structure. And then we create child items as needed through a WM_NOTIFY message handler and TVN_GETDISPINFO and TVN_ITEMEXPANDING notifications (4) Virtual TreeView.au3) ; Create TreeView structure Func CreateTreeView( $aLevel0 ) ; TreeView insert structure Local $tInsert = DllStructCreate( $tagTVINSERTSTRUCT ), $pInsert = DllStructGetPtr( $tInsert ) DllStructSetData( $tInsert, "InsertAfter", $TVI_LAST ) DllStructSetData( $tInsert, "Mask", $TVIF_CHILDREN+$TVIF_HANDLE+$TVIF_PARAM+$TVIF_TEXT ) DllStructSetData( $tInsert, "Parent", NULL ) DllStructSetData( $tInsert, "Children", -1 ) ; $I_CHILDRENCALLBACK DllStructSetData( $tInsert, "Text", -1 ) ; $LPSTR_TEXTCALLBACK ; Add TreeView items For $i = 0 To UBound( $aLevel0 ) - 1 DllStructSetData( $tInsert, "Param", $aLevel0[$i] ) GUICtrlSendMsg( $idTreeView, $TVM_INSERTITEMW, 0, $pInsert ) Next EndFunc Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Switch HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Case $hTreeView Switch DllStructGetData( $tNMHDR, "Code" ) Case $TVN_GETDISPINFOW ; Display TreeView item text Local Static $tBuffer = DllStructCreate( "wchar Text[50]" ), $pBuffer = DllStructGetPtr( $tBuffer ) Local $tDispInfo = DllStructCreate( $tagNMTVDISPINFO, $lParam ), $iIndex = DllStructGetData( $tDispInfo, "Param" ), $sText = StringSplit( $aItems[$iIndex], "|", 2 )[3] DllStructSetData( $tBuffer, "Text", $sText ) DllStructSetData( $tDispInfo, "Text", $pBuffer ) DllStructSetData( $tDispInfo, "TextMax", 2 * StringLen( $sText ) + 2 ) DllStructSetData( $tDispInfo, "Children", StringSplit( $aItems[$iIndex], "|", 2 )[1] = 0 ? 0 : 1 ) Case $TVN_ITEMEXPANDINGW ; Create TreeView structure for childs Local $tTreeView = DllStructCreate( $tagNMTREEVIEW, $lParam ) If BitAND( DllStructGetData( $tTreeView, "Action" ), $TVE_EXPAND ) <> $TVE_EXPAND _ Or Int( StringSplit( $aItems[DllStructGetData($tTreeView,"NewParam")], "|", 2 )[2] ) Then Return ; TreeView insert structure Local $tInsert = DllStructCreate( $tagTVINSERTSTRUCT ), $pInsert = DllStructGetPtr( $tInsert ) DllStructSetData( $tInsert, "InsertAfter", $TVI_LAST ) DllStructSetData( $tInsert, "Mask", $TVIF_CHILDREN+$TVIF_HANDLE+$TVIF_PARAM+$TVIF_TEXT ) DllStructSetData( $tInsert, "Parent", DllStructGetData( $tTreeView, "NewhItem" ) ) DllStructSetData( $tInsert, "Children", -1 ) ; $I_CHILDRENCALLBACK DllStructSetData( $tInsert, "Text", -1 ) ; $LPSTR_TEXTCALLBACK ; Add TreeView children Local $iNewIndex = DllStructGetData( $tTreeView, "NewParam" ) + 1 For $i = 0 To StringSplit( $aItems[$iNewIndex-1], "|", 2 )[1] - 1 DllStructSetData( $tInsert, "Param", $iNewIndex + $i ) GUICtrlSendMsg( $idTreeView, $TVM_INSERTITEMW, 0, $pInsert ) Next ; Indicate that children have been added $aItems[$iNewIndex-1] = StringReplace( $aItems[$iNewIndex-1], 7, "1" ) EndSwitch EndSwitch #forceref $hWnd, $iMsg, $wParam EndFunc Creating only first level (level-0) items in CreateTreeView() is the crucial step that truly optimizes creation of the treeview. CreateTreeView() in this version is very simple and fast. $aLevel0 is an index of first level (level-0) items. To handle TVN_GETDISPINFO and TVN_ITEMEXPANDING notifications regarding child items, more information is needed in the source file (TreeView-4.txt) 0|000|0|0 0|000|0|1 0|003|0|2 1|000|0|3 1|000|0|This 1|004|0|is 2|000|0|6 2|000|0|a 2|000|0|very 2|002|0|nice 3|000|0|10 3|000|0|TreeView 0|002|0|, (comma) 1|000|0|13 1|000|0|indeed. 0|000|0|15 It's the number of child items in the second field, and a flag to indicate whether child items have already been created in the third field. At top of the TVN_ITEMEXPANDING code section, it's checked if a treeview item with child items is expanded or collapsed and if these child items are already created: Case $TVN_ITEMEXPANDINGW ; Create TreeView structure for childs Local $tTreeView = DllStructCreate( $tagNMTREEVIEW, $lParam ) If BitAND( DllStructGetData( $tTreeView, "Action" ), $TVE_EXPAND ) <> $TVE_EXPAND _ Or Int( StringSplit( $aItems[DllStructGetData($tTreeView,"NewParam")], "|", 2 )[2] ) Then Return The rest of the code in the TVN_ITEMEXPANDING section creates the child items. This code is again very simple and fast. 100,000 items5) 100,000 Items.au3 creates a virtual treeview with 100,000 items based on the 100,000.txt source file. Of course, creating the treeview is lightning fast. 7z-fileThe 7z-file contains source code for UDFs and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. VirtualTreeView.7z1 point