Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2020 in all areas

  1. Siwa, The UDF creates a "shadow array" to store the content of the ListView which is used to manipulate the content when the ListView content is altered and is then used to redraw the new ListView. This array is limited to text only, so no form of image is possible if you intend to do anything fancy with the content. M23
    1 point
  2. Siwa, The UDF does not handle images in the ListView - sorry about that. M23
    1 point
  3. #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get/Set Item StateImage (v" & @AutoItVersion & ")", 400, 300) Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState(@SW_SHOW) Local $hImage = _GUIImageList_Create(13, 13) Local $hBitMap = _WinAPI_LoadImage(0, "Check.bmp", $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE) _GUIImageList_Add($hImage, $hBitMap) _WinAPI_DeleteObject($hBitMap) _GUICtrlListView_SetImageList($idListview, $hImage, 2) _GUICtrlListView_AddColumn($idListview, "Column 1", 120) _GUICtrlListView_AddColumn($idListview, "Column 2", 100) _GUICtrlListView_AddColumn($idListview, "Column 3", 100) _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2) _GUICtrlListView_SetItemStateImage($idListview, 1, 1) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example To run this script convert your jpg into bmp
    1 point
  4. I would like to share my version of this since I am using the Array functions... #include <GuiListView.au3> #include <Array.au3> Func _GUICtrlListView_GetItemsArray($hListView) $cnt = _GUICtrlListView_GetItemCount($hListView) If $cnt > 0 Then $firstLine = _GUICtrlListView_GetItemTextArray($hListView, 0) _ArrayTranspose($firstLine) If $cnt > 1 Then For $i = 1 to $cnt-1 $moreLine = _GUICtrlListView_GetItemTextArray($hListView, $i) _ArrayTranspose($moreLine) _ArrayConcatenate($firstLine, $moreLine) Next EndIf ;Remove the first columns as it contains the counts of each line _ArrayColDelete($firstLine, 0) Return $firstLine Else Return False EndIf EndFunc
    1 point
  5. I was looking through the gdiplus.dll and saw the cached bitmap functions https://docs.microsoft.com/en-us/windows/win32/api/gdiplusheaders/nl-gdiplusheaders-cachedbitmap Functions: ;Short example (pseudocode!) Local $iW, $iH, $hWnd ;<- You supply these Local $hG = _GDIPlus_GraphicsCreateFromHWND($hWnd) Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hG) Local $hCachedBmp = __GDIPlus_CachedBitmapCreate($hG, $hBmp) __GDIPlus_GraphicsDrawCachedBitmap($hG, $hCachedBmp, 0, 0) ;(hGraphics, hCachedBmp, X, Y) __GDIPlus_CachedBitmapDispose($hCachedBmp)
    1 point
  6. AdLibRegister is used to run a function repeatedly, and this may slow the script down. As says the helpfile, "The adlib function should be kept simple as it is executed often and during this time the main script is paused. " Same thing using a timer The only way I can think of to avoid this is to use AdLib (or timer) to run a 2nd script (which will not slow down the main script)
    1 point
  7. Just a little bit faster then the one with ControlListView: Func _GUICtrlListView_GetItemsArray($f_iCtrl) ; Get row and colum count Local $l_iRows = GUICtrlSendMsg($f_iCtrl, $LVM_GETITEMCOUNT, 0, 0) Local $l_iCols = _SendMessage(HWnd(GUICtrlSendMsg($f_iCtrl, $LVM_GETHEADER, 0, 0)), 0x1200) ; Error checking If $l_iRows * $l_iCols = 0 Then Return SetError(1) If IsHWnd($f_iCtrl) Then Return SetError(2) ; Create result array Local $l_aListView[$l_iRows][$l_iCols] ; Create structure and pointer Local $l_boUnicode = (GUICtrlSendMsg($f_iCtrl, $LVM_GETUNICODEFORMAT, 0, 0) <> 0) Local $l_hMessage = $l_boUnicode ? $LVM_GETITEMTEXTW : $LVM_GETITEMTEXTA Local $l_tBuffer = DllStructCreate($l_boUnicode ? "wchar Text[4096]" : "char Text[4096]") Local $l_pBuffer = DllStructGetPtr($l_tBuffer) Local $l_tItem = DllStructCreate($tagLVITEM) DllStructSetData($l_tItem, "TextMax", 4096) Local $l_pItem DllStructSetData($l_tItem, "Text", $l_pBuffer) ; Loop through listview For $l_iRow = 0 To $l_iRows - 1 For $l_iCol = 0 To $l_iCols - 1 ; Set data in structure DllStructSetData($l_tItem, "SubItem", $l_iCol) $l_pItem = DllStructGetPtr($l_tItem) DllStructSetData($l_tItem, "Text", $l_pBuffer) ;Get Data and populate array GUICtrlSendMsg($f_iCtrl, $l_hMessage, $l_iRow, $l_pItem) $l_aListView[$l_iRow][$l_iCol] = DllStructGetData($l_tBuffer, "Text") Next Next Return $l_aListView EndFunc ;==>_GUICtrlListView_GetItemsArray Please note, that this one is expecting control ID not handle.
    1 point
  8. czardas, Light dawns - thanks. Although I still fail to see why only assigning one variable per line is difficult "to manage and aesthetically" - just put those lines inside a region and shrink it when not required: Global $variable01, $variable02, $variable03, $variable04 Func _Assign_Values() ; Other code #Region $variable01 = "a123" $variable02 = "r123" $variable03 = "z456" $variable04 = "a789" #EndRegion ; Other code EndFunc M23
    1 point
  9. is there a way to <insert topic name here> and get the key that was pressed? i understand if this sounds like im trying to make a keylogger, if so it's fine if u dont help me.
    1 point
  10. Ya, I think the people at autoit make sure it's not easy to make 'bad' programs. You can use this to see the keys that do work and the asc code for them. Opt("ExpandVarStrings", 1) For $i = 0 To 255 HotKeySet(Chr($i), "HotKeyFunc") Next $timer = "" While True Sleep(6000) If $timer <> "" Then If TimerDiff($timer) > 500 Then $timer = ToolTip("") EndIf WEnd Func HotKeyFunc() ToolTip("@HotKeyPressed@@CRLF@-----@CRLF@" & Asc(@HotKeyPressed), 10, 10) $timer = TimerInit() HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) HotKeySet(@HotKeyPressed, "HotKeyFunc") EndFunc [edit] Lol, I found the problem. It's in the helpfile. "Up to 64 simultaneous hotkeys per script may be registered."
    1 point
  11. This?For $i = 0 To 255 HotKeySet(Chr($i), "HotKeyFunc") Next While True Sleep(600000) WEnd Func HotKeyFunc() MsgBox(0, "Test", @HotKeyPressed) Send(@HotKeyPressed) EndFunc
    1 point
×
×
  • Create New...